Author: mattmann
Date: Mon Nov  7 05:48:41 2011
New Revision: 1198626

URL: http://svn.apache.org/viewvc?rev=1198626&view=rev
Log:
- fix for OODT-344 Workflow Conditions and Timeout Seconds causes backwards 
incompat SerDe issues with XML-RPC

Modified:
    oodt/trunk/CHANGES.txt
    
oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/util/XmlRpcStructFactory.java

Modified: oodt/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/oodt/trunk/CHANGES.txt?rev=1198626&r1=1198625&r2=1198626&view=diff
==============================================================================
--- oodt/trunk/CHANGES.txt (original)
+++ oodt/trunk/CHANGES.txt Mon Nov  7 05:48:41 2011
@@ -4,6 +4,9 @@ Apache OODT Change Log
 Release 0.4: Current Development
 --------------------------------------------
 
+* OODT-344 Workflow Conditions and Timeout Seconds causes 
+  backwards incompat SerDe issues with XML-RPC (mattmann)
+
 * OODT-330 Factor out command line utility from oodt-commons
     - check in CAS-CLI... integration to other components to come (bfoster)
 

Modified: 
oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/util/XmlRpcStructFactory.java
URL: 
http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/util/XmlRpcStructFactory.java?rev=1198626&r1=1198625&r2=1198626&view=diff
==============================================================================
--- 
oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/util/XmlRpcStructFactory.java
 (original)
+++ 
oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/util/XmlRpcStructFactory.java
 Mon Nov  7 05:48:41 2011
@@ -129,10 +129,10 @@ public final class XmlRpcStructFactory {
     workflowInstance.put("sharedContext",
         wInst.getSharedContext() != null ? wInst.getSharedContext()
             .getHashtable() : new Hashtable());
-    workflowInstance.put("priority", 
-        wInst.getPriority() != null ? 
-            String.valueOf(wInst.getPriority().getValue()):
-              String.valueOf(Priority.getDefault().getValue()));
+    workflowInstance.put(
+        "priority",
+        wInst.getPriority() != null ? String.valueOf(wInst.getPriority()
+            .getValue()) : String.valueOf(Priority.getDefault().getValue()));
     return workflowInstance;
   }
 
@@ -491,7 +491,9 @@ public final class XmlRpcStructFactory {
     condition.setConditionId((String) cond.get("id"));
     condition.setConditionName((String) cond.get("name"));
     condition.setOrder(Integer.valueOf((String) cond.get("order")).intValue());
-    condition.setTimeoutSeconds(Long.valueOf((String) cond.get("timeout")));
+    condition
+        .setTimeoutSeconds(Long.valueOf(cond.get("timeout") != null ? (String) 
cond
+            .get("timeout") : "-1"));
     condition.setOptional(Boolean.valueOf((String) cond.get("optional")));
     condition
         .setCondConfig(getWorkflowConditionConfigurationFromXmlRpc((Hashtable) 
cond
@@ -531,10 +533,12 @@ public final class XmlRpcStructFactory {
   public static List getWorkflowConditionsFromXmlRpc(Vector conds) {
     List conditions = new Vector();
 
-    for (Iterator i = conds.iterator(); i.hasNext();) {
-      Hashtable cond = (Hashtable) i.next();
-      WorkflowCondition condition = getWorkflowConditionFromXmlRpc(cond);
-      conditions.add(condition);
+    if (conds != null && conds.size() > 0) {
+      for (Iterator i = conds.iterator(); i.hasNext();) {
+        Hashtable cond = (Hashtable) i.next();
+        WorkflowCondition condition = getWorkflowConditionFromXmlRpc(cond);
+        conditions.add(condition);
+      }
     }
 
     return conditions;


Reply via email to