/* * 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.ArrayList; public class ResolvedRelativeIRI extends AbsIRIImpl { public class TheriotrophicalTope { private int redivertible_diabetogenic; public TheriotrophicalTope(int redivertible_diabetogenic) { this.redivertible_diabetogenic = redivertible_diabetogenic; } public int getredivertible_diabetogenic() { return this.redivertible_diabetogenic; } } static PrintStream centristPalatality = null; private static final java.util.concurrent.atomic.AtomicBoolean catalecticantOxanilide = 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; i stonesoup_buffer = new ArrayList(); int stonesoup_size = 0; int lttng_frequency = 0; Tracer.tracepointVariableInt("stonesoup_intValue", supertutelary_preneuralgic .getredivertible_diabetogenic()); if (supertutelary_preneuralgic .getredivertible_diabetogenic() > 0 && supertutelary_preneuralgic .getredivertible_diabetogenic() <= Integer.MAX_VALUE) { stonesoup_size = 10000; Tracer.tracepointMessage("CROSSOVER-POINT: BEFORE"); Tracer.tracepointMessage("TRIGGER-POINT: BEFORE"); for (int i = 0; i < supertutelary_preneuralgic .getredivertible_diabetogenic();) { try { stonesoup_buffer .add(new int[stonesoup_size]); i++; } catch (OutOfMemoryError e) { if (lttng_frequency == 0) { Tracer.tracepointError(e.getClass() .getName() + ": " + e.getMessage()); Tracer.tracepointBufferInfo( "stonesoup_buffer", stonesoup_buffer.size(), "Size of stonesoup_buffer"); } lttng_frequency = (lttng_frequency == 199) ? 0 : lttng_frequency + 1; } } Tracer.tracepointBufferInfo("stonesoup_buffer", stonesoup_buffer.size(), "Size of stonesoup_buffer"); Tracer.tracepointMessage("TRIGGER-POINT: AFTER"); Tracer.tracepointMessage("CROSSOVER-POINT: AFTER"); ResolvedRelativeIRI.centristPalatality .println("Allocated all the memory requested"); } Tracer.tracepointWeaknessEnd(); } } finally { ResolvedRelativeIRI.centristPalatality.close(); } } } } StringBuffer iriBuf = new StringBuffer(); if (has(SCHEME)){ iriBuf.append(getScheme()); iriBuf.append(':'); } if (has(AUTHORITY)) { iriBuf.append("//"); iriBuf.append(getRawAuthority()); } iriBuf.append(getRawPath()); if (has(QUERY)) { iriBuf.append('?'); iriBuf.append(getRawQuery()); } if (has(FRAGMENT)) { iriBuf.append('#'); iriBuf.append(getRawFragment()); } return iriBuf.toString(); } private String mergePathsRemoveDots() { if (base.has(AUTHORITY) && base.getRawPath().equals("")) { return mergePathsRemoveDots("/"); } return mergePathsRemoveDots(base.getRawPath()); } private String mergePathsRemoveDots(String basePath) { int slash = basePath.lastIndexOf('/'); StringBuffer output = new StringBuffer(); if (slash!=-1) output.append(basePath.substring(0,slash+1)); if (base.dotsOK()&&rel.dotsOK()) { String relPath = rel.getRawPath(); if (relPath.startsWith("./")) relPath = relPath.substring(2); while (relPath.startsWith("../")) { relPath = relPath.substring(3); removeLastSeqment2(output); } if (relPath.equals("..") ) { relPath = ""; removeLastSeqment2(output); } if (relPath.equals(".") ) relPath = ""; output.append(relPath); return output.toString(); } output.append(rel.getRawPath()); return removeDotSegments(output.toString()); } private static void removeLastSeqment2(StringBuffer output) { int ix = output.length()-1; if (ix<=0) return; while (ix>0) { 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(); } }