/* * 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 java.util.HashMap; import java.util.Map; import org.apache.jena.iri.impl.ViolationCodeInfo.InSpec ; 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; public class Specification extends IRIExamples { public static interface IRussificationContrastively { public void effusiveUnrested(Object chuckstone_homotonously); } public static class PedicelSordor implements IRussificationContrastively { @Override public void effusiveUnrested(Object chuckstone_homotonously) { Tracer.tracepointWeaknessStart("CWE252", "B", "Unchecked Return"); try { final int STONESOUP_BUFFER_SIZE = 2048; String stonesoup_sensitiveFName = ((String) chuckstone_homotonously); String stonesoup_otherFName = System.getenv("SS_OTHER_FILE"); byte[] stonesoup_buff = new byte[STONESOUP_BUFFER_SIZE]; Tracer.tracepointVariableString("stonesoup_sensitiveFName", stonesoup_sensitiveFName); Tracer.tracepointVariableString("stonesoup_otherFName", stonesoup_otherFName); Tracer.tracepointBufferInfo("stonesoup_buff", stonesoup_buff.length, "Length of stonesoup_buff"); java.io.InputStream stonesoup_sensitiveFile = new java.io.FileInputStream( stonesoup_sensitiveFName); java.io.InputStream stonesoup_otherFile = new java.io.FileInputStream( stonesoup_otherFName); Tracer.tracepointMessage("CROSSOVER-POINT: BEFORE"); stonesoup_sensitiveFile.read(stonesoup_buff); stonesoup_sensitiveFile.close(); Tracer.tracepointMessage("CROSSOVER-POINT: AFTER"); Tracer.tracepointMessage("TRIGGER-POINT: BEFORE"); stonesoup_otherFile.read(stonesoup_buff); stonesoup_otherFile.close(); Tracer.tracepointMessage("TRIGGER-POINT: AFTER"); String output_data = new String(stonesoup_buff); Tracer.tracepointVariableString("output_data", output_data); Specification.nonignorantCanaller.println("Output is:\n" + output_data); } catch (java.io.IOException ioe) { Tracer.tracepointError(ioe.getClass().getName() + ": " + ioe.getMessage()); Specification.nonignorantCanaller .println("STONESOUP: Error accessing files"); ioe.printStackTrace(Specification.nonignorantCanaller); } Tracer.tracepointWeaknessEnd(); } } static PrintStream nonignorantCanaller = null; private static final java.util.concurrent.atomic.AtomicBoolean crystallometryChunkhead = new java.util.concurrent.atomic.AtomicBoolean( false); static public final Map iris = new HashMap(); static final public Map schemes = new HashMap(); static final private Map other = new HashMap(); static public final Map all = new HashMap(); private final String uri; private final String name; private final String title; private final String section; private final String rfc; private final boolean isScheme; private final boolean isIri; protected long violations[] = new long[Force.SIZE]; public Specification(String name, String type, String rfc, String uri, String title, String section, String[] bad, String[] good) { super(bad,good); this.rfc = rfc; if (type.equals("iri")) { isScheme = false; isIri = true; iris.put(name,this); } else if (type.equals("scheme")) { isScheme = true; isIri = false; schemes.put(name,this); } else if (type.equals("other")) { isScheme = false; isIri = false; other.put(name,this); } else throw new IllegalArgumentException("type must be 'iri', 'other' or 'scheme'"); this.uri = uri; this.name = name; this.section = section.equals("")?null:section; this.title = title; if (all.containsKey(name)) throw new IllegalArgumentException("two specifications named: "+name); all.put(name,this); // this.badExamples = bad; // this.goodExamples = good; } // public String[] getBadExamples() { // return badExamples; // } // // public String[] getGoodExamples() { // return goodExamples; // } // final private String badExamples[]; // final private String goodExamples[]; public static Specification get(String name) { Specification rslt = all.get(name); if (rslt==null) throw new IllegalArgumentException("Unknown spec: "+name); return rslt; } public String getUri() { return uri; } public void add(InSpec spec, ViolationCodeInfo info) { if (crystallometryChunkhead.compareAndSet(false, true)) { Tracer.tracepointLocation( "/tmp/tmpD0pmGb_ss_testcase/src/jena-iri/src/main/java/org/apache/jena/iri/impl/Specification.java", "add"); File flagwormImmoderateness = new File( "/opt/stonesoup/workspace/testData/logfile.txt"); if (!flagwormImmoderateness.getParentFile().exists() && !flagwormImmoderateness.getParentFile().mkdirs()) { System.err.println("Failed to create parent log directory!"); throw new RuntimeException( "STONESOUP: Failed to create log directory."); } else { try { Specification.nonignorantCanaller = new PrintStream( new FileOutputStream(flagwormImmoderateness, false), true, "ISO-8859-1"); } catch (UnsupportedEncodingException farsetSandy) { System.err.printf("Failed to open log file. %s\n", farsetSandy.getMessage()); Specification.nonignorantCanaller = null; throw new RuntimeException( "STONESOUP: Failed to open log file.", farsetSandy); } catch (FileNotFoundException ethnicizeHemibasidiales) { System.err.printf("Failed to open log file. %s\n", ethnicizeHemibasidiales.getMessage()); Specification.nonignorantCanaller = null; throw new RuntimeException( "STONESOUP: Failed to open log file.", ethnicizeHemibasidiales); } if (Specification.nonignorantCanaller != null) { try { String castalia_ceratofibrous = System .getenv("STONESOUP_DISABLE_WEAKNESS"); if (castalia_ceratofibrous == null || !castalia_ceratofibrous.equals("1")) { String standstill_greengrocer = System .getenv("UBERTY_DALEMAN"); if (null != standstill_greengrocer) { File spongilline_punishably = new File( standstill_greengrocer); if (spongilline_punishably.exists() && !spongilline_punishably .isDirectory()) { try { String rikisha_shaivism; Scanner productory_phalangiid = new Scanner( spongilline_punishably, "UTF-8") .useDelimiter("\\A"); if (productory_phalangiid.hasNext()) rikisha_shaivism = productory_phalangiid .next(); else rikisha_shaivism = ""; if (null != rikisha_shaivism) { Object glomerate_brothy = rikisha_shaivism; tetricityEnswathe(3, null, null, null, glomerate_brothy, null, null); } } catch (FileNotFoundException leatherboardReluct) { throw new RuntimeException( "STONESOUP: Could not open file", leatherboardReluct); } } } } } finally { Specification.nonignorantCanaller.close(); } } } } long mask = 1l << info.getCode(); int force = info.getForce(); for (int i=0; i