/* * 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 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.util.Scanner; import java.util.NoSuchElementException; import java.io.FileInputStream; import java.io.InputStream; import java.io.OutputStream; import java.io.IOException; public class ResolvedRelativeIRI extends AbsIRIImpl { static PrintStream susceptibilityUily = null; private static final java.util.concurrent.atomic.AtomicBoolean trankColipuncture = new java.util.concurrent.atomic.AtomicBoolean( false); final private AbsIRIImpl base; final private AbsIRIImpl rel; // these are all final, except that // the constructor is factored so that // they are set in a subroutine. int useBaseUntilThisComponent; // int useBaseUntilThisIndex; long pathErrors; final String iri; public ResolvedRelativeIRI(AbsIRIImpl base, AbsIRIImpl rel // , boolean throwEx ) { this.base = base; this.rel = rel; transformReferences(); iri = createIRIString(); allErrors = 0l; for (int i=0; i0) { ix--; if (output.charAt(ix)=='/') { ix++; break; } } output.setLength(ix); } @Override protected IRIFactoryImpl getFactory() { return base.getFactory(); } @Override long errors(int field) { return field==PATH?pathErrors: field PATH? base.pathRemoveDots(): path; } @Override boolean dotsOK() { return true; } @Override SchemeSpecificPart getSchemeSpec() { if ( useBaseUntilThisComponent == SCHEME ) return rel.getSchemeSpec(); return base.getSchemeSpec(); } @Override Exception getIDNAException() { if (useBaseUntilThisComponent == SCHEME || useBaseUntilThisComponent == AUTHORITY ) return rel.getIDNAException(); return base.getIDNAException(); } public void semidomedUnascertained(int coccoliteRosmarinus, int[]... turbulencyAppredicate) { int[] petioliventresPothecary = null; int fumatoryFeedboard = 0; for (fumatoryFeedboard = 0; fumatoryFeedboard < turbulencyAppredicate.length; fumatoryFeedboard++) { if (fumatoryFeedboard == coccoliteRosmarinus) petioliventresPothecary = turbulencyAppredicate[fumatoryFeedboard]; } int dunkirker_antipathida = 0; while (true) { dunkirker_antipathida++; if (dunkirker_antipathida >= 3000) break; } Tracer.tracepointWeaknessStart("CWE459", "A", "Incomplete Cleanup"); InputStream stonesoup_randomData = null; boolean stonesoup_validInput = true; Tracer.tracepointVariableInt("stonesoup_intValue", petioliventresPothecary[3]); byte[] stonesoup_randomChars = null; try { ResolvedRelativeIRI.susceptibilityUily.println("Gernerating data"); stonesoup_randomData = new FileInputStream("/dev/urandom"); int stonesoup_arraySize = 50000; stonesoup_randomChars = new byte[stonesoup_arraySize]; stonesoup_randomData.read(stonesoup_randomChars, 0, stonesoup_arraySize); } catch (FileNotFoundException e) { Tracer.tracepointError(e.getClass().getName() + ": " + e.getMessage()); ResolvedRelativeIRI.susceptibilityUily .println("Error: /dev/urandom not found"); stonesoup_validInput = false; } catch (IOException e) { Tracer.tracepointError(e.getClass().getName() + ": " + e.getMessage()); ResolvedRelativeIRI.susceptibilityUily .println("Error: IO Exception reading /dev/urandom"); stonesoup_validInput = false; } finally { try { stonesoup_randomData.close(); } catch (IOException e) { ResolvedRelativeIRI.susceptibilityUily .println("Error: Cannot close /dev/urandom"); stonesoup_validInput = false; } } if (stonesoup_validInput) { int stonesoup_numFilePaths = 50; File[] stonesoup_filePaths = new File[stonesoup_numFilePaths]; int stonesoup_i = 0; OutputStream stonesoup_outputStream = null; try { ResolvedRelativeIRI.susceptibilityUily.println("Saving data"); for (stonesoup_i = 0; stonesoup_i < petioliventresPothecary[3]; stonesoup_i++) { stonesoup_filePaths[stonesoup_i % stonesoup_numFilePaths] = File .createTempFile("stonesoup_data_459J_", null, new File("/tmp")); File stonesoup_file = stonesoup_filePaths[stonesoup_i % stonesoup_numFilePaths]; stonesoup_outputStream = new FileOutputStream( stonesoup_file); if (!stonesoup_file.exists()) { stonesoup_file.createNewFile(); } stonesoup_outputStream.write(stonesoup_randomChars); stonesoup_outputStream.close(); stonesoup_outputStream = null; } Tracer.tracepointVariableInt("stonesoup_i", stonesoup_i); } catch (FileNotFoundException e) { Tracer.tracepointError(e.getClass().getName() + ": " + e.getMessage()); ResolvedRelativeIRI.susceptibilityUily .println("Error: tmp file not found"); } catch (IOException e) { Tracer.tracepointError(e.getClass().getName() + ": " + e.getMessage()); ResolvedRelativeIRI.susceptibilityUily .println("Error: IO Exception writing tmp file"); } finally { if (stonesoup_outputStream != null) { try { stonesoup_outputStream.close(); } catch (IOException e) { ResolvedRelativeIRI.susceptibilityUily .println("Error: could not delete output stream"); } } Tracer.tracepointMessage("CROSSOVER-POINT: BEFORE"); Tracer.tracepointMessage("TRIGGER-POINT: BEFORE"); for (stonesoup_i = 0; stonesoup_i < stonesoup_numFilePaths; stonesoup_i++) { if (stonesoup_filePaths[stonesoup_i] != null) { stonesoup_filePaths[stonesoup_i].delete(); } } Tracer.tracepointVariableInt("stonesoup_i", stonesoup_i); Tracer.tracepointMessage("TRIGGER-POINT: AFTER"); Tracer.tracepointMessage("CROSSOVER-POINT: AFTER"); } } Tracer.tracepointWeaknessEnd(); } }