You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by mr...@apache.org on 2009/01/19 18:43:05 UTC

svn commit: r735755 - in /ode/branches/APACHE_ODE_1.X/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/migration: CorrelationKeyMigration.java CorrelationKeySetMigration.java

Author: mriou
Date: Mon Jan 19 09:43:05 2009
New Revision: 735755

URL: http://svn.apache.org/viewvc?rev=735755&view=rev
Log:
Making the migration a little more robust by ignoring null values (even when they shouldn't be).

Modified:
    ode/branches/APACHE_ODE_1.X/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/migration/CorrelationKeyMigration.java
    ode/branches/APACHE_ODE_1.X/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/migration/CorrelationKeySetMigration.java

Modified: ode/branches/APACHE_ODE_1.X/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/migration/CorrelationKeyMigration.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/migration/CorrelationKeyMigration.java?rev=735755&r1=735754&r2=735755&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/migration/CorrelationKeyMigration.java (original)
+++ ode/branches/APACHE_ODE_1.X/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/migration/CorrelationKeyMigration.java Mon Jan 19 09:43:05 2009
@@ -35,12 +35,15 @@
         for (CorrelationSetDAO cset : csets) {
             CorrelationKey ckey = cset.getValue();
             instances.put(cset.getInstance().getInstanceId(), cset.getInstance());
-            Integer ckeyInt = asInt(ckey.getCorrelationSetName());
-            if (ckeyInt != null) {
-                OScope.CorrelationSet ocset = findCorrelationById(ckeyInt, registeredProcesses, cset.getProcess().getProcessId());
-                if (ocset == null) __log.debug("Correlation set not found, couldn't upgrade set " + ckey.toCanonicalString());
-                else {
-                    cset.setValue(null, new CorrelationKey(ocset.name, ckey.getValues()));
+            if (ckey != null) {
+                __log.debug("Correlation set id " + cset.getCorrelationSetId() + " key " + ckey);
+                Integer ckeyInt = asInt(ckey.getCorrelationSetName());
+                if (ckeyInt != null) {
+                    OScope.CorrelationSet ocset = findCorrelationById(ckeyInt, registeredProcesses, cset.getProcess().getProcessId());
+                    if (ocset == null) __log.debug("Correlation set not found, couldn't upgrade set " + ckey.toCanonicalString());
+                    else {
+                        cset.setValue(null, new CorrelationKey(ocset.name, ckey.getValues()));
+                    }
                 }
             }
         }
@@ -59,24 +62,28 @@
                             // Changing all routes
                             for (MessageRouteDAO routeDAO : corr.getAllRoutes()) {
                                 CorrelationKey oldKey = routeDAO.getCorrelationKey();
-                                Integer ckeyInt = asInt(oldKey.getCorrelationSetName());
-                                if (ckeyInt != null) {
-                                    OScope.CorrelationSet ocset = findCorrelationById(ckeyInt, registeredProcesses, process.getConf().getProcessId());
-                                    if (ocset == null) __log.debug("Correlation set not found, couldn't upgrade route " + oldKey.toCanonicalString());
-                                    else {
-                                        routeDAO.setCorrelationKey(new CorrelationKey(ocset.name, oldKey.getValues()));
+                                if (oldKey != null) {
+                                    Integer ckeyInt = asInt(oldKey.getCorrelationSetName());
+                                    if (ckeyInt != null) {
+                                        OScope.CorrelationSet ocset = findCorrelationById(ckeyInt, registeredProcesses, process.getConf().getProcessId());
+                                        if (ocset == null) __log.debug("Correlation set not found, couldn't upgrade route " + oldKey.toCanonicalString());
+                                        else {
+                                            routeDAO.setCorrelationKey(new CorrelationKey(ocset.name, oldKey.getValues()));
+                                        }
                                     }
                                 }
                             }
                             // Changing all queued messages
                             for (CorrelatorMessageDAO corrMsgDAO : corr.getAllMessages()) {
                                 CorrelationKey oldKey = corrMsgDAO.getCorrelationKey();
-                                Integer ckeyInt = asInt(oldKey.getCorrelationSetName());
-                                if (ckeyInt != null) {
-                                    OScope.CorrelationSet ocset = findCorrelationById(ckeyInt, registeredProcesses, process.getConf().getProcessId());
-                                    if (ocset == null) __log.debug("Correlation set not found, couldn't upgrade route " + oldKey.toCanonicalString());
-                                    else {
-                                        corrMsgDAO.setCorrelationKey(new CorrelationKey(ocset.name, oldKey.getValues()));
+                                if (oldKey != null) {
+                                    Integer ckeyInt = asInt(oldKey.getCorrelationSetName());
+                                    if (ckeyInt != null) {
+                                        OScope.CorrelationSet ocset = findCorrelationById(ckeyInt, registeredProcesses, process.getConf().getProcessId());
+                                        if (ocset == null) __log.debug("Correlation set not found, couldn't upgrade route " + oldKey.toCanonicalString());
+                                        else {
+                                            corrMsgDAO.setCorrelationKey(new CorrelationKey(ocset.name, oldKey.getValues()));
+                                        }
                                     }
                                 }
                             }

Modified: ode/branches/APACHE_ODE_1.X/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/migration/CorrelationKeySetMigration.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/migration/CorrelationKeySetMigration.java?rev=735755&r1=735754&r2=735755&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/migration/CorrelationKeySetMigration.java (original)
+++ ode/branches/APACHE_ODE_1.X/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/migration/CorrelationKeySetMigration.java Mon Jan 19 09:43:05 2009
@@ -59,6 +59,7 @@
         ExecutionQueueImpl soup;
         try {
             soup = readOldState(instance, oproc, getClass().getClassLoader(), true);
+            if (soup == null) return false;
         } catch (Exception e) {
             __log.debug("  failed to read a v1 state for instance " + instance.getInstanceId());
             ExecutionQueueImpl._classDescriptors.clear();
@@ -96,6 +97,7 @@
         ExecutionQueueImpl soup;
         try {
             soup = readOldState(instance, oproc, getClass().getClassLoader(), false);
+            if (soup == null) return false;
         } catch (Exception e) {
             __log.debug("  failed to read a v2 state for instance " + instance.getInstanceId());
             ExecutionQueueImpl._classDescriptors.clear();
@@ -126,6 +128,7 @@
 
     private ExecutionQueueImpl readOldState(ProcessInstanceDAO instance, OProcess oprocess,
                                             ClassLoader cl, boolean changeKey) {
+        if (instance.getExecutionState() == null) return null;
         try {
             ExecutionQueueImpl soup = new ExecutionQueueImpl(cl);
             ObjectStreamClass osc;