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/02/14 11:20:08 UTC

svn commit: r153764 - lenya/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/WorkflowModule.java

Author: andreas
Date: Mon Feb 14 02:20:05 2005
New Revision: 153764

URL: http://svn.apache.org/viewcvs?view=rev&rev=153764
Log:
check if URL represents document before resolving workflow

Modified:
    lenya/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/WorkflowModule.java

Modified: lenya/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/WorkflowModule.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/WorkflowModule.java?view=diff&r1=153763&r2=153764
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/WorkflowModule.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/WorkflowModule.java Mon Feb 14 02:20:05 2005
@@ -64,23 +64,24 @@
         try {
             PageEnvelope envelope = getEnvelope(objectModel);
             Document document = envelope.getDocument();
-
-            resolver = (WorkflowResolver) this.manager.lookup(WorkflowResolver.ROLE);
-            if (resolver.hasWorkflow(document)) {
-                WorkflowInstance instance = resolver.getWorkflowInstance(document);
-                if (name.equals(STATE)) {
-                    value = instance.getCurrentState().toString();
-                } else if (name.startsWith(VARIABLE_PREFIX)) {
-                    String variableName = name.substring(VARIABLE_PREFIX.length());
-                    String[] variableNames = instance.getWorkflow().getVariableNames();
-                    if (Arrays.asList(variableNames).contains(variableName)) {
-                        value = Boolean.valueOf(instance.getValue(variableName));
+            if (document != null) {
+                resolver = (WorkflowResolver) this.manager.lookup(WorkflowResolver.ROLE);
+                if (resolver.hasWorkflow(document)) {
+                    WorkflowInstance instance = resolver.getWorkflowInstance(document);
+                    if (name.equals(STATE)) {
+                        value = instance.getCurrentState().toString();
+                    } else if (name.startsWith(VARIABLE_PREFIX)) {
+                        String variableName = name.substring(VARIABLE_PREFIX.length());
+                        String[] variableNames = instance.getWorkflow().getVariableNames();
+                        if (Arrays.asList(variableNames).contains(variableName)) {
+                            value = Boolean.valueOf(instance.getValue(variableName));
+                        }
+                    } else if (name.equals(HISTORY_PATH)) {
+                        value = ((CMSHistory) instance.getHistory()).getHistoryPath();
+                    } else {
+                        throw new ConfigurationException("The attribute [" + name
+                                + "] is not supported!");
                     }
-                } else if (name.equals(HISTORY_PATH)) {
-                    value = ((CMSHistory) instance.getHistory()).getHistoryPath();
-                } else {
-                    throw new ConfigurationException("The attribute [" + name
-                            + "] is not supported!");
                 }
             }
         } catch (ConfigurationException e) {



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