jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r514657 - in /jackrabbit/trunk/contrib/classloader/src: main/java/org/apache/jackrabbit/classloader/ test/java/org/apache/jackrabbit/classloader/
Date Mon, 05 Mar 2007 12:26:40 GMT
Author: fmeschbe
Date: Mon Mar  5 04:26:38 2007
New Revision: 514657

URL: http://svn.apache.org/viewvc?view=rev&rev=514657
Log:
Cleanup log call by using the message pattern mechanism of SLF4J

Modified:
    jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/ArchiveClassPathEntry.java
    jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/ClassPathEntry.java
    jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/DirectoryClassPathEntry.java
    jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/DynamicPatternPath.java
    jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/DynamicRepositoryClassLoader.java
    jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/ExpandingArchiveClassPathEntry.java
    jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/NodeTypeSupport.java
    jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/PatternPath.java
    jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/RepositoryClassLoader.java
    jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/Util.java
    jackrabbit/trunk/contrib/classloader/src/test/java/org/apache/jackrabbit/classloader/ClassLoaderTestBase.java
    jackrabbit/trunk/contrib/classloader/src/test/java/org/apache/jackrabbit/classloader/ExpandingArchiveClassPathEntryTest.java

Modified: jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/ArchiveClassPathEntry.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/ArchiveClassPathEntry.java?view=diff&rev=514657&r1=514656&r2=514657
==============================================================================
--- jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/ArchiveClassPathEntry.java
(original)
+++ jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/ArchiveClassPathEntry.java
Mon Mar  5 04:26:38 2007
@@ -145,18 +145,18 @@
                 return new ArchiveClassPathResource(this, entry);
             }
 
-            log.debug("getResource: resource " + name + " not found"
-                + " in archive " + path);
+            log.debug("getResource: resource {} not found in archive {}", name,
+                path);
 
         } catch (IOException ioe) {
 
-            log.warn("getResource: problem accessing the archive " + path
-                + " for " + name + ": " + ioe.toString());
+            log.warn("getResource: problem accessing the archive {} for {}",
+                new Object[]{ path, name}, ioe);
 
         } catch (RepositoryException re) {
 
-            log.warn("getResource: problem accessing the archive " + path
-                + " for " + name + ": " + re.toString());
+            log.warn("getResource: problem accessing the archive {} for {}",
+                new Object[]{ path, name}, re);
 
         } finally {
 
@@ -236,7 +236,7 @@
         try {
             return URLFactory.createURL(session, path);
         } catch (MalformedURLException mue) {
-            log.warn("getCodeSourceURL: Cannot getURL" + " for " + path, mue);
+            log.warn("getCodeSourceURL: Cannot getURL for " + path, mue);
         }
         return null;
     }
@@ -351,7 +351,7 @@
                             String name = entry.getName();
                             Integer entryNumO = new Integer(i);
                             tmpEntryMap.put(name, entryNumO);
