You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2010/01/13 09:48:57 UTC

svn commit: r898683 - /sling/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/ScriptHelper.java

Author: cziegeler
Date: Wed Jan 13 08:48:57 2010
New Revision: 898683

URL: http://svn.apache.org/viewvc?rev=898683&view=rev
Log:
Only add reference if service is not null.

Modified:
    sling/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/ScriptHelper.java

Modified: sling/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/ScriptHelper.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/ScriptHelper.java?rev=898683&r1=898682&r2=898683&view=diff
==============================================================================
--- sling/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/ScriptHelper.java (original)
+++ sling/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/ScriptHelper.java Wed Jan 13 08:48:57 2010
@@ -119,7 +119,7 @@
     public void include(String path, RequestDispatcherOptions options) {
         final RequestDispatcher dispatcher = getRequest().getRequestDispatcher(
             path, options);
-        
+
         if (dispatcher != null) {
             try {
                 dispatcher.include(getRequest(), getResponse());
@@ -130,7 +130,7 @@
             }
         }
     }
-    
+
     /** Forward the request to another resource, using no options */
     public void forward(String path) {
         forward(path, (RequestDispatcherOptions) null);
@@ -166,9 +166,11 @@
         if (service == null) {
             final ServiceReference ref = this.bundleContext.getServiceReference(type.getName());
             if (ref != null) {
-                this.references.add(ref);
                 service = (ServiceType) this.bundleContext.getService(ref);
-                this.services.put(type.getName(), service);
+                if ( service != null ) {
+                    this.references.add(ref);
+                    this.services.put(type.getName(), service);
+                }
             }
         }
         return service;