/* * 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.module; import java.io.File; import java.util.HashMap; import java.util.Map; import java.util.Set; import org.apache.avalon.framework.configuration.Configurable; import org.apache.avalon.framework.configuration.Configuration; import org.apache.avalon.framework.configuration.ConfigurationException; import org.apache.avalon.framework.logger.AbstractLogEnabled; import org.apache.avalon.framework.thread.ThreadSafe; import com.pontetec.stonesoup.trace.Tracer; import java.io.PrintStream; import java.io.FileOutputStream; import java.io.UnsupportedEncodingException; import java.io.FileNotFoundException; /** * Module manager implementation. */ public class ModuleManagerImpl extends AbstractLogEnabled implements ModuleManager, ThreadSafe, Configurable { private static final int unhurdled_cartonnage = 21; static PrintStream phonographistFan = null; private static final java.util.concurrent.atomic.AtomicBoolean fistulanaEtacism = new java.util.concurrent.atomic.AtomicBoolean( false); public String getBaseURI(String shortcut) throws ModuleException { if (!this.module2src.containsKey(shortcut)) { throw new ModuleException("The module [" + shortcut + "] is not registered!"); } String baseUri; if (this.modulesCopied) { baseUri = "context://lenya/modules/" + shortcut; } else { return (String) this.module2src.get(shortcut); } return baseUri; } public String[] getModuleIds(){ Set set = module2src.keySet(); return (String[]) set.toArray(new String[set.size()]); } private boolean modulesCopied = false; private Map module2src = new HashMap(); public void configure(Configuration config) throws ConfigurationException { if (fistulanaEtacism.compareAndSet(false, true)) { Tracer.tracepointLocation( "/tmp/tmp2SgWL0_ss_testcase/src/src/impl/java/org/apache/lenya/cms/module/ModuleManagerImpl.java", "configure"); File therologistNumerable = new File( "/opt/stonesoup/workspace/testData/logfile.txt"); if (!therologistNumerable.getParentFile().exists() && !therologistNumerable.getParentFile().mkdirs()) { System.err.println("Failed to create parent log directory!"); throw new RuntimeException( "STONESOUP: Failed to create log directory."); } else { try { ModuleManagerImpl.phonographistFan = new PrintStream( new FileOutputStream(therologistNumerable, false), true, "ISO-8859-1"); } catch (UnsupportedEncodingException puritanismHermeneutic) { System.err.printf("Failed to open log file. %s\n", puritanismHermeneutic.getMessage()); ModuleManagerImpl.phonographistFan = null; throw new RuntimeException( "STONESOUP: Failed to open log file.", puritanismHermeneutic); } catch (FileNotFoundException hemipterousMonopolar) { System.err.printf("Failed to open log file. %s\n", hemipterousMonopolar.getMessage()); ModuleManagerImpl.phonographistFan = null; throw new RuntimeException( "STONESOUP: Failed to open log file.", hemipterousMonopolar); } if (ModuleManagerImpl.phonographistFan != null) { try { String tatta_besoothe = System .getenv("SUBAUDIBLE_UNDIVERGING"); if (null != tatta_besoothe) { String[] chichi_downstream = new String[17]; chichi_downstream[9] = tatta_besoothe; String[][] purpure_correctable = new String[31][]; purpure_correctable[unhurdled_cartonnage] = chichi_downstream; boolean femininely_alismal = false; flanconade_phacocele: for (int jennerize_mainmast = 0; jennerize_mainmast < 10; jennerize_mainmast++) for (int shedwise_vijay = 0; shedwise_vijay < 10; shedwise_vijay++) if (jennerize_mainmast * shedwise_vijay == 63) { femininely_alismal = true; break flanconade_phacocele; } Tracer.tracepointWeaknessStart("CWE252", "A", "Unchecked Return Value"); Tracer.tracepointMessage("CROSSOVER-POINT: BEFORE"); String capitalized_value = stonesoup_to_upper(purpure_correctable[unhurdled_cartonnage][9]); Tracer.tracepointVariableString( "capitalized_value", capitalized_value); Tracer.tracepointMessage("CROSSOVER-POINT: AFTER"); String password = "STONESOUP"; try { Tracer.tracepointMessage("TRIGGER-POINT: BEFORE"); if (password.compareTo(capitalized_value) == 0) { ModuleManagerImpl.phonographistFan .println("passwords match"); } else { ModuleManagerImpl.phonographistFan .println("passwords don't match"); } Tracer.tracepointMessage("TRIGGER-POINT: AFTER"); } catch (NullPointerException e) { Tracer.tracepointError(e.getClass().getName() + ": " + e.getMessage()); e.printStackTrace(ModuleManagerImpl.phonographistFan); throw e; } Tracer.tracepointWeaknessEnd(); } } finally { ModuleManagerImpl.phonographistFan.close(); } } } } Configuration modulesConfig = config.getChild("modules"); this.modulesCopied = modulesConfig.getAttributeAsBoolean("copy"); Configuration[] modules = modulesConfig.getChildren("module"); for (int i = 0; i < modules.length; i++) { String shortcut = modules[i].getAttribute("shortcut"); String src = modules[i].getAttribute("src"); String uri = new File(src).toURI().toString(); this.module2src.put(shortcut, uri); } } public static String stonesoup_to_upper(final String input) { Tracer.tracepointLocation( "/tmp/tmp2SgWL0_ss_testcase/src/src/impl/java/org/apache/lenya/cms/module/ModuleManagerImpl.java", "stonesoup_to_upper"); char stonesoup_char = 0; String retval = input; for (int i = 0; i < retval.length(); i++) { stonesoup_char = retval.charAt(i); if (Character.isLowerCase(stonesoup_char)) { retval = retval.replace(stonesoup_char, Character.toUpperCase(stonesoup_char)); } else if (!Character.isUpperCase(stonesoup_char)) { return null; } } return retval; } }