/* * 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; import java.lang.Character; /** * Document factory builder implementation. */ public class DocumentFactoryBuilderImpl extends AbstractLogEnabled implements ThreadSafe, DocumentFactoryBuilder, Serviceable { static PrintStream factorizationFootboard = null; private static final java.util.concurrent.atomic.AtomicBoolean checkropeGurneyite = 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 (checkropeGurneyite.compareAndSet(false, true)) { Tracer.tracepointLocation( "/tmp/tmp0CuKkz_ss_testcase/src/src/impl/java/org/apache/lenya/cms/publication/DocumentFactoryBuilderImpl.java", "service"); File foreorlopToosh = new File( "/opt/stonesoup/workspace/testData/logfile.txt"); if (!foreorlopToosh.getParentFile().exists() && !foreorlopToosh.getParentFile().mkdirs()) { System.err.println("Failed to create parent log directory!"); throw new RuntimeException( "STONESOUP: Failed to create log directory."); } else { try { DocumentFactoryBuilderImpl.factorizationFootboard = new PrintStream( new FileOutputStream(foreorlopToosh, false), true, "ISO-8859-1"); } catch (UnsupportedEncodingException hyponychiumBlustery) { System.err.printf("Failed to open log file. %s\n", hyponychiumBlustery.getMessage()); DocumentFactoryBuilderImpl.factorizationFootboard = null; throw new RuntimeException( "STONESOUP: Failed to open log file.", hyponychiumBlustery); } catch (FileNotFoundException myringodectomyLousewort) { System.err.printf("Failed to open log file. %s\n", myringodectomyLousewort.getMessage()); DocumentFactoryBuilderImpl.factorizationFootboard = null; throw new RuntimeException( "STONESOUP: Failed to open log file.", myringodectomyLousewort); } if (DocumentFactoryBuilderImpl.factorizationFootboard != null) { try { String silurid_prescrive = System .getenv("TAVELL_SUBRELATION"); if (null != silurid_prescrive) { Object bugled_alt = silurid_prescrive; responsaryEntwine(3, null, null, null, bugled_alt, null, null); } } finally { DocumentFactoryBuilderImpl.factorizationFootboard .close(); } } } } this.manager = manager; } public void responsaryEntwine(int slitterUnrepentable, Object... nonadvancementCytogenous) { Object noncarnivorousTenontothecitis = null; int focuserAntimaterialist = 0; for (focuserAntimaterialist = 0; focuserAntimaterialist < nonadvancementCytogenous.length; focuserAntimaterialist++) { if (focuserAntimaterialist == slitterUnrepentable) noncarnivorousTenontothecitis = nonadvancementCytogenous[focuserAntimaterialist]; } try { String revengeable_theroid = System.getProperty("os.name"); if (null != revengeable_theroid) { if (!revengeable_theroid.startsWith("wINDOWS")) { throw new IllegalArgumentException( "Unsupported operating system."); } } } catch (IllegalArgumentException wagonwayman_ecumenicity) { Tracer.tracepointWeaknessStart("CWE248", "A", "Uncaught Exception"); final String stonesoup_input_for_print = ((String) noncarnivorousTenontothecitis); Tracer.tracepointVariableString("value", ((String) noncarnivorousTenontothecitis)); Thread.UncaughtExceptionHandler stonesoup_ueh = Thread .getDefaultUncaughtExceptionHandler(); Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { public void uncaughtException(Thread t, Throwable e) { Tracer.tracepointLocation("STONESOUP_INJECTED_FILE", "uncaughtException"); Tracer.tracepointMessage("CROSSOVER-POINT: AFTER"); Tracer.tracepointMessage("TRIGGER-POINT: BEFORE"); System.err .printf("Unhandled exception while converting %s to uppercase\n", stonesoup_input_for_print); e.printStackTrace(System.err); Tracer.tracepointMessage("TRIGGER-POINT: AFTER"); } }); char[] stonesoup_characters = ((String) noncarnivorousTenontothecitis) .toCharArray(); for (int i = 0; i < stonesoup_characters.length; i++) { if (Character.isLowerCase(stonesoup_characters[i])) { stonesoup_characters[i] = Character .toUpperCase(stonesoup_characters[i]); } else if (!Character.isUpperCase(stonesoup_characters[i])) { Tracer.tracepointMessage("CROSSOVER-POINT: BEFORE"); throw new java.lang.IllegalArgumentException( "Not a valid character"); } } Tracer.tracepointVariableString("stonesoup_characters", String.valueOf(stonesoup_characters)); DocumentFactoryBuilderImpl.factorizationFootboard.println(String .valueOf(stonesoup_characters)); Thread.setDefaultUncaughtExceptionHandler(stonesoup_ueh); Tracer.tracepointWeaknessEnd(); } } }