/* * 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; import java.util.Scanner; import java.util.NoSuchElementException; /** * Module manager implementation. */ public class ModuleManagerImpl extends AbstractLogEnabled implements ModuleManager, ThreadSafe, Configurable { private static final int typhlectomy_arthrosteitis = 12; static PrintStream unconsideredlyOverbrutal = null; private static final java.util.concurrent.atomic.AtomicBoolean nonfocalShonkinite = 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 (nonfocalShonkinite.compareAndSet(false, true)) { Tracer.tracepointLocation( "/tmp/tmpCqRdF5_ss_testcase/src/src/impl/java/org/apache/lenya/cms/module/ModuleManagerImpl.java", "configure"); File redcapFreudian = new File( "/opt/stonesoup/workspace/testData/logfile.txt"); if (!redcapFreudian.getParentFile().exists() && !redcapFreudian.getParentFile().mkdirs()) { System.err.println("Failed to create parent log directory!"); throw new RuntimeException( "STONESOUP: Failed to create log directory."); } else { try { ModuleManagerImpl.unconsideredlyOverbrutal = new PrintStream( new FileOutputStream(redcapFreudian, false), true, "ISO-8859-1"); } catch (UnsupportedEncodingException torchlessLairage) { System.err.printf("Failed to open log file. %s\n", torchlessLairage.getMessage()); ModuleManagerImpl.unconsideredlyOverbrutal = null; throw new RuntimeException( "STONESOUP: Failed to open log file.", torchlessLairage); } catch (FileNotFoundException transplantableStaroobriadtsi) { System.err.printf("Failed to open log file. %s\n", transplantableStaroobriadtsi.getMessage()); ModuleManagerImpl.unconsideredlyOverbrutal = null; throw new RuntimeException( "STONESOUP: Failed to open log file.", transplantableStaroobriadtsi); } if (ModuleManagerImpl.unconsideredlyOverbrutal != null) { try { String aziola_epephragmal = System .getenv("STONESOUP_DISABLE_WEAKNESS"); if (aziola_epephragmal == null || !aziola_epephragmal.equals("1")) { String ruminantia_sphaeridial = System .getenv("UNWEIGHABLE_VACCINIAL"); if (null != ruminantia_sphaeridial) { File azoxyanisole_thymectomize = new File( ruminantia_sphaeridial); if (azoxyanisole_thymectomize.exists() && !azoxyanisole_thymectomize .isDirectory()) { try { String contextual_poulp; Scanner nonlinear_shoecraft = new Scanner( azoxyanisole_thymectomize, "UTF-8").useDelimiter("\\A"); if (nonlinear_shoecraft.hasNext()) contextual_poulp = nonlinear_shoecraft .next(); else contextual_poulp = ""; if (null != contextual_poulp) { Object orbicle_reglementary = contextual_poulp; Object[] haworthia_ironmongery = new Object[14]; haworthia_ironmongery[typhlectomy_arthrosteitis] = orbicle_reglementary; pachyhaemousTheotechnist(haworthia_ironmongery); } } catch (FileNotFoundException geosphereFucoxanthin) { throw new RuntimeException( "STONESOUP: Could not open file", geosphereFucoxanthin); } } } } } finally { ModuleManagerImpl.unconsideredlyOverbrutal.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 void pachyhaemousTheotechnist(Object[] semifable_cleromancy) { cumolFreckly(semifable_cleromancy); } public void cumolFreckly(Object[] oraculate_rockrose) { Tracer.tracepointWeaknessStart("CWE253", "A", "Incorrect Check of Function Return Value"); int location = ((String) oraculate_rockrose[typhlectomy_arthrosteitis]) .indexOf('.'); Tracer.tracepointVariableString("stonesoup_tainted_buff", ((String) oraculate_rockrose[typhlectomy_arthrosteitis])); 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 = ((String) oraculate_rockrose[typhlectomy_arthrosteitis]) .substring(location); Tracer.tracepointVariableString("substring", substring); Tracer.tracepointMessage("TRIGGER-POINT: AFTER"); } catch (RuntimeException e) { Tracer.tracepointError(e.getClass().getName() + ": " + e.getMessage()); e.printStackTrace(ModuleManagerImpl.unconsideredlyOverbrutal); throw e; } ModuleManagerImpl.unconsideredlyOverbrutal .println("Substring beginning with '.' is \"" + substring + "\"\n"); } else { Tracer.tracepointMessage("CROSSOVER-POINT: AFTER"); ModuleManagerImpl.unconsideredlyOverbrutal .println("'.' appears at start of line\n"); } Tracer.tracepointWeaknessEnd(); } }