-                            log.debug("findEntry: Entry " + name + " ==> " +
+                            log.debug("findEntry: Entry {} ==> {}", name,
                                 entryNumO);
 
                             // if we found our entry, keep it to be returned later
@@ -367,8 +367,8 @@
                         // invariant: path has the entry found or null
 
                         // return what we found
-                        log.debug("findEntry: Indexing complete, " +
-                                "returning " + result);
+                        log.debug("findEntry: Indexing complete, returning {}",
+                            result);
                         return result;
 
                     } finally {
@@ -400,12 +400,12 @@
         // map exists, lets try to get via number
         Number entryNumO = (Number) entryMap.get(path);
         if (entryNumO == null) {
-            log.debug("findEntry: This archive does not contain " + path);
+            log.debug("findEntry: This archive does not contain {}", path);
             return null;
         }
 
         // find the indexed entry
-        log.debug("findEntry: " + path + " is entry #" + entryNumO);
+        log.debug("findEntry: {} is entry #{}", path, entryNumO);
         int entryNum = entryNumO.intValue();
         JarEntry entry = zins.getNextJarEntry();
         while (entryNum > 0 && entry != null) {
@@ -494,8 +494,8 @@
                 }
 
                 // otherwise
-                log.warn("Cannot find entry " + getName() + " in the archive "
-                    + getClassPathEntry().getPath() + " anymore!");
+                log.warn("Cannot find entry {} in the archive {} anymore!",
+                    getName(), getClassPathEntry().getPath());
                 return null;
 
             } catch (IOException ioe) {

Modified: jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/ClassPathEntry.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/ClassPathEntry.java?view=diff&rev=514657&r1=514656&r2=514657
==============================================================================
--- jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/ClassPathEntry.java
(original)
+++ jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/ClassPathEntry.java
Mon Mar  5 04:26:38 2007
@@ -45,7 +45,7 @@
  * This class is not intended to be subclassed or instantiated by clients.
  *
  * @author Felix Meschberger
- * @version $Rev:$, $Date$
+ * @version $Rev$, $Date$
  */
 abstract class ClassPathEntry {
 
@@ -118,8 +118,9 @@
         try {
             session.checkPermission(path, "read");
         } catch (AccessControlException ace) {
-            log.warn("getInstance: Access denied reading from " + path +
-                ", ignoring entry");
+            log.warn(
+                "getInstance: Access denied reading from {}, ignoring entry",
+                path);
             return null;
         } catch (RepositoryException re) {
             log.error("getInstance: Cannot check permission to " + path, re);
@@ -146,11 +147,13 @@
                         return new ArchiveClassPathEntry(prop, path);
                     }
 
-                    log.debug("getInstance: " + path + " might not be a jar " +
-                            "archive, using as directory");
+                    log.debug(
+                        "getInstance: {} might not be a jar archive, using as directory",
+                        path);
                 } else {
-                    log.debug("getInstance: " + path + " does not resolve" +
-                            " to a property, using as directory");
+                    log.debug(
+                        "getInstance: {} does not resolve to a property, using as directory",
+                        path);
                 }
 
             } catch (ItemNotFoundException infe) {
@@ -169,18 +172,21 @@
 
             } catch (RepositoryException re) {
 
-                log.debug("getInstance: " + path + " cannot be read from, " +
-                        "using as directory");
+                log.debug(
+                    "getInstance: {} cannot be read from, using as directory",
+                    path);
 
             } catch (JarException ze) {
 
-                log.debug("getInstance: " + path + " does not contain an " +
-                        "archive, using as directory");
+                log.debug(
+                    "getInstance: {} does not contain an archive, using as directory",
+                    path);
 
             } catch (IOException ioe) {
 
-                log.debug("getInstance: " + path + " problem reading from " +
-                        "the archive, using as directory");
+                log.debug(
+                    "getInstance: {} problem reading from the archive, using as directory",
+                    path);
 
             } finally {
                 if (zip != null) {

Modified: jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/DirectoryClassPathEntry.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/DirectoryClassPathEntry.java?view=diff&rev=514657&r1=514656&r2=514657
==============================================================================
--- jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/DirectoryClassPathEntry.java
(original)
+++ jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/DirectoryClassPathEntry.java
Mon Mar  5 04:26:38 2007
@@ -77,18 +77,18 @@
                 return new ClassLoaderResource(this, name, prop);
             }
 
-            log.debug("getResource: resource " + name +
-                " not found below " + path);
+            log.debug("getResource: resource {} not found below {} ", name,
+                path);
 
         } catch (PathNotFoundException pnfe) {
 
-            log.info("getResource: Classpath entry " + path +
-                " does not have resource " + name);
+            log.debug("getResource: Classpath entry {} does not have resource {}",
+                path, name);
 
         } catch (RepositoryException cbe) {
 
-            log.warn("getResource: problem accessing the resource " + name +
-                " below " + path + ": " + cbe);
+            log.warn("getResource: problem accessing the resource {} below {}",
+                new Object[] { name, path }, cbe);
 
         }
         // invariant : no page or problem accessing the page

Modified: jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/DynamicPatternPath.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/DynamicPatternPath.java?view=diff&rev=514657&r1=514656&r2=514657
==============================================================================
--- jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/DynamicPatternPath.java
(original)
+++ jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/DynamicPatternPath.java
Mon Mar  5 04:26:38 2007
@@ -105,10 +105,10 @@
 
         // guarded add
         if (!listeners.contains(listener)) {
-            log.debug("addListener: Listener " + listener);
+            log.debug("addListener: Listener {}", listener);
             listeners.add(listener);
         } else {
-            log.info("addListener: Listener " + listener + " already added");
+            log.info("addListener: Listener {} already added", listener);
         }
     }
 
