private boolean controleUpload(IUploader uploader, final StringBuilder messageToReturn) { // controle String baseName = uploader.getBasename(); baseName = (baseName == null) ? null : baseName.trim().toLowerCase(); log.config("baseName: " + baseName); if (baseName == null || baseName.length() == 0 || !(baseName.endsWith(Constantes.EXTENSION_ZIP) || baseName.endsWith(Constantes.EXTENSION_JAR))) { log.severe("annulation du téléchargement!"); uploader.cancel(); messageToReturn.append( "Le fichier choisi n'existe pas ou bien n'est pas une archive zip ou jar!"); return false; } log.config("File url " + uploader.fileUrl()); // The server sends useful information to the client by default UploadedInfo info = uploader.getServerInfo(); if (info != null) { log.config("File name " + info.name); log.config("File content-type " + info.ctype); log.config("File size " + info.size); } return true; }
public String formatScreenShotPath() { if (!Configuration.screenshots) { log.config("Automatic screenshots are disabled."); return ""; } String screenshot = takeScreenShot(); if (screenshot == null) { return ""; } if (Configuration.reportsUrl != null) { String screenshotRelativePath = screenshot.substring(System.getProperty("user.dir").length() + 1); String screenshotUrl = Configuration.reportsUrl + screenshotRelativePath.replace('\\', '/'); try { screenshotUrl = new URL(screenshotUrl).toExternalForm(); } catch (MalformedURLException ignore) { } log.config( "Replaced screenshot file path '" + screenshot + "' by public CI URL '" + screenshotUrl + "'"); return screenshotUrl; } log.config("reportsUrl is not configured. Returning screenshot file name '" + screenshot + "'"); try { return new File(screenshot).toURI().toURL().toExternalForm(); } catch (MalformedURLException e) { return "file://" + screenshot; } }
public static void main(String[] args) { String inputFilename = ""; String version = ""; for (int i = 0; i < args.length; i++) { if (args[i].equals("-i")) { if (i == args.length - 1) { printUsage(); System.exit(3); } inputFilename = args[i + 1]; } if (args[i].equals("-v")) { if (i == args.length - 1) { printUsage(); System.exit(3); } version = args[i + 1]; } if (args[i].equals("-h")) { printUsage(); System.exit(0); } } LOGGER.setLevel(Level.CONFIG); LOGGER.setUseParentHandlers(false); ConsoleHandler logConsole = new ConsoleHandler(); logConsole.setLevel(Level.CONFIG); LOGGER.addHandler(logConsole); MyLogFormatter formatter = new MyLogFormatter(); logConsole.setFormatter(formatter); /* try { FileHandler logFile = new FileHandler("serverwiz2.%u.%g.log",20000,2,true); LOGGER.addHandler(logFile); logFile.setFormatter(formatter); logFile.setLevel(Level.CONFIG); } catch (IOException e) { System.err.println("Unable to create logfile"); System.exit(3); } */ LOGGER.config("======================================================================"); LOGGER.config("ServerWiz2 Starting..."); TargetWizardController tc = new TargetWizardController(); SystemModel systemModel = new SystemModel(); MainDialog view = new MainDialog(null); tc.setView(view); tc.setModel(systemModel); systemModel.addPropertyChangeListener(tc); view.setController(tc); if (!inputFilename.isEmpty()) { view.mrwFilename = inputFilename; } view.open(); // d.dispose(); }
private static String getJenkinsReportsUrl() { String build_url = System.getProperty("BUILD_URL"); if (!isEmpty(build_url)) { LOG.config("Using Jenkins BUILD_URL: " + build_url); return build_url + "artifact/"; } else { LOG.config("No BUILD_URL variable found. It's not Jenkins."); return null; } }
static String getReportsUrl() { String reportsUrl = System.getProperty("selenide.reportsUrl"); if (isEmpty(reportsUrl)) { reportsUrl = getJenkinsReportsUrl(); if (isEmpty(reportsUrl)) { LOG.config("Variable selenide.reportsUrl not found"); } } else { LOG.config("Using variable selenide.reportsUrl=" + reportsUrl); } return reportsUrl; }
@Override public void init(IBatchConfig batchConfig) throws BatchContainerServiceException { logger.config("Entering CLASSNAME.init(), batchConfig =" + batchConfig); this.batchConfig = batchConfig; schema = batchConfig.getDatabaseConfigurationBean().getSchema(); jndiName = batchConfig.getDatabaseConfigurationBean().getJndiName(); if (jndiName == null || jndiName.equals("")) { throw new BatchContainerServiceException("JNDI name is not defined."); } try { Context ctx = new InitialContext(); dataSource = (DataSource) ctx.lookup(jndiName); } catch (NamingException e) { logger.severe( "Lookup failed for JNDI name: " + jndiName + ". One cause of this could be that the batch runtime is incorrectly configured to EE mode when it should be in SE mode."); throw new BatchContainerServiceException(e); } // Load the table names and queries shared between different database // types tableNames = getSharedTableMap(batchConfig); try { queryStrings = getSharedQueryMap(batchConfig); } catch (SQLException e1) { // TODO Auto-generated catch block throw new BatchContainerServiceException(e1); } logger.config("JNDI name = " + jndiName); try { if (!isOracleSchemaValid()) { setDefaultSchema(); } checkOracleTables(); } catch (SQLException e) { logger.severe(e.getLocalizedMessage()); throw new BatchContainerServiceException(e); } logger.config("Exiting CLASSNAME.init()"); }
public static void tearDown(PVob pvob) throws CleartoolException { Set<UCMView> views = pvob.getViews(); /* The pvob needs to be loaded */ pvob.load(); logger.config("Removing views"); for (UCMView view : views) { logger.fine("Removing " + view); try { view.end(); view.remove(); } catch (ViewException e) { ExceptionUtils.log(e, true); } } Set<Vob> vobs = pvob.getVobs(); logger.config("Removing vobs"); for (Vob vob : vobs) { logger.fine("Removing " + vob); try { vob.unmount(); vob.remove(); } catch (CleartoolException e) { ExceptionUtils.log(e, true); } } logger.config("Removing pvob"); pvob.unmount(); pvob.remove(); /* For Jens' sake */ /* try { logger.debug( "Checking views: " + CommandLine.getInstance().run( "rgy_check -views" ).stdoutBuffer ); } catch( Exception e ) { // Because rgy_check returns 1 if anything stranded e.printStackTrace(); } */ /* try { logger.debug( "Checking vobs: " + CommandLine.getInstance().run( "rgy_check -vobs" ).stdoutBuffer ); } catch( Exception e ) { e.printStackTrace(); } */ }
/** * Writes the log message with the given level. If the debug is disabled then returns immediately. * * @param level The level of the log to use. * @param message The message of the log to write. */ public void log(int level, String message) { if (!debug) { return; } switch (level) { default: case Debug.FINEST: logger.finest(message); break; case Debug.FINER: logger.finer(message); break; case Debug.FINE: logger.fine(message); break; case Debug.CONFIG: logger.config(message); break; case Debug.INFO: logger.info(message); break; case Debug.WARNING: logger.warning(message); break; case Debug.SEVERE: logger.severe(message); break; } }
public static SysConfig getInstance() { if (instance == null) { log.config(LogBuilder.createSystemMessage().addAction("create generic SysConfig").toString()); setInstance(new SysConfig("")); } return instance; }
/** * Returns the startup run objects for app startup only (not useful for script writers). * * @param args the first loaded ship for the client */ public static void startup(String[] args) { final RenderFrame f = new RenderFrame(args); f.setVisible(true); try { /*Chenage the commented line to change the default loaded blueprint*/ /*method updated as of SMEdit v1.06*/ final ShipSpec spec = ShipTreeLogic.getBlueprintSpec("Omen-Navy-Class", true); // final ShipSpec spec = ShipTreeLogic.getBlueprintSpec("Isanth-VI", true); if (spec != null) { IRunnableWithProgress t = new IRunnableWithProgress() { @Override public void run(IPluginCallback cb) { StarMadeLogic.getInstance().setCurrentModel(spec); StarMadeLogic.setModel(ShipTreeLogic.loadShip(spec, cb)); } }; log.log(Level.INFO, "Loading Ship!"); RunnableLogic.run(f, "Loading...", t); } else { log.log(Level.WARNING, "Could not find the ship your asking to load!"); } } catch (Exception e) { log.log(Level.WARNING, "Ship load failed!", e); } log.config("Main application started: " + GlobalConfiguration.NAME); }
/** * @param config * @param properties */ public ConnectionURLBuilder(Config config, Properties properties) { List<String> opts = new ArrayList<String>(); for (String key : config.getDbSpecificOptions().keySet()) { opts.add((key.startsWith("-") ? "" : "-") + key); opts.add(config.getDbSpecificOptions().get(key)); } opts.addAll(config.getRemainingParameters()); DbSpecificConfig dbConfig = new DbSpecificConfig(config.getDbType()); options = dbConfig.getOptions(); connectionURL = buildUrl(opts, properties, config); List<String> remaining = config.getRemainingParameters(); for (DbSpecificOption option : options) { int idx = remaining.indexOf("-" + option.getName()); if (idx >= 0) { remaining.remove(idx); // -paramKey remaining.remove(idx); // paramValue } } logger.config("connectionURL: " + connectionURL); }
/** Private helper that handles the combiningAlgFactory elements. */ private CombiningAlgFactory parseCombiningAlgFactory(Node root) throws ParsingException { CombiningAlgFactory factory = null; // check if we're starting with the standard factory setup if (useStandard(root, "useStandardAlgorithms")) { logger.config("Starting with standard Combining Algorithms"); factory = StandardCombiningAlgFactory.getNewFactory(); } else { factory = new BaseCombiningAlgFactory(); } // now look for all algorithms specified for this factory, adding // them as we go NodeList children = root.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); if (child.getNodeName().equals("algorithm")) { // an algorithm is a simple class element CombiningAlgorithm alg = (CombiningAlgorithm) (loadClass("algorithm", child)); try { factory.addAlgorithm(alg); } catch (IllegalArgumentException iae) { throw new ParsingException( "duplicate combining " + "algorithm: " + alg.getIdentifier().toString(), iae); } } } return factory; }
public static void main(String[] args) throws Exception { LogManager lm = LogManager.getLogManager(); FileInputStream fi = new FileInputStream( new File("D:/eclipse/workspace/JxvaTest/src/com/jxva/demo/logging.properties")); lm.readConfiguration(fi); Logger log = Logger.getLogger("loggingTest"); lm.addLogger(log); // log.setLevel(Level.INFO); // ConsoleHandler consoleHandler = new ConsoleHandler(); // log.addHandler(consoleHandler); // FileHandler myFileHandler = new FileHandler("SimpleLogger.log",50000,1,true); // myFileHandler.setEncoding("UTF-8"); // myFileHandler.setFormatter(new SimpleFormatter()); // log.addHandler(myFileHandler); log.severe("严重dddd的信dddd息"); log.warning("警dd告信息"); log.info("一般信息"); log.config("设定方面的信息"); log.fine("细微的信息"); log.finer("更细微的信息"); log.finest("最细微的信息"); }
/** Private helper that handles the attributeFactory elements. */ private AttributeFactory parseAttributeFactory(Node root) throws ParsingException { AttributeFactory factory = null; // check if we're starting with the standard factory setup if (useStandard(root, "useStandardDatatypes")) { logger.config("Starting with standard Datatypes"); factory = StandardAttributeFactory.getNewFactory(); } else { factory = new BaseAttributeFactory(); } // now look for all datatypes specified for this factory, adding // them as we go NodeList children = root.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); if (child.getNodeName().equals("datatype")) { // a datatype is a class with an identifier String identifier = child.getAttributes().getNamedItem("identifier").getNodeValue(); AttributeProxy proxy = (AttributeProxy) (loadClass("datatype", child)); try { factory.addDatatype(identifier, proxy); } catch (IllegalArgumentException iae) { throw new ParsingException("duplicate datatype: " + identifier, iae); } } } return factory; }
/** * Constructs a new reliability layer. Changes to the configuration are observed and automatically * applied. * * @param config the configuration */ public ReliabilityLayer(NetworkConfig config) { ack_timeout = config.getInt(NetworkConfig.Keys.ACK_TIMEOUT); ack_random_factor = config.getFloat(NetworkConfig.Keys.ACK_RANDOM_FACTOR); ack_timeout_scale = config.getFloat(NetworkConfig.Keys.ACK_TIMEOUT_SCALE); max_retransmit = config.getInt(NetworkConfig.Keys.MAX_RETRANSMIT); LOGGER.config( "ReliabilityLayer uses ACK_TIMEOUT: " + ack_timeout + ", ACK_RANDOM_FACTOR: " + ack_random_factor + ", and ACK_TIMEOUT_SCALE: " + ack_timeout_scale); config.addConfigObserver( new NetworkConfigObserverAdapter() { @Override public void changed(String key, int value) { if (NetworkConfig.Keys.ACK_TIMEOUT.equals(key)) ack_timeout = value; if (NetworkConfig.Keys.MAX_RETRANSMIT.equals(key)) max_retransmit = value; } @Override public void changed(String key, float value) { if (NetworkConfig.Keys.ACK_RANDOM_FACTOR.equals(key)) ack_random_factor = value; if (NetworkConfig.Keys.ACK_TIMEOUT_SCALE.equals(key)) ack_timeout_scale = value; } }); }
/** * Loads an image from a given URL into a BufferedImage. The image is returned in the format * defined by the imageType parameter. Note that this is special cased for JPEG images where * loading is performed outside the standard media tracker, for efficiency reasons. * * @param url URL where the image file is located. * @param imageType one of the image type defined in the BufferedImage class. * @return loaded image at path or url * @see java.awt.image.BufferedImage */ public static synchronized BufferedImage loadBufferedImage(URL url, int imageType) { BufferedImage image = null; // Special handling for JPEG images to avoid extra processing if possible. if (url == null || !url.toString().toLowerCase().endsWith(".jpg")) { Image tmpImage = loadImage(url); if (tmpImage != null) { image = new BufferedImage(tmpImage.getWidth(null), tmpImage.getHeight(null), imageType); Graphics2D g = image.createGraphics(); g.drawImage(tmpImage, 0, 0, null); g.dispose(); } } else { BufferedImage tmpImage = loadBufferedJPEGImage(url); if (tmpImage != null) { if (tmpImage.getType() != imageType) { log.config("Incompatible JPEG image type: creating new buffer image"); image = new BufferedImage(tmpImage.getWidth(null), tmpImage.getHeight(null), imageType); Graphics2D g = image.createGraphics(); g.drawImage(tmpImage, 0, 0, null); g.dispose(); } else image = tmpImage; } } return image; } // loadBufferedImage
@Test public void testJavaLogging() { final java.util.logging.Logger logger = java.util.logging.Logger.getLogger(this.getClass().getName()); logger.finest("Foobar FINEST"); AppenderForTests.hasNoLastEvent("at Finest level"); assertFalse(logger.isLoggable(java.util.logging.Level.FINEST)); logger.finer("Foobar FINER"); AppenderForTests.hasNoLastEvent("at Finer level"); assertFalse(logger.isLoggable(java.util.logging.Level.FINER)); logger.fine("Foobar FINE"); AppenderForTests.hasNoLastEvent("at Fine level"); assertFalse(logger.isLoggable(java.util.logging.Level.FINE)); logger.config("Foobar CONFIG"); AppenderForTests.hasNoLastEvent("at Config level"); assertFalse(logger.isLoggable(java.util.logging.Level.CONFIG)); logger.info("Foobar INFO"); AppenderForTests.hasNoLastEvent("at Info level"); assertFalse(logger.isLoggable(java.util.logging.Level.INFO)); logger.warning("Foobar WARNING"); AppenderForTests.hasLastEvent("at Warning level"); assertTrue(logger.isLoggable(java.util.logging.Level.WARNING)); logger.severe("Foobar SEVERE"); AppenderForTests.hasLastEvent("at Severe level"); assertTrue(logger.isLoggable(java.util.logging.Level.SEVERE)); }
@Override public void init(Map<String, Object> settings) throws TigaseDBException { autoAuthorize = Boolean.parseBoolean((String) settings.get(AUTO_AUTHORIZE_PROP_KEY)); if (autoAuthorize) { log.config( "Automatic presence autorization enabled, results in less strict XMPP specs compatibility "); } }
@Test public void testLogUsingCustomLevel() throws Exception { logger.config("Config level"); final List<LogEvent> events = eventAppender.getEvents(); assertThat(events, hasSize(1)); final LogEvent event = events.get(0); assertThat(event.getLevel(), equalTo(LevelTranslator.CONFIG)); }
@Override public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { if (cmd.getName().equalsIgnoreCase("pfreload")) { sender.sendMessage(ChatColor.RED + "Reloading config.yml and rules.txt"); // Remove all our listeners, first. HandlerList.unregisterAll(this); // Shut down the DataCache dataCache.stop(); reloadConfig(); configurePlugin(); ruleset = new RuleSet(this); if (ruleset.init(getRulesFile())) { logger.config("rules.txt and config.yml reloaded by " + sender.getName()); } else { logger.warning("failed to reload rules.txt as requested by " + sender.getName()); } // Start the DataCache again dataCache = new DataCache(this, ruleset.permList); // Re-register our listeners registerListeners(); return true; } else if (cmd.getName().equalsIgnoreCase("pfcls")) { sender.sendMessage(ChatColor.RED + "Clearing chat screen"); logger.info("chat screen cleared by " + sender.getName()); int i = 0; while (i <= 120) { getServer().broadcastMessage(" "); i++; } return true; } else if (cmd.getName().equalsIgnoreCase("pfmute")) { if (pwnMute) { getServer() .broadcastMessage(ChatColor.RED + "Global mute cancelled by " + sender.getName()); logger.info("global mute cancelled by " + sender.getName()); pwnMute = false; } else { getServer() .broadcastMessage(ChatColor.RED + "Global mute initiated by " + sender.getName()); logger.info("global mute initiated by " + sender.getName()); pwnMute = true; } return true; } else if (cmd.getName().equalsIgnoreCase("pfdumpcache")) { dataCache.dumpCache(logger); sender.sendMessage(ChatColor.RED + "Dumped PwnFilter cache to log."); logger.info("Dumped PwnFilter cache to log by " + sender.getName()); } return false; }
/** * Private helper that handles the functionFactory elements. This one is a little more complex * than the other two factory helper methods, since it consists of three factories (target, * condition, and general). */ private FunctionFactoryProxy parseFunctionFactory(Node root) throws ParsingException { FunctionFactoryProxy proxy = null; FunctionFactory generalFactory = null; FunctionFactory conditionFactory = null; FunctionFactory targetFactory = null; // check if we're starting with the standard factory setup, and // make sure that the proxy is pre-configured if (useStandard(root, "useStandardFunctions")) { logger.config("Starting with standard Functions"); proxy = StandardFunctionFactory.getNewFactoryProxy(); targetFactory = proxy.getTargetFactory(); conditionFactory = proxy.getConditionFactory(); generalFactory = proxy.getGeneralFactory(); } else { generalFactory = new BaseFunctionFactory(); conditionFactory = new BaseFunctionFactory(generalFactory); targetFactory = new BaseFunctionFactory(conditionFactory); proxy = new BasicFunctionFactoryProxy(targetFactory, conditionFactory, generalFactory); } // go through and load the three sections, putting the loaded // functions into the appropriate factory NodeList children = root.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); String name = child.getNodeName(); if (name.equals("target")) { logger.config("Loading [TARGET] functions"); functionParserHelper(child, targetFactory); } else if (name.equals("condition")) { logger.config("Loading [CONDITION] functions"); functionParserHelper(child, conditionFactory); } else if (name.equals("general")) { logger.config("Loading [GENERAL] functions"); functionParserHelper(child, generalFactory); } } return proxy; }
/** Public singleton access method. */ public static synchronized PhotoFactory getInstance() { if (instance == null) { log.config( LogBuilder.createSystemMessage().addAction("setting AirplanePhotoFactory").toString()); setInstance(new AirplanePhotoFactory()); } return instance; }
@Test public void testLogWithCallingClass() throws Exception { final Logger log = Logger.getLogger("Test.CallerClass"); log.config("Calling from LoggerTest"); final List<String> messages = stringAppender.getMessages(); assertThat(messages, hasSize(1)); final String message = messages.get(0); assertEquals(AbstractLoggerTest.class.getName(), message); }
/** * To get the Web URL from any Page URL of the web * * @param pageURL * @return the well formed Web URL to be used for WS calls */ public String getWebURLFromPageURL(final String pageURL) { LOGGER.config("Page URL: " + pageURL); String strWebURL = null; try { strWebURL = stub.webUrlFromPageUrl(pageURL); } catch (final AxisFault af) { // Handling of username formats for // different authentication models. if ((SPConstants.UNAUTHORIZED.indexOf(af.getFaultString()) != -1) && (sharepointClientContext.getDomain() != null)) { final String username = Util.switchUserNameFormat(stub.getUsername()); LOGGER.log( Level.CONFIG, "Web Service call failed for username [ " + stub.getUsername() + " ]. Trying with " + username); stub.setUsername(username); try { strWebURL = stub.webUrlFromPageUrl(pageURL); } catch (final Exception e) { strWebURL = Util.getWebURLForWSCall(pageURL); LOGGER.log( Level.WARNING, "Unable to get the sharepoint web URL for the URL: [ " + pageURL + " ]. Using [ " + strWebURL + " ] as web URL. "); return strWebURL; } } else { strWebURL = Util.getWebURLForWSCall(pageURL); LOGGER.log( Level.WARNING, "Unable to get the sharepoint web URL for the URL: [ " + pageURL + " ]. Using [ " + strWebURL + " ] as web URL. "); return strWebURL; } } catch (final Throwable e) { strWebURL = Util.getWebURLForWSCall(pageURL); LOGGER.log( Level.WARNING, "Unable to get the sharepoint web URL for the URL: [ " + pageURL + " ]. Using [ " + strWebURL + " ] as web URL. "); return strWebURL; } LOGGER.log(Level.CONFIG, "WebURL: " + strWebURL); return strWebURL; }
@Override public void init(String[] args) throws ConfigurationException { // String fileName, String[] args) throws XMLDBException { // System.out.println("configurator init..."); parseArgs(args); // System.out.println("configurator after parse args, reading config from file: " + fileName); try { repository = ConfigXMLRepository.getConfigRepository(config_file_name); } catch (Exception e) { throw new ConfigurationException("Problem reading configuration repository", e); } // System.out.println("configurator after config repository load"); defConfigParams.putAll(getAllProperties(null)); // System.out.println("configurator after defparams.putall all properties"); Set<String> prop_keys = defProperties.keySet(); // System.out.println("configurator starting loop...."); for (String key : prop_keys) { // System.out.println("Analyzing key: " + key); int idx1 = key.indexOf("/"); if (idx1 > 0) { String root = key.substring(0, idx1); String node = key.substring(idx1 + 1); String prop_key = null; int idx2 = node.lastIndexOf("/"); if (idx2 > 0) { prop_key = node.substring(idx2 + 1); node = node.substring(0, idx2); } else { prop_key = node; node = null; } repository.set(root, node, prop_key, defProperties.get(key)); log.config( "Added default config property: (" + key + "=" + defProperties.get(key) + "), classname: " + defProperties.get(key).getClass().getName()); // System.out.println("Added default config property: (" // + key + "=" + defProperties.getProperty(key) + ")"); } else { log.warning("Ignoring default property, component part is missing: " + key); } } // Not sure if this is the correct pleace to initialize monitoring // maybe it should be initialized init initializationCompleted but // Then some stuff might be missing. Let's try to do it here for now // and maybe change it later. initMonitoring( (String) defConfigParams.get(MONITORING), new File(config_file_name).getParent()); }
/** * To get the Web Title of a given web * * @param webURL To identiy the web whose Title is to be discovered * @param spType The SharePOint type for this web * @return the web title */ public String getWebTitle(final String webURL, final SPType spType) { String webTitle = "No Title"; try { LOGGER.config("Getting title for Web: " + webURL + " SharepointConnectorType: " + spType); if (SPType.SP2003 == spType) { final SiteDataWS siteDataWS = new SiteDataWS(sharepointClientContext); webTitle = siteDataWS.getTitle(); } else { GetWebResponseGetWebResult resWeb = null; try { resWeb = stub.getWeb(webURL); } catch (final AxisFault af) { if ((SPConstants.UNAUTHORIZED.indexOf(af.getFaultString()) != -1) && (sharepointClientContext.getDomain() != null)) { final String username = Util.switchUserNameFormat(stub.getUsername()); LOGGER.log( Level.CONFIG, "Web Service call failed for username [ " + stub.getUsername() + " ]. Trying with " + username); stub.setUsername(username); try { resWeb = stub.getWeb(webURL); } catch (final Exception e) { LOGGER.log( Level.WARNING, "Unable to Get Title for web [ " + webURL + " ]. Using the default web Title. ", e); } } else { LOGGER.log( Level.WARNING, "Unable to Get Title for web [ " + webURL + " ]. Using the default web Title. ", af); } } if (null != resWeb) { final MessageElement[] meArray = resWeb.get_any(); if ((meArray != null) && (meArray[0] != null)) { webTitle = meArray[0].getAttribute(SPConstants.WEB_TITLE); } } } } catch (final Exception e) { LOGGER.log( Level.WARNING, "Unable to Get Title for web [ " + webURL + " ]. Using the default web Title. " + e); } LOGGER.log(Level.FINE, "Title: " + webTitle); return webTitle; }
private void testMessage(String string) { final Logger root = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME); root.info("Test info " + string); root.config("Test info " + string); root.fine("Test info " + string); final List<LogEvent> events = eventAppender.getEvents(); assertThat(events, hasSize(3)); for (final LogEvent event : events) { final String message = event.getMessage().getFormattedMessage(); assertThat(message, equalTo("Test info " + string)); } }
private void initParam() { lg.entering(TyPun.class.getName(), "initParam"); /* keep track of parameter’s values that will be used */ lg.config( String.format("Use typographic punctuation : %s", tc.do_UsePunctuation() ? "YES" : "NO")); lg.config(String.format("Use ligatures : %s", tc.do_UseLigatures() ? "YES" : "NO")); lg.config(String.format("Use old ligatures : %s", tc.do_UseOldLigatures() ? "YES" : "NO")); lg.config(String.format("Use French quotes : %s", tc.do_UseFrenchQuotes() ? "YES" : "NO")); lg.config(String.format("Use old style numbers : %s", tc.do_UseOldStyleNums() ? "YES" : "NO")); lg.config(String.format("Use French spacing : %s", tc.do_UseFrenchSpacing() ? "YES" : "NO")); lg.config(String.format("Use typographic dashes : %s", tc.do_UseTypoDash() ? "YES" : "NO")); /* left and right double quotes are currently defined at compile-time * but the code needs very few changes to make it dynamic. That way we * may use English or French quotes running the exact same code */ // ldquo = bUseFrenchQuotes ? "\u00ab" : "\u201c"; /* U+00ab « U+201c “ */ // rdquo = bUseFrenchQuotes ? "\u00bb" : "\u201d"; /* U+00bb » U+201d ” */ ldquo = tc.do_UseFrenchQuotes() ? "\u00ab" : "\u201c"; /* U+00ab « U+201c “ */ rdquo = tc.do_UseFrenchQuotes() ? "\u00bb" : "\u201d"; /* U+00bb » U+201d ” */ tydash = "\u2013"; /* tydash = "\u2014"; */ lg.exiting(TyPun.class.getName(), "initParam"); }
/** * Returns the set of supported formats by the available JAI library, or the empty set if not * available. * * @return Set<String> of the MIME types the available JAI library supports, or the empty * set if it is not available. */ public static Set getSupportedFormats() { if (supportedFormats == null) { String[] mimeTypes = null; try { mimeTypes = ImageIO.getWriterMIMETypes(); } catch (NoClassDefFoundError ncdfe) { supportedFormats = Collections.EMPTY_SET; LOGGER.warning("could not find jai: " + ncdfe); // this will occur if JAI is not present, so please do not // delete, or we get really nasty messages on getCaps for wms. } if (mimeTypes == null) { LOGGER.info("Jai not found? Should be always there"); supportedFormats = Collections.EMPTY_SET; } else { supportedFormats = new HashSet(); List formatsList = Arrays.asList(mimeTypes); for (Iterator it = formatsList.iterator(); it.hasNext(); ) { String curFormat = it.next().toString(); if (!curFormat.equals("")) { // DJB: check to see if the JAI format has been tested to work! if (testedFormats.contains(curFormat)) { supportedFormats.add(curFormat); } } } if (LOGGER.isLoggable(Level.CONFIG)) { StringBuffer sb = new StringBuffer("Supported JAIMapResponse's MIME Types: ["); for (Iterator it = supportedFormats.iterator(); it.hasNext(); ) { sb.append(it.next()); if (it.hasNext()) { sb.append(", "); } } sb.append("]"); LOGGER.config(sb.toString()); } } } return supportedFormats; }
/** * Get datas from beans and apply to widget * * @param paramsLineRuleBean */ public void applyDatas(final ListKeyValueBean listKeyValueBean, boolean clearWidget) { if (clearWidget) { this._listKeyValue.clear(); this._main.clear(); } for (KeyValueBean keyValueBean : listKeyValueBean) { log.config("create widget"); final KeyValueWidget keyValueWidget = this.createKeyValue(keyValueBean.getKeyName(), true); keyValueWidget.applyDatas(keyValueBean); } }