You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2005/03/29 18:25:18 UTC

svn commit: r159385 - lenya/trunk/src/java/org/apache/lenya/cms/workflow/WorkflowManagerImpl.java

Author: andreas
Date: Tue Mar 29 08:25:16 2005
New Revision: 159385

URL: http://svn.apache.org/viewcvs?view=rev&rev=159385
Log:
don't delete non-existing workflow history

Modified:
    lenya/trunk/src/java/org/apache/lenya/cms/workflow/WorkflowManagerImpl.java

Modified: lenya/trunk/src/java/org/apache/lenya/cms/workflow/WorkflowManagerImpl.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/workflow/WorkflowManagerImpl.java?view=diff&r1=159384&r2=159385
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/workflow/WorkflowManagerImpl.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/workflow/WorkflowManagerImpl.java Tue Mar 29 08:25:16 2005
@@ -39,7 +39,8 @@
  * 
  * @version $Id:$
  */
-public class WorkflowManagerImpl extends AbstractLogEnabled implements WorkflowManager, Serviceable, Poolable {
+public class WorkflowManagerImpl extends AbstractLogEnabled implements WorkflowManager,
+        Serviceable, Poolable {
 
     /**
      * @see org.apache.lenya.cms.workflow.WorkflowManager#invoke(org.apache.lenya.cms.publication.Document,
@@ -59,7 +60,7 @@
                             + "] in the situation [" + situation + "]");
                 }
                 engine.invoke(document, workflow, situation, event);
-                
+
                 ((DefaultDocument) document).getHistory().save();
             }
         } catch (ServiceException e) {
@@ -172,12 +173,12 @@
         try {
             resolver = (WorkflowResolver) this.manager.lookup(WorkflowResolver.ROLE);
             if (resolver.hasWorkflow(source)) {
-                
+
                 sourceResolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
-                
+
                 String sourceUri = ((DefaultDocument) source).getHistorySourceURI();
                 sourceHistory = sourceResolver.resolveURI(sourceUri);
-                
+
                 if (sourceHistory.exists()) {
                     String targetUri = ((DefaultDocument) target).getHistorySourceURI();
                     targetHistory = sourceResolver.resolveURI(targetUri);
@@ -225,7 +226,9 @@
                 sourceResolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
                 String uri = ((DefaultDocument) sourceDocument).getHistorySourceURI();
                 historySource = sourceResolver.resolveURI(uri);
-                ((ModifiableSource) historySource).delete();
+                if (historySource.exists()) {
+                    ((ModifiableSource) historySource).delete();
+                }
             }
         } catch (Exception e) {
             throw new WorkflowException(e);
@@ -242,4 +245,4 @@
         }
     }
 
-}
+}
\ No newline at end of file



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org