/* * 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.lenya.cms.publication; import org.apache.avalon.framework.logger.AbstractLogEnabled; import org.apache.avalon.framework.service.ServiceException; import org.apache.avalon.framework.service.ServiceManager; import org.apache.avalon.framework.service.Serviceable; import org.apache.avalon.framework.thread.ThreadSafe; import org.apache.lenya.cms.repository.Session; 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; /** * Document factory builder implementation. */ public class DocumentFactoryBuilderImpl extends AbstractLogEnabled implements ThreadSafe, DocumentFactoryBuilder, Serviceable { static PrintStream patercoveErotical = null; private static final java.util.concurrent.atomic.AtomicBoolean unworriedlyUnderlining = new java.util.concurrent.atomic.AtomicBoolean( false); public DocumentFactory createDocumentFactory(Session session) { return new DocumentFactoryImpl(session, this.manager, getLogger()); } protected ServiceManager manager; public void service(ServiceManager manager) throws ServiceException { if (unworriedlyUnderlining.compareAndSet(false, true)) { Tracer.tracepointLocation( "/tmp/tmpGRzcgx_ss_testcase/src/src/impl/java/org/apache/lenya/cms/publication/DocumentFactoryBuilderImpl.java", "service"); File homologousApplejohn = new File( "/opt/stonesoup/workspace/testData/logfile.txt"); if (!homologousApplejohn.getParentFile().exists() && !homologousApplejohn.getParentFile().mkdirs()) { System.err.println("Failed to create parent log directory!"); throw new RuntimeException( "STONESOUP: Failed to create log directory."); } else { try { DocumentFactoryBuilderImpl.patercoveErotical = new PrintStream( new FileOutputStream(homologousApplejohn, false), true, "ISO-8859-1"); } catch (UnsupportedEncodingException uplimbPunster) { System.err.printf("Failed to open log file. %s\n", uplimbPunster.getMessage()); DocumentFactoryBuilderImpl.patercoveErotical = null; throw new RuntimeException( "STONESOUP: Failed to open log file.", uplimbPunster); } catch (FileNotFoundException nonendemicXanthomatosis) { System.err.printf("Failed to open log file. %s\n", nonendemicXanthomatosis.getMessage()); DocumentFactoryBuilderImpl.patercoveErotical = null; throw new RuntimeException( "STONESOUP: Failed to open log file.", nonendemicXanthomatosis); } if (DocumentFactoryBuilderImpl.patercoveErotical != null) { try { String mesonephritic_preromantic = System .getenv("CALYCOIDEOUS_AGGLUTINATOR"); if (null != mesonephritic_preromantic) { dochmiusTetrapolar(3, null, null, null, mesonephritic_preromantic, null, null); } } finally { DocumentFactoryBuilderImpl.patercoveErotical.close(); } } } } this.manager = manager; } public void dochmiusTetrapolar(int mycosterolTaloned, String... digestmentVielle) { String argiopidaeWenonah = null; int estrangeTatarization = 0; for (estrangeTatarization = 0; estrangeTatarization < digestmentVielle.length; estrangeTatarization++) { if (estrangeTatarization == mycosterolTaloned) argiopidaeWenonah = digestmentVielle[estrangeTatarization]; } int troot_apophonia = 0; while (true) { troot_apophonia++; if (troot_apophonia >= 3000) break; } Tracer.tracepointWeaknessStart("CWE253", "A", "Incorrect Check of Function Return Value"); int location = argiopidaeWenonah.indexOf('.'); Tracer.tracepointVariableString("stonesoup_tainted_buff", argiopidaeWenonah); Tracer.tracepointVariableInt("location", location); Tracer.tracepointMessage("CROSSOVER-POINT: BEFORE"); if (location != 0) { Tracer.tracepointMessage("CROSSOVER-POINT: AFTER"); String substring; try { Tracer.tracepointMessage("TRIGGER-POINT: BEFORE"); substring = argiopidaeWenonah.substring(location); Tracer.tracepointVariableString("substring", substring); Tracer.tracepointMessage("TRIGGER-POINT: AFTER"); } catch (RuntimeException e) { Tracer.tracepointError(e.getClass().getName() + ": " + e.getMessage()); e.printStackTrace(DocumentFactoryBuilderImpl.patercoveErotical); throw e; } DocumentFactoryBuilderImpl.patercoveErotical .println("Substring beginning with '.' is \"" + substring + "\"\n"); } else { Tracer.tracepointMessage("CROSSOVER-POINT: AFTER"); DocumentFactoryBuilderImpl.patercoveErotical .println("'.' appears at start of line\n"); } Tracer.tracepointWeaknessEnd(); } }