incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r634621 - /incubator/sling/trunk/jcr/base/src/main/java/org/apache/sling/jcr/base/AbstractSlingRepository.java
Date Fri, 07 Mar 2008 11:46:56 GMT
Author: bdelacretaz
Date: Fri Mar  7 03:46:53 2008
New Revision: 634621

URL: http://svn.apache.org/viewvc?rev=634621&view=rev
Log:
SLING-310 - log() could throw NPE when componentContext is null

Modified:
    incubator/sling/trunk/jcr/base/src/main/java/org/apache/sling/jcr/base/AbstractSlingRepository.java

Modified: incubator/sling/trunk/jcr/base/src/main/java/org/apache/sling/jcr/base/AbstractSlingRepository.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/base/src/main/java/org/apache/sling/jcr/base/AbstractSlingRepository.java?rev=634621&r1=634620&r2=634621&view=diff
==============================================================================
--- incubator/sling/trunk/jcr/base/src/main/java/org/apache/sling/jcr/base/AbstractSlingRepository.java
(original)
+++ incubator/sling/trunk/jcr/base/src/main/java/org/apache/sling/jcr/base/AbstractSlingRepository.java
Fri Mar  7 03:46:53 2008
@@ -323,8 +323,11 @@
     protected void log(int level, String message, Throwable t) {
         LogService log = this.log;
         if (log != null) {
-            log.log(this.componentContext.getServiceReference(), level,
-                message, t);
+            if(componentContext != null) {
+                log.log(componentContext.getServiceReference(), level, message, t);
+            } else {
+                log.log(level, message, t);
+            }
         }
     }
 
@@ -725,7 +728,7 @@
                     setupRepository(newRepo);
                     log(LogService.LOG_INFO, "startRepository: calling registerService()");
                     repositoryService = registerService();
-                    log(LogService.LOG_INFO, "registerService() successful");
+                    log(LogService.LOG_INFO, "registerService() successful, registration="
+ repositoryService);
 
                     return true;
                 }
@@ -751,6 +754,7 @@
     private void stopRepository() {
         if (repositoryService != null) {
             try {
+                log(LogService.LOG_INFO, "Unregistering SlingRepository service, registration="
+ repositoryService);
                 unregisterService(repositoryService);
             } catch (Throwable t) {
                 log(



Mime
View raw message