incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r691695 - /incubator/sling/trunk/extensions/event/src/main/java/org/apache/sling/event/impl/TimedJobHandler.java
Date Wed, 03 Sep 2008 17:35:24 GMT
Author: cziegeler
Date: Wed Sep  3 10:35:23 2008
New Revision: 691695

URL: http://svn.apache.org/viewvc?rev=691695&view=rev
Log:
Fix cancel job.

Modified:
    incubator/sling/trunk/extensions/event/src/main/java/org/apache/sling/event/impl/TimedJobHandler.java

Modified: incubator/sling/trunk/extensions/event/src/main/java/org/apache/sling/event/impl/TimedJobHandler.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/extensions/event/src/main/java/org/apache/sling/event/impl/TimedJobHandler.java?rev=691695&r1=691694&r2=691695&view=diff
==============================================================================
--- incubator/sling/trunk/extensions/event/src/main/java/org/apache/sling/event/impl/TimedJobHandler.java
(original)
+++ incubator/sling/trunk/extensions/event/src/main/java/org/apache/sling/event/impl/TimedJobHandler.java
Wed Sep  3 10:35:23 2008
@@ -33,6 +33,7 @@
 import java.util.NoSuchElementException;
 import java.util.Set;
 
+import javax.jcr.Item;
 import javax.jcr.Node;
 import javax.jcr.NodeIterator;
 import javax.jcr.RepositoryException;
@@ -740,15 +741,12 @@
     public void cancelTimedEvent(String jobId) {
         synchronized ( this.writerSession ) {
             try {
-                // get parent node
-                final Node parentNode = (Node)this.writerSession.getItem(this.repositoryPath);
-                final String nodeName = jobId;
-
                 // is there a node?
-                final Node foundNode = parentNode.hasNode(nodeName) ? parentNode.getNode(nodeName)
: null;
+                final Item foundNode = this.writerSession.itemExists(jobId) ? this.writerSession.getItem(jobId)
: null;
                 // we should remove the node from the repository
                 // if there is no node someone else was faster and we can ignore this
                 if ( foundNode != null ) {
+                    final Node parentNode = foundNode.getParent();
                     try {
                         foundNode.remove();
                         parentNode.save();



Mime
View raw message