SLING-2732 :   NPE when getting new repository class loader 

git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/classloader@1446256 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/sling/jcr/classloader/internal/ClassLoaderWriterImpl.java b/src/main/java/org/apache/sling/jcr/classloader/internal/ClassLoaderWriterImpl.java
index 1f4c417..5a4c421 100644
--- a/src/main/java/org/apache/sling/jcr/classloader/internal/ClassLoaderWriterImpl.java
+++ b/src/main/java/org/apache/sling/jcr/classloader/internal/ClassLoaderWriterImpl.java
@@ -77,7 +77,6 @@
     @org.apache.felix.scr.annotations.Property(value=CLASS_PATH_DEFAULT)
     private static final String CLASS_PATH_PROP = "classpath";
 
-
     /** Node type for packages/folders. */
     private static final String NT_FOLDER = "nt:folder";
 
@@ -87,15 +86,16 @@
     @org.apache.felix.scr.annotations.Property(value=OWNER_DEFAULT)
     private static final String OWNER_PROP = "owner";
 
-    /** The owner of the class loader / jcr user. */
-    private String classLoaderOwner;
 
-    @Reference
-    private SlingRepository repository;
+    /** The owner of the class loader / JCR user. */
+    private String classLoaderOwner;
 
     /** The configured class path. */
     private String classPath;
 
+    @Reference
+    private SlingRepository repository;
+
     @Reference(policy=ReferencePolicy.DYNAMIC, cardinality=ReferenceCardinality.OPTIONAL_UNARY)
     private MimeTypeService mimeTypeService;
 
@@ -113,7 +113,8 @@
 
     /**
      * Activate this component.
-     * @param props The configuration properties
+     * @param componentContext The component context
+     * @param properties The configuration properties
      */
     @Activate
     protected void activate(final ComponentContext componentContext, final Map<String, Object> properties) {
@@ -151,7 +152,7 @@
     }
 
     /**
-     * Called to handle unbinding the DynamicClassLoaderManager service
+     * Called to handle unbinding of the DynamicClassLoaderManager service
      * reference
      */
     @SuppressWarnings("unused")
@@ -180,7 +181,7 @@
      * Return a new session.
      */
     public Session createSession() throws RepositoryException {
-        // get an administrative session for potentiall impersonation
+        // get an administrative session for potential impersonation
         final Session admin = this.repository.loginAdministrative(null);
 
         // do use the admin session, if the admin's user id is the same as owner
@@ -280,18 +281,18 @@
             }
         }
 
-        // fallback to false in case of error or non-existence of oldFileName
+        // fall back to false in case of error or non-existence of oldFileName
         return false;
     }
 
     /**
      * Creates a folder hierarchy in the repository.
-     * We synchronize this method to reduce potential conflics.
+     * We synchronize this method to reduce potential conflicts.
      * Although each write uses its own session it might occur
      * that more than one session tries to create the same path
      * (or parent path) at the same time. By synchronizing this
      * we avoid this situation - however this method is written
-     * in a failsafe manner anyway.
+     * in a fail safe manner anyway.
      */
     private synchronized boolean mkdirs(final Session session, final String path) {
         try {
@@ -511,7 +512,7 @@
             }
         }
 
-        // fallback to "non-existant" in case of problems
+        // fall back to "non-existent" in case of problems
         return -1;
     }