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 2006/10/03 17:45:10 UTC
svn commit: r452541 - in /incubator/ode/trunk:
bpel-el-xpath10/src/main/java/org/apache/ode/bpel/elang/xpath10/compiler/
bpel-el-xpath20/src/main/java/org/apache/ode/bpel/elang/xpath20/compiler/
bpel-el-xpath20/src/main/java/org/apache/ode/bpel/elang/x...
Author: mriou
Date: Tue Oct 3 08:45:09 2006
New Revision: 452541
URL: http://svn.apache.org/viewvc?view=rev&rev=452541
Log:
[ODE-57] Fixed parameters passing and usage of correct node contexts. Greatly improved error (and standard faults) reporting.
Modified:
incubator/ode/trunk/bpel-el-xpath10/src/main/java/org/apache/ode/bpel/elang/xpath10/compiler/XPathMessages.java
incubator/ode/trunk/bpel-el-xpath20/src/main/java/org/apache/ode/bpel/elang/xpath20/compiler/JaxpFunctionResolver.java
incubator/ode/trunk/bpel-el-xpath20/src/main/java/org/apache/ode/bpel/elang/xpath20/compiler/JaxpVariableResolver.java
incubator/ode/trunk/bpel-el-xpath20/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/JaxpFunctionResolver.java
incubator/ode/trunk/bpel-el-xpath20/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/XPath20ExpressionRuntime.java
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ASSIGN.java
incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestXslTransform/HelloXslWorld.xsl
incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestXslTransform/test.properties
Modified: incubator/ode/trunk/bpel-el-xpath10/src/main/java/org/apache/ode/bpel/elang/xpath10/compiler/XPathMessages.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-el-xpath10/src/main/java/org/apache/ode/bpel/elang/xpath10/compiler/XPathMessages.java?view=diff&rev=452541&r1=452540&r2=452541
==============================================================================
--- incubator/ode/trunk/bpel-el-xpath10/src/main/java/org/apache/ode/bpel/elang/xpath10/compiler/XPathMessages.java (original)
+++ incubator/ode/trunk/bpel-el-xpath10/src/main/java/org/apache/ode/bpel/elang/xpath10/compiler/XPathMessages.java Tue Oct 3 08:45:09 2006
@@ -39,6 +39,12 @@
functionName);
}
+ /** Error compiling XSL Sheet "{0}" : {1}. */
+ public CompilationMessage errXslCompilation(String xslName, String error) {
+ return super.formatCompilationMessage("Error compiling XSL Sheet \"{0}\" : {1}",
+ xslName, error);
+ }
+
/** Attempt to use an unrecognized BPEL function "{0}". */
public CompilationMessage errUnknownBpelFunction(String functionName) {
return super.formatCompilationMessage(
Modified: incubator/ode/trunk/bpel-el-xpath20/src/main/java/org/apache/ode/bpel/elang/xpath20/compiler/JaxpFunctionResolver.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-el-xpath20/src/main/java/org/apache/ode/bpel/elang/xpath20/compiler/JaxpFunctionResolver.java?view=diff&rev=452541&r1=452540&r2=452541
==============================================================================
--- incubator/ode/trunk/bpel-el-xpath20/src/main/java/org/apache/ode/bpel/elang/xpath20/compiler/JaxpFunctionResolver.java (original)
+++ incubator/ode/trunk/bpel-el-xpath20/src/main/java/org/apache/ode/bpel/elang/xpath20/compiler/JaxpFunctionResolver.java Tue Oct 3 08:45:09 2006
@@ -164,13 +164,12 @@
XslTransformHandler.getInstance().parseXSLSheet(xslSheet.uri, xslSheet.sheetBody,
new XslCompileUriResolver(_cctx, _out));
} catch (Exception e) {
- throw new CompilationException(
- __msgs.errInvalidNumberOfArguments(xslUri));
+ throw new CompilationException(__msgs.errXslCompilation(xslUri, e.toString()));
}
_out.xslSheets.put(xslSheet.uri, xslSheet);
return "";
}
-
}
+
}
Modified: incubator/ode/trunk/bpel-el-xpath20/src/main/java/org/apache/ode/bpel/elang/xpath20/compiler/JaxpVariableResolver.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-el-xpath20/src/main/java/org/apache/ode/bpel/elang/xpath20/compiler/JaxpVariableResolver.java?view=diff&rev=452541&r1=452540&r2=452541
==============================================================================
--- incubator/ode/trunk/bpel-el-xpath20/src/main/java/org/apache/ode/bpel/elang/xpath20/compiler/JaxpVariableResolver.java (original)
+++ incubator/ode/trunk/bpel-el-xpath20/src/main/java/org/apache/ode/bpel/elang/xpath20/compiler/JaxpVariableResolver.java Tue Oct 3 08:45:09 2006
@@ -30,6 +30,8 @@
import org.apache.ode.bpel.o.OVarType;
import org.apache.ode.bpel.o.OXsdTypeVarType;
import org.apache.ode.utils.Namespaces;
+import org.apache.ode.utils.DOMUtils;
+import org.w3c.dom.Document;
import javax.xml.namespace.QName;
import javax.xml.xpath.XPathVariableResolver;
@@ -109,7 +111,11 @@
return 0;
if (typeName.getLocalPart().equals("boolean"))
return Boolean.TRUE;
+ if (typeName.getLocalPart().equals("string"))
+ return "";
}
- return "";
+ Document doc = DOMUtils.newDocument();
+ doc.appendChild(doc.createElement("empty"));
+ return doc.getDocumentElement();
}
}
Modified: incubator/ode/trunk/bpel-el-xpath20/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/JaxpFunctionResolver.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-el-xpath20/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/JaxpFunctionResolver.java?view=diff&rev=452541&r1=452540&r2=452541
==============================================================================
--- incubator/ode/trunk/bpel-el-xpath20/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/JaxpFunctionResolver.java (original)
+++ incubator/ode/trunk/bpel-el-xpath20/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/JaxpFunctionResolver.java Tue Oct 3 08:45:09 2006
@@ -37,6 +37,7 @@
import org.apache.ode.utils.DOMUtils;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
+import org.w3c.dom.Document;
import org.xml.sax.SAXException;
import javax.xml.namespace.QName;
@@ -222,15 +223,26 @@
for (int idx = 2; idx < args.size(); idx+=2) {
QName keyQName = _oxpath.namespaceCtx.derefQName((String) args.get(idx));
Object paramElmt;
- if (args.get(idx + 1) instanceof NodeWrapper)
- paramElmt = ((NodeWrapper)args.get(1)).getUnderlyingNode();
- else paramElmt = args.get(1);
+ if (args.get(idx + 1) instanceof NodeWrapper) {
+ Element tmpElmt = (Element) ((NodeWrapper)args.get(1)).getUnderlyingNode();
+ Document paramDoc = DOMUtils.newDocument();
+ paramDoc.appendChild(paramDoc.importNode(tmpElmt, true));
+ paramElmt = paramDoc;
+ if (__log.isDebugEnabled())
+ __log.debug("Passing parameter " + keyQName + " " + DOMUtils.domToString(paramDoc));
+ } else paramElmt = args.get(1);
parametersMap.put(keyQName, paramElmt);
}
}
- DOMSource source = new DOMSource(varElmt);
+ if (__log.isDebugEnabled())
+ __log.debug("Executing XSL sheet " + args.get(0) + " on element " + DOMUtils.domToString(varElmt));
+
+ Document varDoc = DOMUtils.newDocument();
+ varDoc.appendChild(varDoc.importNode(varElmt, true));
+
+ DOMSource source = new DOMSource(varDoc);
// Using a StreamResult as a DOMResult doesn't behaves properly when the result
// of the transformation is just a string.
StringWriter writerResult = new StringWriter();
@@ -255,9 +267,13 @@
try {
return DOMUtils.stringToDOM(output).getChildNodes();
} catch (SAXException e) {
- throw new XPathFunctionException(e);
+ throw new XPathFunctionException("Parsing the result of the XSL sheet " + args.get(0) +
+ " didn't produce a parsable XML result: " + output);
} catch (IOException e) {
throw new XPathFunctionException(e);
+ } catch (Exception e) {
+ throw new XPathFunctionException("Parsing the result of the XSL sheet " + args.get(0) +
+ " didn't produce a parsable XML result: " + output);
}
} else {
return output;
Modified: incubator/ode/trunk/bpel-el-xpath20/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/XPath20ExpressionRuntime.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-el-xpath20/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/XPath20ExpressionRuntime.java?view=diff&rev=452541&r1=452540&r2=452541
==============================================================================
--- incubator/ode/trunk/bpel-el-xpath20/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/XPath20ExpressionRuntime.java (original)
+++ incubator/ode/trunk/bpel-el-xpath20/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/XPath20ExpressionRuntime.java Tue Oct 3 08:45:09 2006
@@ -30,6 +30,7 @@
import javax.xml.xpath.XPathExpressionException;
import net.sf.saxon.xpath.XPathEvaluator;
+import net.sf.saxon.trans.DynamicError;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -171,7 +172,12 @@
+ " - type=" + evalResult.getClass().getName());
return evalResult;
} catch (XPathExpressionException e) {
+ // Extracting the real cause from all this wrapping isn't a simple task
Throwable cause = e.getCause() != null ? e.getCause() : e;
+ if (cause instanceof DynamicError) {
+ cause = ((DynamicError)cause).getException();
+ if (cause.getCause() != null) cause = cause.getCause();
+ }
throw new EvaluationException("Error while executing an XPath expression: " + cause.toString(), cause);
} catch (WrappedResolverException wre) {
wre.printStackTrace();
Modified: incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ASSIGN.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ASSIGN.java?view=diff&rev=452541&r1=452540&r2=452541
==============================================================================
--- incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ASSIGN.java (original)
+++ incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ASSIGN.java Tue Oct 3 08:45:09 2006
@@ -196,6 +196,7 @@
.getMessage());
if (__log.isDebugEnabled())
__log.debug(from + ": " + msg);
+ if (e.getCause() instanceof FaultException) throw (FaultException)e.getCause();
throw new FaultException(
getOAsssign().getOwner().constants.qnSelectionFailure,
msg);
Modified: incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestXslTransform/HelloXslWorld.xsl
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestXslTransform/HelloXslWorld.xsl?view=diff&rev=452541&r1=452540&r2=452541
==============================================================================
--- incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestXslTransform/HelloXslWorld.xsl (original)
+++ incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestXslTransform/HelloXslWorld.xsl Tue Oct 3 08:45:09 2006
@@ -2,13 +2,13 @@
<xsl:output method="xml"/>
<xsl:param name="middle"/>
- <xsl:template match="content">
+ <xsl:template match="/">
<!-- Per the WS-BPEL spec, only the single child of the root of the
result tree is considered (so the root element here is "suppressed"
in the engine) -->
<xsl:element name="root">
<xsl:element name="hello">
- <xsl:value-of select="concat(text(), $middle, ' World')"/>
+ <xsl:value-of select="concat(*/text(), $middle/*/text(), ' World')"/>
</xsl:element>
</xsl:element>
</xsl:template>
Modified: incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestXslTransform/test.properties
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestXslTransform/test.properties?view=diff&rev=452541&r1=452540&r2=452541
==============================================================================
--- incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestXslTransform/test.properties (original)
+++ incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestXslTransform/test.properties Tue Oct 3 08:45:09 2006
@@ -2,5 +2,5 @@
service=HelloXslService
operation=helloXsl
request1=<message><TestPart><content>Hello</content></TestPart></message>
-response1=.*Hello World.*
+response1=.*HelloHello World.*