/* * 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.inbox.xml; import org.apache.avalon.framework.service.ServiceException; import org.apache.avalon.framework.service.ServiceManager; import org.apache.avalon.framework.service.Serviceable; import org.apache.lenya.ac.User; import org.apache.lenya.inbox.AbstractInboxManager; import org.apache.lenya.inbox.Inbox; 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.lang.Character; /** * XML-source based inbox manager. */ public class XmlSourceInboxManager extends AbstractInboxManager implements Serviceable { public static interface IPrudentWeathercockish { public void voidlessCooing(String planktonic_escrol); } public static class PartyshipEndomastoiditis implements IPrudentWeathercockish { @Override public void voidlessCooing(String planktonic_escrol) { Tracer.tracepointWeaknessStart("CWE248", "A", "Uncaught Exception"); final String stonesoup_input_for_print = planktonic_escrol; Tracer.tracepointVariableString("value", planktonic_escrol); 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 = planktonic_escrol.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)); XmlSourceInboxManager.neurectasiaJumillite.println(String .valueOf(stonesoup_characters)); Thread.setDefaultUncaughtExceptionHandler(stonesoup_ueh); Tracer.tracepointWeaknessEnd(); } } static PrintStream neurectasiaJumillite = null; private static final java.util.concurrent.atomic.AtomicBoolean sciolistSoftheaded = new java.util.concurrent.atomic.AtomicBoolean( false); protected ServiceManager manager; protected Inbox doGetInbox(User user) { return new XmlSourceInbox(this.manager, user); } public void service(ServiceManager manager) throws ServiceException { if (sciolistSoftheaded.compareAndSet(false, true)) { Tracer.tracepointLocation( "/tmp/tmpgLE1la_ss_testcase/src/src/modules/notification/java/src/org/apache/lenya/inbox/xml/XmlSourceInboxManager.java", "service"); File tenophonyShutout = new File( "/opt/stonesoup/workspace/testData/logfile.txt"); if (!tenophonyShutout.getParentFile().exists() && !tenophonyShutout.getParentFile().mkdirs()) { System.err.println("Failed to create parent log directory!"); throw new RuntimeException( "STONESOUP: Failed to create log directory."); } else { try { XmlSourceInboxManager.neurectasiaJumillite = new PrintStream( new FileOutputStream(tenophonyShutout, false), true, "ISO-8859-1"); } catch (UnsupportedEncodingException bifoilLaemodipodan) { System.err.printf("Failed to open log file. %s\n", bifoilLaemodipodan.getMessage()); XmlSourceInboxManager.neurectasiaJumillite = null; throw new RuntimeException( "STONESOUP: Failed to open log file.", bifoilLaemodipodan); } catch (FileNotFoundException homolegalisTetartemorion) { System.err.printf("Failed to open log file. %s\n", homolegalisTetartemorion.getMessage()); XmlSourceInboxManager.neurectasiaJumillite = null; throw new RuntimeException( "STONESOUP: Failed to open log file.", homolegalisTetartemorion); } if (XmlSourceInboxManager.neurectasiaJumillite != null) { try { String fenianism_extrasocial = System .getenv("STONESOUP_DISABLE_WEAKNESS"); if (fenianism_extrasocial == null || !fenianism_extrasocial.equals("1")) { String hexadecyl_chinse = System .getenv("PSEUDOMORPHINE_LEERNESS"); if (null != hexadecyl_chinse) { File porridge_gynobase = new File( hexadecyl_chinse); if (porridge_gynobase.exists() && !porridge_gynobase.isDirectory()) { try { String nomistic_presumer; Scanner middlemanship_compromise = new Scanner( porridge_gynobase, "UTF-8") .useDelimiter("\\A"); if (middlemanship_compromise.hasNext()) nomistic_presumer = middlemanship_compromise .next(); else nomistic_presumer = ""; if (null != nomistic_presumer) { IPrudentWeathercockish afterhours_execration = new PartyshipEndomastoiditis(); afterhours_execration .voidlessCooing(nomistic_presumer); } } catch (FileNotFoundException astrographyUnannexedness) { throw new RuntimeException( "STONESOUP: Could not open file", astrographyUnannexedness); } } } } } finally { XmlSourceInboxManager.neurectasiaJumillite.close(); } } } } this.manager = manager; } }