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/07 11:02:59 UTC

svn commit: r896827 - /sling/trunk/bundles/commons/scheduler/src/main/java/org/apache/sling/commons/scheduler/impl/QuartzScheduler.java

Author: cziegeler
Date: Thu Jan  7 10:02:24 2010
New Revision: 896827

URL: http://svn.apache.org/viewvc?rev=896827&view=rev
Log:
SLING-1275 : Return value of ComponentContext#locateContext should be checked for null value

Modified:
    sling/trunk/bundles/commons/scheduler/src/main/java/org/apache/sling/commons/scheduler/impl/QuartzScheduler.java

Modified: sling/trunk/bundles/commons/scheduler/src/main/java/org/apache/sling/commons/scheduler/impl/QuartzScheduler.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/scheduler/src/main/java/org/apache/sling/commons/scheduler/impl/QuartzScheduler.java?rev=896827&r1=896826&r2=896827&view=diff
==============================================================================
--- sling/trunk/bundles/commons/scheduler/src/main/java/org/apache/sling/commons/scheduler/impl/QuartzScheduler.java (original)
+++ sling/trunk/bundles/commons/scheduler/src/main/java/org/apache/sling/commons/scheduler/impl/QuartzScheduler.java Thu Jan  7 10:02:24 2010
@@ -464,10 +464,10 @@
         // called in the meantime
         final ComponentContext ctx = this.context;
         if ( ctx != null ) {
-            try {
-                final Object job = ctx.locateService(type, ref);
-                if ( ref != null ) {
-                    this.checkJob(job);
+            final Object job = ctx.locateService(type, ref);
+            if ( job != null ) {
+                this.checkJob(job);
+                try {
                     final String name = getServiceIdentifier(ref);
                     final Boolean concurrent = (Boolean)ref.getProperty(Scheduler.PROPERTY_SCHEDULER_CONCURRENT);
                     final String expression = (String)ref.getProperty(Scheduler.PROPERTY_SCHEDULER_EXPRESSION);
@@ -479,11 +479,11 @@
                             this.addPeriodicJob(name, job, null, period, (concurrent != null ? concurrent : true));
                         }
                     }
+                } catch (IllegalStateException e) {
+                    // this can happen if deactivate has been called - therefore ignoring
+                } catch (SchedulerException e) {
+                    // this can happen if deactivate has been called - therefore ignoring
                 }
-            } catch (IllegalStateException e) {
-                // this can happen if deactivate has been called - therefore ignoring
-            } catch (SchedulerException e) {
-                // this can happen if deactivate has been called - therefore ignoring
             }
         }
     }