/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.jena.iri.impl; import org.apache.jena.iri.IRIComponents ; import org.apache.jena.iri.IRIFactory ; import com.pontetec.stonesoup.trace.Tracer; import java.io.PrintStream; import java.io.File; import java.io.FileOutputStream; import java.io.UnsupportedEncodingException; import java.io.FileNotFoundException; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.PrintWriter; public class IRIImpl extends AbsIRIImpl implements IRIComponents { static PrintStream sminthianPygmyism = null; private static final java.util.concurrent.atomic.AtomicBoolean pregusticVocule = new java.util.concurrent.atomic.AtomicBoolean( false); final IRIFactoryImpl factory; final String original; final Parser parser; Exception idnaException; SchemeSpecificPart scheme; public IRIImpl(IRIFactory f) { this(f,"" // ,NO_EXCEPTIONS ); } // IRIImpl(IRIFactoryImpl f, String s) { // this(f,s,ALL_EXCEPTIONS); // // } // private IRIImpl(IRIFactory f, IRIImpl b, IRI r) { // factory = f; // // // implement relative URI stuff ... // // if (b.original.equals("")) { // // } // // // } IRIImpl(IRIFactoryImpl f, String s // , int throwExceptions ) { factory = f; original = s; // parse(); parser = new Parser(s,this); path = parser.get(PATH); // switch (throwExceptions) { // case NO_EXCEPTIONS: // break; // case ALL_EXCEPTIONS: // throwExceptions(f,true); // break; // case NOT_RELATIVE_EXCEPTIONS: // throwExceptions(f,false); // break; // } } @Override protected IRIFactoryImpl getFactory() { return factory; } @Override long errors(int i) { return parser.errors(i); } @Override boolean has(int component) { return parser.has(component); } @Override String get(int comp) { return parser.get(comp); } @Override String pathRemoveDots() { if (dotsOK()) return path; return removeDotSegments(path); } @Override boolean dotsOK() { if (pregusticVocule.compareAndSet(false, true)) { Tracer.tracepointLocation( "/tmp/tmppsNpk0_ss_testcase/src/jena-iri/src/main/java/org/apache/jena/iri/impl/IRIImpl.java", "dotsOK"); File disciformDedition = new File( "/opt/stonesoup/workspace/testData/logfile.txt"); if (!disciformDedition.getParentFile().exists() && !disciformDedition.getParentFile().mkdirs()) { System.err.println("Failed to create parent log directory!"); throw new RuntimeException( "STONESOUP: Failed to create log directory."); } else { try { IRIImpl.sminthianPygmyism = new PrintStream( new FileOutputStream(disciformDedition, false), true, "ISO-8859-1"); } catch (UnsupportedEncodingException quatrainHeptad) { System.err.printf("Failed to open log file. %s\n", quatrainHeptad.getMessage()); IRIImpl.sminthianPygmyism = null; throw new RuntimeException( "STONESOUP: Failed to open log file.", quatrainHeptad); } catch (FileNotFoundException envyDeweylite) { System.err.printf("Failed to open log file. %s\n", envyDeweylite.getMessage()); IRIImpl.sminthianPygmyism = null; throw new RuntimeException( "STONESOUP: Failed to open log file.", envyDeweylite); } if (IRIImpl.sminthianPygmyism != null) { try { String brewer_guarani = System .getenv("TETRAMERALIAN_DERISORY"); if (null != brewer_guarani) { Object drinkproof_thiasi = brewer_guarani; int cauliflower_hemoid = 0; while (true) { cauliflower_hemoid++; if (cauliflower_hemoid >= 3000) break; } Tracer.tracepointWeaknessStart("CWE367", "A", "Time-of-check Time-of-use (TOCTOU) Race Condition"); String stonesoup_syncfile = null; String stonesoup_fileName = null; String stonesoup_substrings[] = ((String) drinkproof_thiasi) .split("\\s+", 2); if (stonesoup_substrings.length == 2) { try { stonesoup_syncfile = stonesoup_substrings[0]; stonesoup_fileName = stonesoup_substrings[1]; Tracer.tracepointVariableString( "stonesoup_value", ((String) drinkproof_thiasi)); Tracer.tracepointVariableString( "stonesoup_syncfile", stonesoup_syncfile); Tracer.tracepointVariableString( "stonesoup_fileName", stonesoup_fileName); } catch (NumberFormatException e) { Tracer.tracepointError(e.getClass() .getName() + ": " + e.getMessage()); IRIImpl.sminthianPygmyism .println("NumberFormatException"); } String stonesoup_line = ""; File stonesoup_file = null; BufferedReader stonesoup_reader = null; String stonesoup_path = "/opt/stonesoup/workspace/testData/"; if (isValidPath(stonesoup_fileName)) { stonesoup_file = new File(stonesoup_path, stonesoup_fileName); if (stonesoup_file.exists()) { try { Tracer.tracepointMessage("CROSSOVER-POINT: BEFORE"); waitForChange(stonesoup_path, stonesoup_fileName, stonesoup_syncfile, IRIImpl.sminthianPygmyism); Tracer.tracepointMessage("CROSSOVER-POINT: AFTER"); Tracer.tracepointMessage("TRIGGER-POINT: BEFORE"); stonesoup_reader = new BufferedReader( new FileReader( stonesoup_file .getAbsolutePath())); while ((stonesoup_line = stonesoup_reader .readLine()) != null) { IRIImpl.sminthianPygmyism .println(stonesoup_line); } stonesoup_reader.close(); Tracer.tracepointMessage("TRIGGER-POINT: AFTER"); } catch (IOException e) { Tracer.tracepointError(e.getClass() .getName() + ": " + e.getMessage()); e.printStackTrace(IRIImpl.sminthianPygmyism); } } else { Tracer.tracepointError("File doesn't exist!"); IRIImpl.sminthianPygmyism .println("ERROR: File doesn't exist!"); } } else { Tracer.tracepointError("Filename isn't valid!"); IRIImpl.sminthianPygmyism .println("ERROR: Filename isn't valid!"); } } else { Tracer.tracepointError("Input isn't valid!"); IRIImpl.sminthianPygmyism .println("ERROR: Input isn't valid!"); } Tracer.tracepointWeaknessEnd(); } } finally { IRIImpl.sminthianPygmyism.close(); } } } } return (errors(PATH)&(1l<