servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r397529 - /incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/expression/JAXPXPathExpression.java
Date Thu, 27 Apr 2006 12:16:03 GMT
Author: gnodet
Date: Thu Apr 27 05:15:52 2006
New Revision: 397529

URL: http://svn.apache.org/viewcvs?rev=397529&view=rev
Log:
Fix JAXPXPathExpression so that the constructor does not compile the expression.
Else setting parameters after the constructor has been called does not change anything.

Modified:
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/expression/JAXPXPathExpression.java

Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/expression/JAXPXPathExpression.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/expression/JAXPXPathExpression.java?rev=397529&r1=397528&r2=397529&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/expression/JAXPXPathExpression.java
(original)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/expression/JAXPXPathExpression.java
Thu Apr 27 05:15:52 2006
@@ -26,6 +26,7 @@
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.transform.TransformerException;
 import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathException;
 import javax.xml.xpath.XPathExpression;
 import javax.xml.xpath.XPathExpressionException;
 import javax.xml.xpath.XPathFactory;
@@ -51,15 +52,16 @@
     }
 
     /**
-     * A helper constructor to make a fully created expression. This constructor will
-     * call the {@link #afterPropertiesSet()} method to ensure this POJO is properly constructed.
+     * A helper constructor to make a fully created expression. 
      */
     public JAXPXPathExpression(String xpath) throws Exception {
         this.xpath = xpath;
-        afterPropertiesSet();
     }
 
-    public void afterPropertiesSet() throws Exception {
+    /**
+     * Compiles the xpath expression.
+     */
+    public void afterPropertiesSet() throws XPathExpressionException {
         if (xPathExpression == null) {
             if (xpath == null) {
                 throw new IllegalArgumentException("You must specify the xpath property");
@@ -80,8 +82,13 @@
         }
     }
 
+    /**
+     * Before evaluating the xpath expression, it will be compiled by calling
+     * the {@link #afterPropertiesSet()} method.
+     */
     public Object evaluate(MessageExchange exchange, NormalizedMessage message) throws MessagingException
{
         try {
+            afterPropertiesSet();
             Object object = getXMLNode(exchange, message);
             synchronized (this) {
                 variableResolver.setExchange(exchange);



Mime
View raw message