incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r898683 - /sling/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/ScriptHelper.java
Date Wed, 13 Jan 2010 08:48:57 GMT
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;



Mime
View raw message