Author: boisvert
Date: Thu Mar 19 21:05:21 2009
New Revision: 756196

URL: http://svn.apache.org/viewvc?rev=756196&view=rev
Log:
ODE-558: Better error reporting if <forEach> is missing child <scope>

Modified:
    
ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/ForEachGenerator.java
    
ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/ForEachGeneratorMessages.java
    
ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/ForEachGenerator.java
    
ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/ForEachGeneratorMessages.java

Modified: 
ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/ForEachGenerator.java
URL: 
http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/ForEachGenerator.java?rev=756196&r1=756195&r2=756196&view=diff
==============================================================================
--- 
ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/ForEachGenerator.java
 (original)
+++ 
ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/ForEachGenerator.java
 Thu Mar 19 21:05:21 2009
@@ -65,6 +65,10 @@
 
         // ForEach 'adds' a counter variable in inner scope
         if (__log.isDebugEnabled()) __log.debug("Adding the forEach counter 
variable to inner scope.");
+        if (forEach.getChild() == null) {
+            throw new 
CompilationException(__cmsgs.errMissingScopeinForeach().setSource(forEach));
+        }
+
         Scope s = forEach.getChild().getScope();
         // Checking if a variable using the same name as our counter is 
already defined.
         // The spec requires a static analysis error to be thrown in that case.

Modified: 
ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/ForEachGeneratorMessages.java
URL: 
http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/ForEachGeneratorMessages.java?rev=756196&r1=756195&r2=756196&view=diff
==============================================================================
--- 
ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/ForEachGeneratorMessages.java
 (original)
+++ 
ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/ForEachGeneratorMessages.java
 Thu Mar 19 21:05:21 2009
@@ -30,4 +30,8 @@
             "variable named {0}, just like the forEach counterName.");
     }
 
+    public CompilationMessage errMissingScopeinForeach() {
+        return this.formatCompilationMessage("<forEach> activity requires a 
child <scope>");
+    }
+
 }

Modified: 
ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/ForEachGenerator.java
URL: 
http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/ForEachGenerator.java?rev=756196&r1=756195&r2=756196&view=diff
==============================================================================
--- 
ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/ForEachGenerator.java
 (original)
+++ 
ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/ForEachGenerator.java
 Thu Mar 19 21:05:21 2009
@@ -63,6 +63,10 @@
 
         // ForEach 'adds' a counter variable in inner scope
         if (__log.isDebugEnabled()) __log.debug("Adding the forEach counter 
variable to inner scope.");
+        if (forEach.getChild() == null) {
+            throw new 
CompilationException(__cmsgs.errMissingScopeinForeach().setSource(forEach));
+        }
+        
         Scope s = forEach.getChild().getScope();
         // Checking if a variable using the same name as our counter is 
already defined.
         // The spec requires a static analysis error to be thrown in that case.

Modified: 
ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/ForEachGeneratorMessages.java
URL: 
http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/ForEachGeneratorMessages.java?rev=756196&r1=756195&r2=756196&view=diff
==============================================================================
--- 
ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/ForEachGeneratorMessages.java
 (original)
+++ 
ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/ForEachGeneratorMessages.java
 Thu Mar 19 21:05:21 2009
@@ -30,4 +30,8 @@
             "variable named {0}, just like the forEach counterName.");
     }
 
+    public CompilationMessage errMissingScopeinForeach() {
+        return this.formatCompilationMessage("<forEach> activity requires a 
child <scope>");
+    }
+
 }


Reply via email to