Author: rr
Date: Fri May  7 19:00:45 2010
New Revision: 942180

URL: http://svn.apache.org/viewvc?rev=942180&view=rev
Log:
ODE-797: FindBugs Patches for bpel-compiler, thanks to David Carver

Modified:
    
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java
    
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/InvokeActivity.java
    
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Scope.java
    
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xpath20/compiler/JaxpFunctionResolver.java
    
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xpath20/compiler/OdeXPathFunctionLibrary.java
    
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xpath20/compiler/SaxonContext.java
    
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xquery10/compiler/XQuery10BpelFunctions.java
    
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xquery10/compiler/XQuery10ExpressionCompilerImpl.java

Modified: 
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java?rev=942180&r1=942179&r2=942180&view=diff
==============================================================================
--- 
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java
 (original)
+++ 
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java
 Fri May  7 19:00:45 2010
@@ -302,7 +302,7 @@ public abstract class BpelCompiler imple
         }
         // A "real" variable couldn't be found, checking if we're dealing with 
a
         // process custom property
-        if (_customProcessProperties != null && 
_customProcessProperties.get(varName) != null) {
+        if (_customProcessProperties != null && 
_customProcessProperties.get(QName.valueOf(varName)) != null) {
 
         }
         throw new CompilationException(__cmsgs.errUndeclaredVariable(varName));
@@ -1074,7 +1074,7 @@ public abstract class BpelCompiler imple
                 oplink.myRoleName = myRole.getName();
                 QName portType = myRole.getPortType();
                 if (portType == null)
-                    throw new 
CompilationException(__cmsgs.errMissingMyRolePortType(portType, 
plink.getMyRole(), plinkType.getName()));
+                    throw new 
CompilationException(__cmsgs.errMissingMyRolePortType(myRole.getPortType(), 
plink.getMyRole(), plinkType.getName()));
                 oplink.myRolePortType = resolvePortType(portType);
             }
 
@@ -1089,7 +1089,7 @@ public abstract class BpelCompiler imple
                 oplink.partnerRoleName = partnerRole.getName();
                 QName portType = partnerRole.getPortType();
                 if (portType == null)
-                    throw new 
CompilationException(__cmsgs.errMissingPartnerRolePortType(portType, 
plink.getPartnerRole(), plinkType.getName()));
+                    throw new 
CompilationException(__cmsgs.errMissingPartnerRolePortType(partnerRole.getPortType(),
 plink.getPartnerRole(), plinkType.getName()));
                 oplink.partnerRolePortType = resolvePortType(portType);
             }
 

Modified: 
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/InvokeActivity.java
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/InvokeActivity.java?rev=942180&r1=942179&r2=942180&view=diff
==============================================================================
--- 
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/InvokeActivity.java
 (original)
+++ 
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/InvokeActivity.java
 Fri May  7 19:00:45 2010
@@ -86,7 +86,7 @@ public class InvokeActivity extends Scop
      * @author mszefler
      *
      */
