You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by an...@apache.org on 2006/04/22 23:30:53 UTC

svn commit: r396164 - /cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/xml/dom/DOMUtil.java

Author: antonio
Date: Sat Apr 22 14:30:50 2006
New Revision: 396164

URL: http://svn.apache.org/viewcvs?rev=396164&view=rev
Log:
Extract imports. Use a better name for the exception message.

Modified:
    cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/xml/dom/DOMUtil.java

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/xml/dom/DOMUtil.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/xml/dom/DOMUtil.java?rev=396164&r1=396163&r2=396164&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/xml/dom/DOMUtil.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/xml/dom/DOMUtil.java Sat Apr 22 14:30:50 2006
@@ -63,7 +63,7 @@
  */
 public final class DOMUtil {
 
-    private static final String NULL_XPATH_IS_INVALID = "XPath is required.";
+    private static final String XPATH_IS_REQUIRED = "XPath is required.";
 
     /**
      * Get the owner of the DOM document belonging to the node. This works even
@@ -94,7 +94,7 @@
      */
     public static String getValueOfNode(XPathProcessor processor, Node root, String path) throws ProcessingException {
         if (path == null) {
-            throw new ProcessingException(NULL_XPATH_IS_INVALID);
+            throw new ProcessingException(XPATH_IS_REQUIRED);
         }
         if (root != null) {
             path = StringUtils.strip(path, "/");
@@ -673,7 +673,7 @@
         // Now we have to parse the string
         // First test: path? rootNode?
         if (path == null) {
-            throw new ProcessingException(NULL_XPATH_IS_INVALID);
+            throw new ProcessingException(XPATH_IS_REQUIRED);
         }
         if (rootNode == null)
             return rootNode;
@@ -687,7 +687,7 @@
             Node testNode = getSingleNode(rootNode, path);
             if (testNode != null)
                 return testNode;
-        } catch (javax.xml.transform.TransformerException local) {
+        } catch (TransformerException local) {
             throw new ProcessingException("Transforming exception during selectSingleNode with path: '" + path
                     + "'. Exception: " + local, local);
         }
@@ -723,7 +723,7 @@
             Node singleNode;
             try {
                 singleNode = getSingleNode(parent, nodeName);
-            } catch (javax.xml.transform.TransformerException localException) {
+            } catch (TransformerException localException) {
                 throw new ProcessingException("XPathUtil.selectSingleNode: " + localException.getMessage(),
                         localException);
             }
@@ -827,7 +827,7 @@
         // Now we have to parse the string
         // First test: path? rootNode?
         if (path == null) {
-            throw new ProcessingException(NULL_XPATH_IS_INVALID);
+            throw new ProcessingException(XPATH_IS_REQUIRED);
         }
         if (rootNode == null)
             return rootNode;
@@ -841,7 +841,7 @@
             Node testNode = getSingleNode(rootNode, path, processor);
             if (testNode != null)
                 return testNode;
-        } catch (javax.xml.transform.TransformerException local) {
+        } catch (TransformerException local) {
             throw new ProcessingException("Transforming exception during selectSingleNode with path: '" + path
                     + "'. Exception: " + local, local);
         }
@@ -878,7 +878,7 @@
             Node singleNode;
             try {
                 singleNode = getSingleNode(parent, nodeName, processor);
-            } catch (javax.xml.transform.TransformerException localException) {
+            } catch (TransformerException localException) {
                 throw new ProcessingException("XPathUtil.selectSingleNode: " + localException.getMessage(),
                         localException);
             }
@@ -914,7 +914,7 @@
                         String attr;
                         String value;
                         // scan for attributes
-                        java.util.StringTokenizer tokenizer = new java.util.StringTokenizer(XPathExp, "= ");
+                        StringTokenizer tokenizer = new StringTokenizer(XPathExp, "= ");
                         while (tokenizer.hasMoreTokens()) {
                             attr = tokenizer.nextToken();
                             if (attr.startsWith("@")) {
@@ -964,7 +964,7 @@
      */
     public static String getValueOf(Node root, String path) throws ProcessingException {
         if (path == null) {
-            throw new ProcessingException(NULL_XPATH_IS_INVALID);
+            throw new ProcessingException(XPATH_IS_REQUIRED);
         }
         if (root == null)
             return null;
@@ -975,7 +975,7 @@
             if (node != null) {
                 return getValueOfNode(node);
             }
-        } catch (javax.xml.transform.TransformerException localException) {
+        } catch (TransformerException localException) {
             throw new ProcessingException("XPathUtil.selectSingleNode: " + localException.getMessage(), localException);
         }
         return null;
@@ -996,7 +996,7 @@
      */
     public static String getValueOf(Node root, String path, XPathProcessor processor) throws ProcessingException {
         if (path == null) {
-            throw new ProcessingException(NULL_XPATH_IS_INVALID);
+            throw new ProcessingException(XPATH_IS_REQUIRED);
         }
         if (root == null)
             return null;
@@ -1007,7 +1007,7 @@
             if (node != null) {
                 return getValueOfNode(node);
             }
-        } catch (javax.xml.transform.TransformerException localException) {
+        } catch (TransformerException localException) {
             throw new ProcessingException("XPathUtil.selectSingleNode: " + localException.getMessage(), localException);
         }
         return null;