diff --git a/core/src/main/java/org/springframework/ws/server/endpoint/adapter/XPathParamAnnotationMethodEndpointAdapter.java b/core/src/main/java/org/springframework/ws/server/endpoint/adapter/XPathParamAnnotationMethodEndpointAdapter.java index c885386e..1f0c96c4 100644 --- a/core/src/main/java/org/springframework/ws/server/endpoint/adapter/XPathParamAnnotationMethodEndpointAdapter.java +++ b/core/src/main/java/org/springframework/ws/server/endpoint/adapter/XPathParamAnnotationMethodEndpointAdapter.java @@ -41,7 +41,7 @@ import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** - * Adapter that supports endpoint methods that use marshalling. Supports methods with the following signature: + * Adapter that supports endpoint methods that use XPath expressions. Supports methods with the following signature: *
* void handleMyMessage(@XPathParam("/root/child/text")String param);
*
@@ -83,7 +83,7 @@ public class XPathParamAnnotationMethodEndpointAdapter extends AbstractMethodEnd
}
Class>[] parameterTypes = method.getParameterTypes();
for (int i = 0; i < parameterTypes.length; i++) {
- if (getXPathParamAnnotation(method, i) == null || !isSuportedType(parameterTypes[i])) {
+ if (getXPathParamAnnotation(method, i) == null || !isSupportedType(parameterTypes[i])) {
return false;
}
}
@@ -100,7 +100,7 @@ public class XPathParamAnnotationMethodEndpointAdapter extends AbstractMethodEnd
return null;
}
- private boolean isSuportedType(Class> clazz) {
+ private boolean isSupportedType(Class> clazz) {
return Boolean.class.isAssignableFrom(clazz) || Boolean.TYPE.isAssignableFrom(clazz) ||
Double.class.isAssignableFrom(clazz) || Double.TYPE.isAssignableFrom(clazz) ||
Node.class.isAssignableFrom(clazz) || NodeList.class.isAssignableFrom(clazz) ||
@@ -151,7 +151,7 @@ public class XPathParamAnnotationMethodEndpointAdapter extends AbstractMethodEnd
return args;
}
- private XPath createXPath() {
+ private synchronized XPath createXPath() {
XPath xpath = xpathFactory.newXPath();
if (namespaces != null) {
SimpleNamespaceContext namespaceContext = new SimpleNamespaceContext();
diff --git a/xml/src/main/java/org/springframework/xml/xpath/Jaxp13XPathExpressionFactory.java b/xml/src/main/java/org/springframework/xml/xpath/Jaxp13XPathExpressionFactory.java
index 48e623aa..d1ea41db 100644
--- a/xml/src/main/java/org/springframework/xml/xpath/Jaxp13XPathExpressionFactory.java
+++ b/xml/src/main/java/org/springframework/xml/xpath/Jaxp13XPathExpressionFactory.java
@@ -40,11 +40,7 @@ import org.w3c.dom.NodeList;
*/
abstract class Jaxp13XPathExpressionFactory {
- private static XPathFactory xpathFactory;
-
- static {
- xpathFactory = XPathFactory.newInstance();
- }
+ private static XPathFactory xpathFactory = XPathFactory.newInstance();
/**
* Creates a JAXP 1.3 XPathExpression from the given string expression.
@@ -55,7 +51,7 @@ abstract class Jaxp13XPathExpressionFactory {
*/
static XPathExpression createXPathExpression(String expression) {
try {
- XPath xpath = xpathFactory.newXPath();
+ XPath xpath = createXPath();
javax.xml.xpath.XPathExpression xpathExpression = xpath.compile(expression);
return new Jaxp13XPathExpression(xpathExpression);
}
@@ -75,7 +71,7 @@ abstract class Jaxp13XPathExpressionFactory {
*/
public static XPathExpression createXPathExpression(String expression, MapXPathExpression interface. */
private static class Jaxp13XPathExpression implements XPathExpression {
diff --git a/xml/src/main/java/org/springframework/xml/xpath/Jaxp13XPathTemplate.java b/xml/src/main/java/org/springframework/xml/xpath/Jaxp13XPathTemplate.java
index 344e5522..07df5b2b 100644
--- a/xml/src/main/java/org/springframework/xml/xpath/Jaxp13XPathTemplate.java
+++ b/xml/src/main/java/org/springframework/xml/xpath/Jaxp13XPathTemplate.java
@@ -121,7 +121,7 @@ public class Jaxp13XPathTemplate extends AbstractXPathTemplate {
}
private Object evaluate(String expression, Source context, QName returnType) throws XPathException {
- XPath xpath = xpathFactory.newXPath();
+ XPath xpath = createXPath();
if (getNamespaces() != null && !getNamespaces().isEmpty()) {
SimpleNamespaceContext namespaceContext = new SimpleNamespaceContext();
namespaceContext.setBindings(getNamespaces());
@@ -166,4 +166,9 @@ public class Jaxp13XPathTemplate extends AbstractXPathTemplate {
}
}
+ private synchronized XPath createXPath() {
+ return xpathFactory.newXPath();
+ }
+
+
}