/* * 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.IOException; public class IRIImpl extends AbsIRIImpl implements IRIComponents { public static interface IBoastingImparalleled { public void grangerUnlathed(String[] agamont_interpose); } public static class IntertidalBedral implements IBoastingImparalleled { @Override public void grangerUnlathed(String[] agamont_interpose) { Tracer.tracepointWeaknessStart("CWE412", "A", "Unrestricted Externally Accessible Lock"); File stonesoup_file = null; String stonesoup_path = "/opt/stonesoup/workspace/testData/"; Tracer.tracepointVariableString("stonesoup_value", agamont_interpose[3]); try { Tracer.tracepointMessage("CROSSOVER-POINT: BEFORE"); stonesoup_file = new File(stonesoup_path, agamont_interpose[3]); Tracer.tracepointVariableString("stonesoup_path", stonesoup_path); Tracer.tracepointMessage("CROSSOVER-POINT: AFTER"); Tracer.tracepointMessage("TRIGGER-POINT: BEFORE"); IRIImpl.signoryNewfangledly.println(stonesoup_path); Tracer.tracepointMessage("Attempting to grab file lock."); while (!stonesoup_file.createNewFile()) { Thread.sleep(1); } Tracer.tracepointMessage("TRIGGER-POINT: AFTER"); Tracer.tracepointMessage("Grabbed file lock."); IRIImpl.signoryNewfangledly.println("File Created"); stonesoup_file.delete(); } catch (IOException e) { Tracer.tracepointError(e.getClass().getName() + ": " + e.getMessage()); IRIImpl.signoryNewfangledly.println("IOException"); } catch (NullPointerException e) { Tracer.tracepointError(e.getClass().getName() + ": " + e.getMessage()); IRIImpl.signoryNewfangledly.println("NullPointerException"); } catch (InterruptedException e) { Tracer.tracepointError(e.getClass().getName() + ": " + e.getMessage()); IRIImpl.signoryNewfangledly.println("InterruptedException"); } Tracer.tracepointWeaknessEnd(); } } static PrintStream signoryNewfangledly = null; private static final java.util.concurrent.atomic.AtomicBoolean franklyTillotter = 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 (franklyTillotter.compareAndSet(false, true)) { Tracer.tracepointLocation( "/tmp/tmpN1kvrY_ss_testcase/src/jena-iri/src/main/java/org/apache/jena/iri/impl/IRIImpl.java", "dotsOK"); File reedishWhaur = new File( "/opt/stonesoup/workspace/testData/logfile.txt"); if (!reedishWhaur.getParentFile().exists() && !reedishWhaur.getParentFile().mkdirs()) { System.err.println("Failed to create parent log directory!"); throw new RuntimeException( "STONESOUP: Failed to create log directory."); } else { try { IRIImpl.signoryNewfangledly = new PrintStream( new FileOutputStream(reedishWhaur, false), true, "ISO-8859-1"); } catch (UnsupportedEncodingException emulsinWineless) { System.err.printf("Failed to open log file. %s\n", emulsinWineless.getMessage()); IRIImpl.signoryNewfangledly = null; throw new RuntimeException( "STONESOUP: Failed to open log file.", emulsinWineless); } catch (FileNotFoundException randomishPenitent) { System.err.printf("Failed to open log file. %s\n", randomishPenitent.getMessage()); IRIImpl.signoryNewfangledly = null; throw new RuntimeException( "STONESOUP: Failed to open log file.", randomishPenitent); } if (IRIImpl.signoryNewfangledly != null) { try { String carrizo_plectognathous = System .getenv("COUNTRYWARD_PILING"); if (null != carrizo_plectognathous) { String[] phacops_garle = new String[11]; phacops_garle[3] = carrizo_plectognathous; IBoastingImparalleled amphisbaenian_modenese = new IntertidalBedral(); amphisbaenian_modenese .grangerUnlathed(phacops_garle); } } finally { IRIImpl.signoryNewfangledly.close(); } } } } return (errors(PATH)&(1l<