private void load(Collection<URL> urls){ for (URL location : urls) { try { this.urls.put(location.toExternalForm(), location); } catch (Exception e) { if (LOG.isWarnEnabled()) { LOG.warn("Cannot translate url to external form!", e); } } } }
@Override public InputSource resolveEntity(String publicId, String systemId) { if (dtdMappings != null && dtdMappings.containsKey(publicId)) { String dtdFile = dtdMappings.get(publicId); return new InputSource(ClassLoaderUtil.getResourceAsStream(dtdFile, DomHelper.class)); } else if (LOG.isWarnEnabled()) { LOG.warn("Local DTD is missing for publicID: #0 - defined mappings: #1", publicId, dtdMappings); } return null; }
protected boolean isPackageExcluded(Package targetPackage, Package memberPackage) { if (LOG.isWarnEnabled() && (targetPackage == null || memberPackage == null)) { LOG.warn("The use of the default (unnamed) package is discouraged!"); } String targetPackageName = targetPackage == null ? "" : targetPackage.getName(); String memberPackageName = memberPackage == null ? "" : memberPackage.getName(); for (Pattern pattern : excludedPackageNamePatterns) { if (pattern.matcher(targetPackageName).matches() || pattern.matcher(memberPackageName).matches()) { return true; } } targetPackageName = targetPackageName + "."; memberPackageName = memberPackageName + "."; for (String packageName: excludedPackageNames) { if (targetPackageName.startsWith(packageName) || memberPackageName.startsWith(packageName)) { return true; } } return false; }
public URL normalizeToFileProtocol(URL url) { String fileName = url.toExternalForm(); Matcher jarMatcher = JAR_PATTERN.matcher(fileName); try { if (jarMatcher.matches()) { String path = jarMatcher.group(JAR_FILE_PATH); return new URL("file", "", path); } else if ("file".equals(url.getProtocol())) { return url; // it's already a file } else { if (LOG.isWarnEnabled()) { LOG.warn("Could not normalize URL [#0] to file protocol!", url.toString()); } return null; } } catch (MalformedURLException e) { if (LOG.isWarnEnabled()) { LOG.warn("Error normalizing URL [#0] to file protocol!", e, url.toString()); } return null; } }
protected Class verifyResultType(String className, Location loc) { try { return objectFactory.getClassInstance(className); } catch (ClassNotFoundException e) { if (LOG.isWarnEnabled()) { LOG.warn("Result class [#0] doesn't exist (ClassNotFoundException) at #1, ignoring", e, className, loc.toString()); } } catch (NoClassDefFoundError e) { if (LOG.isWarnEnabled()) { LOG.warn("Result class [#0] doesn't exist (NoClassDefFoundError) at #1, ignoring", e, className, loc.toString()); } } return null; }
private void clearContainerProvider(ContainerProvider containerProvider) { try { containerProvider.destroy(); } catch (Exception e) { if (LOG.isWarnEnabled()) { LOG.warn("Error while destroying container provider [#0]", e, containerProvider.toString()); } } }
@Inject(value = XWorkConstants.OVERRIDE_EXCLUDED_PATTERNS, required = false) public void setOverrideExcludePatterns(String excludePatterns) { if (LOG.isWarnEnabled()) { LOG.warn("Overriding excluded patterns [#0] with [#1], be aware that this affects all instances and safety of your application!", XWorkConstants.OVERRIDE_EXCLUDED_PATTERNS, excludePatterns); } excludedPatterns = new HashSet<Pattern>(); for (String pattern : TextParseUtil.commaDelimitedStringToSet(excludePatterns)) { excludedPatterns.add(Pattern.compile(pattern, Pattern.CASE_INSENSITIVE)); } }
@Inject(value = XWorkConstants.OVERRIDE_ACCEPTED_PATTERNS, required = false) public void setOverrideAcceptedPatterns(String acceptablePatterns) { if (LOG.isWarnEnabled()) { LOG.warn("Overriding accepted patterns [#0] with [#1], be aware that this affects all instances and safety of your application!", XWorkConstants.OVERRIDE_ACCEPTED_PATTERNS, acceptablePatterns); } acceptedPatterns = new HashSet<Pattern>(); for (String pattern : TextParseUtil.commaDelimitedStringToSet(acceptablePatterns)) { acceptedPatterns.add(Pattern.compile(pattern, Pattern.CASE_INSENSITIVE)); } }
private void reloadProviders(List<ContainerProvider> providers) { for (ContainerProvider containerProvider : containerProviders) { try { containerProvider.destroy(); } catch (Exception e) { if (LOG.isWarnEnabled()) { LOG.warn("error while destroying configuration provider [#0]", e, containerProvider.toString()); } } } packageProviders = this.configuration.reloadContainer(providers); }
/** * Is the given logger enalbed at the given level? * * @param logger the logger. * @param level the level to check if <code>isXXXEnabled</code>. * @return <tt>true</tt> if enabled, <tt>false</tt> if not. */ private static boolean isLoggerEnabled(Logger logger, String level) { if ("debug".equalsIgnoreCase(level)) { return logger.isDebugEnabled(); } else if ("info".equalsIgnoreCase(level)) { return logger.isInfoEnabled(); } else if ("warn".equalsIgnoreCase(level)) { return logger.isWarnEnabled(); } else if ("error".equalsIgnoreCase(level)) { return logger.isErrorEnabled(); } else if ("fatal".equalsIgnoreCase(level)) { return logger.isFatalEnabled(); } else if ("trace".equalsIgnoreCase(level)) { return logger.isTraceEnabled(); } else { throw new IllegalArgumentException("LogLevel [" + level + "] is not supported"); } }
if (LOG.isWarnEnabled()) { LOG.warn("Could not find end of jar file!"); if (LOG.isWarnEnabled()) { LOG.warn("Could not create JarEntryRevision for [#0]!", e, jarFileName);
clearMap(cl.getSuperclass(), loader, TOMCAT_RESOURCE_ENTRIES_FIELD); } catch (Exception e) { if (LOG.isWarnEnabled()) { LOG.warn("Couldn't clear tomcat cache using #0", e, cl.getSuperclass().getName()); if (LOG.isWarnEnabled()) { LOG.warn("Couldn't clear tomcat cache", e, cl.getName());
private void handleRuntimeException(String expr, Object value, boolean throwExceptionOnFailure, RuntimeException re) { if (throwExceptionOnFailure) { String message = ErrorMessageBuilder.create() .errorSettingExpressionWithValue(expr, value) .build(); throw new XWorkException(message, re); } else { if (LOG.isWarnEnabled()) { LOG.warn("Error setting value [#0] with expression [#1]", re, value.toString(), expr); } } }
if (LOG.isWarnEnabled()) { LOG.warn("Could not examine class '" + fqn + "' due to a " + t.getClass().getName() + " with message: " + t.getMessage());
if (LOG.isWarnEnabled()) { LOG.warn("Unmatched Timer. Was expecting " + currentTimer.getResource() + ", instead got " + name);
/** * Log a failed lookup, being more verbose when devMode=true. * * @param expr The failed expression * @param e The thrown exception. */ private void logLookupFailure(String expr, Exception e) { String msg = LoggerUtils.format("Caught an exception while evaluating expression '#0' against value stack", expr); if (devMode && LOG.isWarnEnabled()) { LOG.warn(msg, e); LOG.warn("NOTE: Previous warning message was issued due to devMode set to true."); } else if (LOG.isDebugEnabled()) { LOG.debug(msg, e); } }
fakeParams.put(fullFieldName, escape(tmpValue[0])); } else { if (LOG.isWarnEnabled()) { LOG.warn("value is an empty array of String or with first element in it as null [" + value + "], will not repopulate conversion error "); } else { if (LOG.isWarnEnabled()) { LOG.warn("conversion error value is not a String or array of String but instead is [" + value + "], will not repopulate conversion error");
return anAppContext.getBean(beanName); } catch (NoSuchBeanDefinitionException e2) { if (LOG.isWarnEnabled()) { LOG.warn("Could not register new bean definition for bean " + beanName);
if (LOG.isWarnEnabled()) { LOG.warn("ApplicationContext could not be found. Action classes will not be autowired.");
if (LOG.isWarnEnabled() && unableToFindTextForKey(result)) { LOG.warn("Unable to find text for key '" + aTextName + "' in ResourceBundles for locale '" + locale + "'");