diff options
Diffstat (limited to 'velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource')
9 files changed, 26 insertions, 61 deletions
diff --git a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java index d96f0901..58acd8ba 100644 --- a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java +++ b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java @@ -441,7 +441,7 @@ public class ResourceManagerImpl * multi-path support - will revisit and fix */ - if (logWhenFound && log.isDebugEnabled()) + if (logWhenFound) { log.debug("ResourceManager: found {} with loader {}", resourceName, resourceLoader.getClassName()); diff --git a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ClasspathResourceLoader.java b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ClasspathResourceLoader.java index 6f33e44d..d3a2f1b8 100644 --- a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ClasspathResourceLoader.java +++ b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ClasspathResourceLoader.java @@ -85,10 +85,7 @@ public class ClasspathResourceLoader extends ResourceLoader */ public void init( ExtProperties configuration) { - if (log.isTraceEnabled()) - { - log.trace("ClasspathResourceLoader : initialization complete."); - } + log.trace("ClasspathResourceLoader : initialization complete."); } /** diff --git a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java index dc916d7f..a5394e75 100644 --- a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java +++ b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java @@ -149,21 +149,15 @@ public class DataSourceResourceLoader extends ResourceLoader if (dataSource != null) { - if (log.isDebugEnabled()) - { - log.debug("DataSourceResourceLoader: using dataSource instance with table \"{}\"", tableName); - log.debug("DataSourceResourceLoader: using columns \"{}\", \"{}\" and \"{}\"", keyColumn, templateColumn, timestampColumn); - } + log.debug("DataSourceResourceLoader: using dataSource instance with table \"{}\"", tableName); + log.debug("DataSourceResourceLoader: using columns \"{}\", \"{}\" and \"{}\"", keyColumn, templateColumn, timestampColumn); log.trace("DataSourceResourceLoader initialized."); } else if (dataSourceName != null) { - if (log.isDebugEnabled()) - { - log.debug("DataSourceResourceLoader: using \"{}\" datasource with table \"{}\"", dataSourceName, tableName); - log.debug("DataSourceResourceLoader: using columns \"{}\", \"{}\" and \"{}\"", keyColumn, templateColumn, timestampColumn); - } + log.debug("DataSourceResourceLoader: using \"{}\" datasource with table \"{}\"", dataSourceName, tableName); + log.debug("DataSourceResourceLoader: using columns \"{}\", \"{}\" and \"{}\"", keyColumn, templateColumn, timestampColumn); log.trace("DataSourceResourceLoader initialized."); } diff --git a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java index da92b770..33cfb734 100644 --- a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java +++ b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java @@ -67,10 +67,7 @@ public class FileResourceLoader extends ResourceLoader */ public void init( ExtProperties configuration) { - if (log.isTraceEnabled()) - { - log.trace("FileResourceLoader : initialization starting."); - } + log.trace("FileResourceLoader : initialization starting."); paths.addAll( configuration.getVector("path") ); diff --git a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarHolder.java b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarHolder.java index 4f5a5d0c..8a0c548a 100644 --- a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarHolder.java +++ b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarHolder.java @@ -59,10 +59,7 @@ public class JarHolder this.urlpath=urlpath; init(); - if (log.isDebugEnabled()) - { - log.debug("JarHolder: initialized JAR: {}", urlpath); - } + log.debug("JarHolder: initialized JAR: {}", urlpath); } /** @@ -72,10 +69,8 @@ public class JarHolder { try { - if (log.isDebugEnabled()) - { - log.debug("JarHolder: attempting to connect to {}", urlpath); - } + log.debug("JarHolder: attempting to connect to {}", urlpath); + URL url = new URL( urlpath ); conn = (JarURLConnection) url.openConnection(); conn.setAllowUserInteraction(false); diff --git a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarResourceLoader.java b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarResourceLoader.java index 341419b1..ded365bb 100644 --- a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarResourceLoader.java +++ b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarResourceLoader.java @@ -109,10 +109,7 @@ public class JarResourceLoader extends ResourceLoader private void loadJar( String path ) { - if (log.isDebugEnabled()) - { - log.debug("JarResourceLoader : trying to load \"{}\"", path); - } + log.debug("JarResourceLoader : trying to load \"{}\"", path); // Check path information if ( path == null ) diff --git a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java index 41f74507..46e83aaa 100644 --- a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java +++ b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java @@ -246,11 +246,8 @@ public abstract class ResourceLoader } catch (ResourceNotFoundException e) { - if (log.isDebugEnabled()) - { - log.debug("Could not load resource '{}' from ResourceLoader {}", - resourceName, this.getClass().getName()); - } + log.debug("Could not load resource '{}' from ResourceLoader {}", + resourceName, this.getClass().getName()); } finally { @@ -263,14 +260,11 @@ public abstract class ResourceLoader } catch (Exception e) { - if (log.isErrorEnabled()) - { - String msg = "While closing InputStream for resource '" + - resourceName + "' from ResourceLoader " + - this.getClass().getName(); - log.error(msg, e); - throw new VelocityException(msg, e); - } + String msg = "While closing InputStream for resource '" + + resourceName + "' from ResourceLoader " + + this.getClass().getName(); + log.error(msg, e); + throw new VelocityException(msg, e); } } return (reader != null); diff --git a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/StringResourceLoader.java b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/StringResourceLoader.java index 06cf1c6d..ad795e08 100644 --- a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/StringResourceLoader.java +++ b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/StringResourceLoader.java @@ -223,7 +223,7 @@ public class StringResourceLoader extends ResourceLoader if (isStatic) { this.repository = getRepository(repoName); - if (repository != null && log.isDebugEnabled()) + if (repository != null) { log.debug("Loaded repository '{}' from static repo store", repoName); } @@ -231,7 +231,7 @@ public class StringResourceLoader extends ResourceLoader else { this.repository = (StringResourceRepository)rsvc.getApplicationAttribute(repoName); - if (repository != null && log.isDebugEnabled()) + if (repository != null) { log.debug("Loaded repository '{}' from application attributes", repoName); } @@ -267,11 +267,8 @@ public class StringResourceLoader extends ResourceLoader if (encoding != null && !this.repository.getEncoding().equals(encoding)) { - if (log.isDebugEnabled()) - { - log.debug("Changing the default encoding of string repository '{}' from {} to {}", - repoName, this.repository.getEncoding(), encoding); - } + log.debug("Changing the default encoding of string repository '{}' from {} to {}", + repoName, this.repository.getEncoding(), encoding); this.repository.setEncoding(encoding); } } @@ -285,10 +282,7 @@ public class StringResourceLoader extends ResourceLoader public StringResourceRepository createRepository(final String className, final String encoding) { - if (log.isDebugEnabled()) - { - log.debug("Creating string repository using class {}...", className); - } + log.debug("Creating string repository using class {}...", className); StringResourceRepository repo; try @@ -317,10 +311,7 @@ public class StringResourceLoader extends ResourceLoader repo.setEncoding(RuntimeConstants.ENCODING_DEFAULT); } - if (log.isDebugEnabled()) - { - log.debug("Default repository encoding is {}", repo.getEncoding()); - } + log.debug("Default repository encoding is {}", repo.getEncoding()); return repo; } diff --git a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/URLResourceLoader.java b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/URLResourceLoader.java index 1c3ce3d9..750accde 100644 --- a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/URLResourceLoader.java +++ b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/URLResourceLoader.java @@ -122,7 +122,7 @@ public class URLResourceLoader extends ResourceLoader if (reader != null) { - if (log.isDebugEnabled()) log.debug("URLResourceLoader: Found '{}' at '{}'", name, roots[i]); + log.debug("URLResourceLoader: Found '{}' at '{}'", name, roots[i]); // save this root for later re-use templateRoots.put(name, roots[i]); @@ -139,7 +139,7 @@ public class URLResourceLoader extends ResourceLoader } catch (IOException e) {} } - if (log.isDebugEnabled()) log.debug("URLResourceLoader: Exception when looking for '{}' at '{}'", name, roots[i], ioe); + log.debug("URLResourceLoader: Exception when looking for '{}' at '{}'", name, roots[i], ioe); // only save the first one for later throwing if (exception == null) |