-    class BastardScope extends Scope {
+    static class BastardScope extends Scope {
 
         public BastardScope(Element el) {
             super(el);

Modified: 
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Scope.java
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Scope.java?rev=942180&r1=942179&r2=942180&view=diff
==============================================================================
--- 
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Scope.java
 (original)
+++ 
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Scope.java
 Fri May  7 19:00:45 2010
@@ -160,7 +160,7 @@ public class Scope extends JoinFailureSu
             return Boolean.TRUE;
         if ("no".equals(value))
             return Boolean.FALSE;
-        return null;
+        return Boolean.FALSE;
     }
 
     /**

Modified: 
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xpath20/compiler/JaxpFunctionResolver.java
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xpath20/compiler/JaxpFunctionResolver.java?rev=942180&r1=942179&r2=942180&view=diff
==============================================================================
--- 
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xpath20/compiler/JaxpFunctionResolver.java
 (original)
+++ 
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xpath20/compiler/JaxpFunctionResolver.java
 Fri May  7 19:00:45 2010
@@ -167,7 +167,7 @@ public class JaxpFunctionResolver implem
     /**
      * Compile time checking for the non standard ode:splitToElements function.
      */
-    public class SplitToElements implements XPathFunction {
+    public static class SplitToElements implements XPathFunction {
         public Object evaluate(List params) throws XPathFunctionException {
             if (params.size() < 3 || params.size() > 4) {
                 throw new CompilationException(
@@ -205,7 +205,7 @@ public class JaxpFunctionResolver implem
         }
     }
     
-    public class InsertInto implements XPathFunction {
+    public static class InsertInto implements XPathFunction {
        public Object evaluate(List args) throws XPathFunctionException {
             if (args.size() != 3) {
                 throw new 
CompilationException(__msgs.errInvalidNumberOfArguments(Constants.NON_STDRD_FUNCTION_INSERT_AFTER));
@@ -214,7 +214,7 @@ public class JaxpFunctionResolver implem
        }
     }
     
-    public class InsertAfter implements XPathFunction {
+    public static class InsertAfter implements XPathFunction {
        public Object evaluate(List args) throws XPathFunctionException {
             if (args.size() < 2 || args.size() > 3) {
                 throw new 
CompilationException(__msgs.errInvalidNumberOfArguments(Constants.NON_STDRD_FUNCTION_INSERT_AFTER));
@@ -223,7 +223,7 @@ public class JaxpFunctionResolver implem
        }
     }
     
-    public class InsertBefore implements XPathFunction {
+    public static class InsertBefore implements XPathFunction {
        public Object evaluate(List args) throws XPathFunctionException {
             if (args.size() < 2 || args.size() > 3) {
                 throw new 
CompilationException(__msgs.errInvalidNumberOfArguments(Constants.NON_STDRD_FUNCTION_INSERT_BEFORE));
@@ -232,7 +232,7 @@ public class JaxpFunctionResolver implem
        }
     }
 
-    public class InsertAsFirstInto implements XPathFunction {
+    public static class InsertAsFirstInto implements XPathFunction {
        public Object evaluate(List args) throws XPathFunctionException {
             if (args.size() != 2) {
                 throw new 
CompilationException(__msgs.errInvalidNumberOfArguments(Constants.NON_STDRD_FUNCTION_INSERT_AS_FIRST_INTO));
@@ -241,7 +241,7 @@ public class JaxpFunctionResolver implem
        }
     }
 
-    public class InsertAsLastInto implements XPathFunction {
+    public static class InsertAsLastInto implements XPathFunction {
        public Object evaluate(List args) throws XPathFunctionException {
             if (args.size() != 2) {
                 throw new 
CompilationException(__msgs.errInvalidNumberOfArguments(Constants.NON_STDRD_FUNCTION_INSERT_AS_LAST_INTO));
@@ -250,7 +250,7 @@ public class JaxpFunctionResolver implem
        }
     }
 
-    public class Delete implements XPathFunction {
+    public static class Delete implements XPathFunction {
        public Object evaluate(List args) throws XPathFunctionException {
             if (args.size() < 1 || args.size() > 2) {
                 throw new 
CompilationException(__msgs.errInvalidNumberOfArguments(Constants.NON_STDRD_FUNCTION_DELETE));
@@ -259,7 +259,7 @@ public class JaxpFunctionResolver implem
        }
     }
     
-    public class Rename implements XPathFunction {
+    public static class Rename implements XPathFunction {
        public Object evaluate(List args) throws XPathFunctionException {
             if (args.size() < 2) {
                 throw new 
CompilationException(__msgs.errInvalidNumberOfArguments(Constants.NON_STDRD_FUNCTION_RENAME));
@@ -268,7 +268,7 @@ public class JaxpFunctionResolver implem
        }
     }
     
-    public class ProcessProperty implements XPathFunction {
+    public static class ProcessProperty implements XPathFunction {
        public Object evaluate(List args) throws XPathFunctionException {
             if (args.size() != 1) {
                 throw new 
CompilationException(__msgs.errInvalidNumberOfArguments(Constants.NON_STDRD_FUNCTION_PROCESS_PROPERTY));
@@ -277,7 +277,7 @@ public class JaxpFunctionResolver implem
        }
     }
 
-    public class DayTimeDuration implements XPathFunction {
+    public static class DayTimeDuration implements XPathFunction {
        public Object evaluate(List args) throws XPathFunctionException {
             if (args.size() != 1) {
                 throw new 
CompilationException(__msgs.errInvalidNumberOfArguments(Constants.NON_STDRD_FUNCTION_DAY_TIME_DURATION));
@@ -286,7 +286,7 @@ public class JaxpFunctionResolver implem
        }
     }
 
-    public class YearMonthDuration implements XPathFunction {
+    public static class YearMonthDuration implements XPathFunction {
        public Object evaluate(List args) throws XPathFunctionException {
             if (args.size() != 1) {
                 throw new 
CompilationException(__msgs.errInvalidNumberOfArguments(Constants.NON_STDRD_FUNCTION_YEAR_MONTH_DURATION));

Modified: 
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xpath20/compiler/OdeXPathFunctionLibrary.java
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xpath20/compiler/OdeXPathFunctionLibrary.java?rev=942180&r1=942179&r2=942180&view=diff
==============================================================================
--- 
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xpath20/compiler/OdeXPathFunctionLibrary.java
 (original)
+++ 
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xpath20/compiler/OdeXPathFunctionLibrary.java
 Fri May  7 19:00:45 2010
@@ -37,7 +37,7 @@ import java.util.ArrayList;
 public class OdeXPathFunctionLibrary extends 
net.sf.saxon.xpath.XPathFunctionLibrary {
     private static final long serialVersionUID = -8885396864277163797L;
     
-    private JaxpFunctionResolver _funcResolver;
+    private transient JaxpFunctionResolver _funcResolver;
 
     public OdeXPathFunctionLibrary(JaxpFunctionResolver funcResolver) {
         _funcResolver = funcResolver;

Modified: 
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xpath20/compiler/SaxonContext.java
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xpath20/compiler/SaxonContext.java?rev=942180&r1=942179&r2=942180&view=diff
==============================================================================
--- 
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xpath20/compiler/SaxonContext.java
 (original)
+++ 
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xpath20/compiler/SaxonContext.java
 Fri May  7 19:00:45 2010
@@ -35,8 +35,10 @@ import net.sf.saxon.xpath.XPathFunctionL
  */
 public class SaxonContext extends JAXPXPathStaticContext {
 
-    private JaxpVariableResolver _varResolver;
-    private JaxpFunctionResolver _funcResolver;
+  
+    private static final long serialVersionUID = 2460900369574468960L;
+    private transient JaxpVariableResolver _varResolver;
+    private transient JaxpFunctionResolver _funcResolver;
 
     public SaxonContext(Configuration config, JaxpVariableResolver varResolver,
                         JaxpFunctionResolver funcResolver) {

Modified: 
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xquery10/compiler/XQuery10BpelFunctions.java
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xquery10/compiler/XQuery10BpelFunctions.java?rev=942180&r1=942179&r2=942180&view=diff
==============================================================================
--- 
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xquery10/compiler/XQuery10BpelFunctions.java
 (original)
+++ 
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xquery10/compiler/XQuery10BpelFunctions.java
 Fri May  7 19:00:45 2010
@@ -146,18 +146,21 @@ public class XQuery10BpelFunctions {
      */
     private static XPathFunction resolveFunction(XPathContext context,
         QName name) {
-        JaxpFunctionResolver funcResolver = null;
         Item item = context.getCurrentIterator().current();
+        XPathFunction function = null;
 
         if (item instanceof NodeWrapper) {
             Node node = (Node) ((NodeWrapper) item).getUnderlyingNode();
-
+            JaxpFunctionResolver funcResolver = null;
             if (node != null) {
                 funcResolver = (JaxpFunctionResolver) 
node.getUserData(USER_DATA_KEY_FUNCTION_RESOLVER);
             }
+            if (funcResolver != null) {
+                function = funcResolver.resolveFunction(name, 0);
+            }
         }
 
-        return funcResolver.resolveFunction(name, 0);
+        return function;
     }
 
     /**

Modified: 
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xquery10/compiler/XQuery10ExpressionCompilerImpl.java
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xquery10/compiler/XQuery10ExpressionCompilerImpl.java?rev=942180&r1=942179&r2=942180&view=diff
==============================================================================
--- 
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xquery10/compiler/XQuery10ExpressionCompilerImpl.java
 (original)
+++ 
ode/branches/APACHE_ODE_1.X/bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xquery10/compiler/XQuery10ExpressionCompilerImpl.java
 Fri May  7 19:00:45 2010
@@ -365,7 +365,7 @@ public class XQuery10ExpressionCompilerI
        return typeQName;
     }
 
-    private class XQueryDeclarations {
+    private static class XQueryDeclarations {
        StringBuffer declarations = new StringBuffer();
        
        public XQueryDeclarations() {}


Reply via email to