@@ -135,9 +135,9 @@
 
         // guarded removal
         if (listeners.remove(listener)) {
-            log.debug("removeListener: Listener " + listener);
+            log.debug("removeListener: Listener {}", listener);
         } else {
-            log.info("removeListener: Listener " + listener +  " not registered");
+            log.info("removeListener: Listener {} not registered", listener);
         }
 
         // deregister if no listener is registered anymore
@@ -179,8 +179,7 @@
             try {
                 String path= event.getPath();
                 if (matchPath(path)) {
-                    log.debug("onEvent: Listener Notification due to " +
-                        path);
+                    log.debug("onEvent: Listener Notification due to {}", path);
                     notifyListeners();
                     return;
                 }
@@ -245,12 +244,11 @@
     private void notifyListeners() {
         for (int i=0; i < listeners.size(); i++) {
             Listener listener = (Listener) listeners.get(i);
-            log.debug("notifyListeners: Notifying listener " + listener);
+            log.debug("notifyListeners: Notifying listener {}", listener);
             try {
                 listener.pathChanged();
             } catch (Exception e) {
-                log.warn("notifyListeners: Listener " + listener + " threw: " + e);
-                log.debug("dump", e);
+                log.warn("notifyListeners: Listener {} failed", listener, e);
             }
         }
     }

Modified: jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/DynamicRepositoryClassLoader.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/DynamicRepositoryClassLoader.java?view=diff&rev=514657&r1=514656&r2=514657
==============================================================================
--- jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/DynamicRepositoryClassLoader.java
(original)
+++ jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/DynamicRepositoryClassLoader.java
Mon Mar  5 04:26:38 2007
@@ -16,6 +16,7 @@
  */
 package org.apache.jackrabbit.classloader;
 
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
@@ -126,7 +127,7 @@
         // register with observation service and path pattern list
         registerModificationListener();
 
-        log.debug("DynamicRepositoryClassLoader: " + this + " ready");
+        log.debug("DynamicRepositoryClassLoader: {} ready", this);
     }
 
     /**
@@ -164,8 +165,9 @@
         // finally finalize the old class loader
         old.destroy();
 
-        log.debug("DynamicRepositoryClassLoader: Copied " + old + ". Do not use " +
-                "that anymore");
+        log.debug(
+            "DynamicRepositoryClassLoader: Copied {}. Do not use that anymore",
+            old);
     }
 
     /**
@@ -243,7 +245,7 @@
 
         ClassLoaderResource res = getCachedResource(name);
         if (res != null) {
-            log.debug("shouldReload: Expiring cache entry " + res);
+            log.debug("shouldReload: Expiring cache entry {}", res);
             if (force) {
                 log.debug("shouldReload: Forced dirty flag");
                 dirty = true;
@@ -328,7 +330,7 @@
      *      through the {@link #destroy()} method.
      */
     public DynamicRepositoryClassLoader reinstantiate(Session session, ClassLoader parent)
{
-        log.debug("reinstantiate: Copying " + this + " with parent " + parent);
+        log.debug("reinstantiate: Copying {} with parent {}", this, parent);
 
         if (isDestroyed()) {
             throw new IllegalStateException("Destroyed class loader cannot be recreated");
@@ -361,7 +363,10 @@
      *      characters which will be resolved to build the actual class path.
      */
     public void reconfigure(String[] classPath) {
-        log.debug("reconfigure: Reconfiguring the with " + classPath);
+        if (log.isDebugEnabled()) {
+            log.debug("reconfigure: Reconfiguring the with {}",
+                Arrays.asList(classPath));
+        }
 
         // whether the loader is destroyed
         if (isDestroyed()) {
@@ -378,8 +383,9 @@
         ((DynamicPatternPath) getHandles()).addListener(this);
 
         dirty = !hasLoadedResources();
-        log.debug("reconfigure: Class loader is dirty now: " +
-                (isDirty() ? "yes" : "no"));
+        log.debug("reconfigure: Class loader is dirty now: {}", (isDirty()
+                ? "yes"
+                : "no"));
     }
 
     //---------- RepositoryClassLoader overwrites -----------------------------
@@ -462,33 +468,34 @@
     public void onEvent(EventIterator events) {
         while (events.hasNext()) {
             Event event = events.nextEvent();
+            String path;
             try {
-                String path = event.getPath();
-                log.debug("onEvent: Item " + path + " has been modified, " +
-                        "checking with cache");
-
-                ClassLoaderResource resource =
-                    (ClassLoaderResource) modTimeCache.get(path);
-                if (resource != null) {
-                    log.debug("pageModified: Expiring cache entry "+ resource);
-                    expireResource(resource);
-                } else {
-                    // might be in not-found cache - remove from there
-                    if (event.getType() == Event.NODE_ADDED ||
-                            event.getType() == Event.PROPERTY_ADDED) {
-                        log.debug("pageModified: Clearing not-found cache " +
-                                "for possible new class");
-                        cleanCache();
-                    }
-                }
-
+                path = event.getPath();
             } catch (RepositoryException re) {
-                //
+                log.warn("onEvent: Cannot get path of event, ignoring", re);
+                continue;
             }
+                
+            log.debug(
+                "onEvent: Item {} has been modified, checking with cache", path);
+
+            ClassLoaderResource resource = (ClassLoaderResource) modTimeCache.get(path);
+            if (resource != null) {
+                log.debug("pageModified: Expiring cache entry {}", resource);
+                expireResource(resource);
+            } else {
+                // might be in not-found cache - remove from there
+                if (event.getType() == Event.NODE_ADDED
+                    || event.getType() == Event.PROPERTY_ADDED) {
+                    log.debug("pageModified: Clearing not-found cache for possible new class");
+                    cleanCache();
+                }
+            }
+
         }
     }
 
-    //----------- PatternPath.Listener interface -------------------------
+    // ----------- PatternPath.Listener interface -------------------------
 
     /**
      * Handles modified matched path set by setting the class loader dirty.
@@ -615,7 +622,7 @@
 
         // update dirty flag accordingly
         dirty |= exp;
-        log.debug("expireResource: Loader dirty: " + isDirty());
+        log.debug("expireResource: Loader dirty: {}", new Boolean(isDirty()));
 
         // return the expiry status
         return exp;
@@ -633,7 +640,7 @@
         if (oldClassPath != null) {
             for (int i=0; i < oldClassPath.length; i++) {
                 ClassPathEntry entry = oldClassPath[i];
-                log.debug("resetClassPathEntries: Cloning " + entry);
+                log.debug("resetClassPathEntries: Cloning {}", entry);
                 oldClassPath[i] = entry.copy();
             }
         } else {

Modified: jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/ExpandingArchiveClassPathEntry.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/ExpandingArchiveClassPathEntry.java?view=diff&rev=514657&r1=514656&r2=514657
==============================================================================
--- jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/ExpandingArchiveClassPathEntry.java
(original)
+++ jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/ExpandingArchiveClassPathEntry.java
Mon Mar  5 04:26:38 2007
@@ -155,13 +155,13 @@
                 };
             }
 
-            log.debug("getResource: resource " + name + " not found"
-                + " in archive " + path);
+            log.debug("getResource: resource {} not found in archive {}", name,
+                path);
 
         } catch (RepositoryException re) {
 
-            log.warn("getResource: problem accessing the archive " + path
-                + " for " + name + ": " + re.toString());
+            log.warn("getResource: problem accessing the archive {} for {}",
+                new Object[] { path, name }, re.toString());
 
         }
         // invariant : not found or problem accessing the archive
@@ -241,8 +241,8 @@
                 // rollback changes on the jar node in case of problems
                 if (jarNode != null && jarNode.isModified()) {
                     // rollback incomplete modifications
-                    log.warn("Rolling back unsaved changes on JAR node "
-                        + getPath());
+                    log.warn("Rolling back unsaved changes on JAR node {}",
+                        getPath());
 
                     try {
                         jarNode.refresh(false);

Modified: jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/NodeTypeSupport.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/NodeTypeSupport.java?view=diff&rev=514657&r1=514656&r2=514657
==============================================================================
--- jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/NodeTypeSupport.java
(original)
+++ jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/NodeTypeSupport.java
Mon Mar  5 04:26:38 2007
@@ -82,17 +82,17 @@
         try {
             NodeTypeManager ntm = workspace.getNodeTypeManager();
             if (ntm instanceof JackrabbitNodeTypeManager) {
-                log.debug("Using Jackrabbit to import node types from {0}",
-                    TYPE_FILE);
+                log.debug("Using Jackrabbit to import node types from "
+                    + TYPE_FILE);
                 JackrabbitNodeTypeManager jntm = (JackrabbitNodeTypeManager) ntm;
                 jntm.registerNodeTypes(ins,
                     JackrabbitNodeTypeManager.TEXT_X_JCR_CND);
                 return true;
             }
         } catch (IOException ioe) {
-            log.error("Cannot register node types from {0}", TYPE_FILE, ioe);
+            log.error("Cannot register node types from " + TYPE_FILE, ioe);
         } catch (RepositoryException re) {
-            log.error("Cannot register node types from {0}", TYPE_FILE, re);
+            log.error("Cannot register node types from " + TYPE_FILE, re);
         }
 
         // fall back to failure

Modified: jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/PatternPath.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/PatternPath.java?view=diff&rev=514657&r1=514656&r2=514657
==============================================================================
--- jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/PatternPath.java
(original)
+++ jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/PatternPath.java
Mon Mar  5 04:26:38 2007
@@ -235,7 +235,7 @@
                 pattern = pattern.substring(0, pattern.length()-1);
             }
 
-            log.debug("addChecked: Adding " + pattern);
+            log.debug("addChecked: Adding {}");
             patternList.add(pattern);
         }
     }

Modified: jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/RepositoryClassLoader.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/RepositoryClassLoader.java?view=diff&rev=514657&r1=514656&r2=514657
==============================================================================
--- jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/RepositoryClassLoader.java
(original)
+++ jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/RepositoryClassLoader.java
Mon Mar  5 04:26:38 2007
@@ -183,7 +183,7 @@
         // build the class repositories list
         buildRepository();
 
-        log.debug("RepositoryClassLoader: " + this + " ready");
+        log.debug("RepositoryClassLoader: {} ready", this);
     }
 
     /**
@@ -249,7 +249,7 @@
             throw new ClassNotFoundException(name + " (Classloader destroyed)");
         }
 
-        log.debug("findClass: Try to find class " + name);
+        log.debug("findClass: Try to find class {}", name);
 
         try {
             return (Class) AccessController
@@ -280,12 +280,12 @@
             return null;
         }
 
-        log.debug("findResource: Try to find resource " + name);
+        log.debug("findResource: Try to find resource {}", name);
 
         ClassLoaderResource res = findClassLoaderResource(name);
         if (res != null) {
-            log.debug("findResource: Getting resource from " + res + ", " +
-                "created " + new Date(res.getLastModificationTime()));
+            log.debug("findResource: Getting resource from {}, created {}",
+                res, new Date(res.getLastModificationTime()));
             return res.getURL();
         }
 
@@ -316,17 +316,17 @@
             };
         }
 
-        log.debug("findResources: Try to find resources for " + name);
+        log.debug("findResources: Try to find resources for {}", name);
 
         List list = new LinkedList();
         for (int i=0; i < repository.length; i++) {
             final ClassPathEntry cp = repository[i];
-            log.debug("findResources: Trying " + cp);
+            log.debug("findResources: Trying {}", cp);
 
             ClassLoaderResource res = cp.getResource(name);
             if (res != null) {
-                log.debug("findResources: Adding resource from " + res + ", " +
-                    "created " + new Date(res.getLastModificationTime()));
+                log.debug("findResources: Adding resource from {}, created {}",
+                    res, new Date(res.getLastModificationTime()));
                 URL url = res.getURL();
                 if (url != null) {
                     list.add(url);
@@ -385,7 +385,7 @@
 
         } else if (checkURL(url)) {
             // Repository URL
-            log.debug("addURL: Adding URL " + url);
+            log.debug("addURL: Adding URL {}", url);
             try {
                 JCRURLConnection conn = (JCRURLConnection) url.openConnection();
                 ClassPathEntry cp = ClassPathEntry.getInstance(
@@ -396,7 +396,7 @@
             }
 
         } else {
-            log.warn("addURL: " + url + " is not a Repository URL, ignored");
+            log.warn("addURL: {} is not a Repository URL, ignored", url);
         }
     }
 
@@ -418,12 +418,12 @@
             return;
         }
 
-        log.debug("addURL: Adding Handle " + path);
+        log.debug("addURL: Adding Handle {}", path);
         ClassPathEntry cp = ClassPathEntry.getInstance(session, path);
         if (cp != null) {
             addClassPathEntry(cp);
         } else {
-            log.debug("addHandle: Cannot get a ClassPathEntry for " + path);
+            log.debug("addHandle: Cannot get a ClassPathEntry for {}", path);
         }
     }
 
@@ -468,7 +468,7 @@
     /* package */ ClassLoaderResource getCachedResource(String name) {
         Object res = cache.get(name);
         if (res == null || res == NOT_FOUND_RESOURCE) {
-            log.debug("Resource " + name + " no cached");
+            log.debug("Resource {} not cached", name);
             return null;
         }
 
@@ -545,7 +545,7 @@
      * class path list with the new class path entry.
      */
     protected void addClassPathEntry(ClassPathEntry cpe) {
-        log.debug("addHandle: Adding path " + cpe.getPath());
+        log.debug("addHandle: Adding path {}", cpe.getPath());
 
         // append the entry to the current class path
         ClassPathEntry[] oldClassPath = getRepository();
@@ -648,10 +648,10 @@
             }
 
             if (cp != null) {
-                log.debug("Adding path " + entry);
+                log.debug("Adding path {}", entry);
                 newRepository.add(cp);
             } else {
-                log.debug("Cannot get a ClassPathEntry for " + entry);
+                log.debug("Cannot get a ClassPathEntry for {}", entry);
             }
         }
 
@@ -681,20 +681,21 @@
 
         // prepare the name of the class
         final String path = name.replace('.', '/').concat(".class");
-        log.debug("findClassPrivileged: Try to find path " + path +
-            " for class " + name);
+        log.debug("findClassPrivileged: Try to find path {} for class {}",
+            path, name);
 
         ClassLoaderResource res = findClassLoaderResource(path);
         if (res != null) {
 
              // try defining the class, error aborts
              try {
-                 log.debug("findClassPrivileged: Loading class from " +
-                     res + ", created " + new Date(res.getLastModificationTime()));
+                 log.debug(
+                    "findClassPrivileged: Loading class from {}, created {}",
+                    res, new Date(res.getLastModificationTime()));
 
                  Class c = defineClass(name, res);
                  if (c == null) {
-                     log.warn("defineClass returned null for class " + name);
+                     log.warn("defineClass returned null for class {}", name);
                      throw new ClassNotFoundException(name);
                  }
                  return c;
@@ -734,7 +735,7 @@
         // check for cached resources first
         ClassLoaderResource res = (ClassLoaderResource) cache.get(name);
         if (res == NOT_FOUND_RESOURCE) {
-            log.info("Resource '" + name + "' known to not exist in class path");
+            log.debug("Resource '{}' known to not exist in class path", name);
             return null;
         } else if (res != null) {
             return res;
@@ -743,19 +744,19 @@
         // walk the repository list and try to find the resource
         for (int i = 0; i < repository.length; i++) {
             final ClassPathEntry cp = repository[i];
-            log.debug("Checking " + cp);
+            log.debug("Checking {}", cp);
 
             res = cp.getResource(name);
             if (res != null) {
-                log.debug("Found resource in " + res + ", " +
-                    "created " + new Date(res.getLastModificationTime()));
+                log.debug("Found resource in {}, created ", res, new Date(
+                    res.getLastModificationTime()));
                 cache.put(name, res);
                 return res;
             }
 
         }
 
-        log.debug("No classpath entry contains " + name);
+        log.debug("No classpath entry contains {}", name);
         cache.put(name, NOT_FOUND_RESOURCE);
         return null;
     }
@@ -775,7 +776,7 @@
     private Class defineClass(String name, ClassLoaderResource res)
             throws IOException, RepositoryException {
 
-        log.debug("defineClass(" + name + ", " + res + ")");
+        log.debug("defineClass({}, {})", name, res);
 
         Class clazz = res.getLoadedClass();
         if (clazz == null) {

Modified: jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/Util.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/Util.java?view=diff&rev=514657&r1=514656&r2=514657
==============================================================================
--- jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/Util.java
(original)
+++ jackrabbit/trunk/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/Util.java
Mon Mar  5 04:26:38 2007
@@ -84,12 +84,12 @@
         // been thrown
         Property prop = (Property) item;
         if (prop.getDefinition().isMultiple()) {
-            log.error(prop.getPath() + " is a multivalue property");
+            log.error("{} is a multivalue property", prop.getPath());
             return null;
         } else if (prop.getType() == PropertyType.REFERENCE) {
             Node node = prop.getNode();
-            log.info("Property " + prop.getPath() + " refers to node " +
-                node.getPath() + "; finding primary item");
+            log.info("Property {} refers to node {}; finding primary item",
+                prop.getPath(), node.getPath());
             return getProperty(node);
         }
 

Modified: jackrabbit/trunk/contrib/classloader/src/test/java/org/apache/jackrabbit/classloader/ClassLoaderTestBase.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/classloader/src/test/java/org/apache/jackrabbit/classloader/ClassLoaderTestBase.java?view=diff&rev=514657&r1=514656&r2=514657
==============================================================================
--- jackrabbit/trunk/contrib/classloader/src/test/java/org/apache/jackrabbit/classloader/ClassLoaderTestBase.java
(original)
+++ jackrabbit/trunk/contrib/classloader/src/test/java/org/apache/jackrabbit/classloader/ClassLoaderTestBase.java
Mon Mar  5 04:26:38 2007
@@ -57,7 +57,7 @@
  * The <code>ClassLoaderTestBase</code> TODO
  *
  * @author fmeschbe
- * @version $Rev:$, $Date$
+ * @version $Rev$, $Date$
  */
 public class ClassLoaderTestBase extends TestCase {
 
@@ -283,7 +283,7 @@
 
                 session.getItem(path).remove();
             } catch (RepositoryException re) {
-                log.info("Cannot remove Item " + path + ": " + re);
+                log.info("Cannot remove Item " + path, re);
             }
         }
 

Modified: jackrabbit/trunk/contrib/classloader/src/test/java/org/apache/jackrabbit/classloader/ExpandingArchiveClassPathEntryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/classloader/src/test/java/org/apache/jackrabbit/classloader/ExpandingArchiveClassPathEntryTest.java?view=diff&rev=514657&r1=514656&r2=514657
==============================================================================
--- jackrabbit/trunk/contrib/classloader/src/test/java/org/apache/jackrabbit/classloader/ExpandingArchiveClassPathEntryTest.java
(original)
+++ jackrabbit/trunk/contrib/classloader/src/test/java/org/apache/jackrabbit/classloader/ExpandingArchiveClassPathEntryTest.java
Mon Mar  5 04:26:38 2007
@@ -91,11 +91,12 @@
         assertNotNull("anotherFile's URL missing", url);
 
         String data = new String(res.getBytes());
-        log.info("URL : " + url);
-        log.info("Path: " + res.getPath());
-        log.info("Prop: " + res.getProperty().getPath());
-        log.info("Data: '" + data + "'");
-        log.info("Size: " + res.getContentLength() + " (bytes: " + res.getBytes().length
+ ")");
-        log.info("Time: " + new Date(res.getLastModificationTime()));
+        log.info("URL : {}", url);
+        log.info("Path: {}", res.getPath());
+        log.info("Prop: {}", res.getProperty().getPath());
+        log.info("Data: '{}'", data);
+        log.info("Size: {} (bytes: {})", new Integer(res.getContentLength()),
+            new Integer(res.getBytes().length));
+        log.info("Time: {}", new Date(res.getLastModificationTime()));
     }
 }



Mime
View raw message