You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bd...@apache.org on 2008/03/07 12:46:56 UTC
svn commit: r634621 -
/incubator/sling/trunk/jcr/base/src/main/java/org/apache/sling/jcr/base/AbstractSlingRepository.java
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(