commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r618088 - in /commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model: VariablePointer.java beans/PropertyPointer.java dom/DOMNodePointer.java
Date Sun, 03 Feb 2008 21:06:44 GMT
Author: mbenson
Date: Sun Feb  3 13:06:27 2008
New Revision: 618088

URL: http://svn.apache.org/viewvc?rev=618088&view=rev
Log:
consolidate duplicate code

Modified:
    commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/VariablePointer.java
    commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/PropertyPointer.java
    commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMNodePointer.java

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/VariablePointer.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/VariablePointer.java?rev=618088&r1=618087&r2=618088&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/VariablePointer.java
(original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/VariablePointer.java
Sun Feb  3 13:06:27 2008
@@ -411,21 +411,6 @@
     }
 
     /**
-     * Find the AbstractFactory, if any, associated with the specified context.
-     * @param context JXPathContext to search
-     * @return AbstractFactory
-     */
-    private AbstractFactory getAbstractFactory(JXPathContext context) {
-        AbstractFactory factory = context.getFactory();
-        if (factory == null) {
-            throw new JXPathException(
-              "Factory is not set on the JXPathContext - cannot create path: "
-              + asPath());
-        }
-        return factory;
-    }
-
-    /**
      * {@inheritDoc}
      */
     public int compareChildNodePointers(

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/PropertyPointer.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/PropertyPointer.java?rev=618088&r1=618087&r2=618088&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/PropertyPointer.java
(original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/PropertyPointer.java
Sun Feb  3 13:06:27 2008
@@ -288,20 +288,4 @@
         return getValuePointer().compareChildNodePointers(pointer1, pointer2);
     }
 
-    /**
-     * Get the required AbstractFactory configured on the specified JXPathContext.
-     * @param context JXPathContext
-     * @return AbstractFactory
-     * @throws JXPathException if no factory configured.
-     */
-    private AbstractFactory getAbstractFactory(JXPathContext context) {
-        AbstractFactory factory = context.getFactory();
-        if (factory == null) {
-            throw new JXPathException(
-                "Factory is not set on the "
-                    + "JXPathContext - cannot create path: "
-                    + asPath());
-        }
-        return factory;
-    }
 }

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMNodePointer.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMNodePointer.java?rev=618088&r1=618087&r2=618088&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMNodePointer.java
(original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMNodePointer.java
Sun Feb  3 13:06:27 2008
@@ -618,40 +618,6 @@
     }
 
     /**
-     * Return a string escaping single and double quotes.
-     * @param string string to treat
-     * @return string with any necessary changes made.
-     */
-    private String escape(String string) {
-        final char[] c = new char[] { '\'', '"' };
-        final String[] esc = new String[] { "'", """ };
-        StringBuffer sb = null;
-        for (int i = 0; sb == null && i < c.length; i++) {
-            if (string.indexOf(c[i]) >= 0) {
-                sb = new StringBuffer(string);
-            }
-        }
-        if (sb == null) {
-            return string;
-        }
-        for (int i = 0; i < c.length; i++) {
-            if (string.indexOf(c[i]) < 0) {
-                continue;
-            }
-            int pos = 0;
-            while (pos < sb.length()) {
-                if (sb.charAt(pos) == c[i]) {
-                    sb.replace(pos, pos + 1, esc[i]);
-                    pos += esc[i].length();
-                } else {
-                    pos++;
-                }
-            }
-        }
-        return sb.toString();
-    }
-
-    /**
      * Get relative position of this among like-named siblings.
      * @return 1..n
      */
@@ -851,22 +817,6 @@
         Element element = document.getElementById(id);
         return element == null ? (Pointer) new NullPointer(getLocale(), id)
                 : new DOMNodePointer(element, getLocale(), id);
-    }
-
-    /**
-     * Get the AbstractFactory associated with the specified JXPathContext.
-     * @param context JXPathContext
-     * @return AbstractFactory
-     */
-    private AbstractFactory getAbstractFactory(JXPathContext context) {
-        AbstractFactory factory = context.getFactory();
-        if (factory == null) {
-            throw new JXPathException(
-                "Factory is not set on the JXPathContext - "
-                    + "cannot create path: "
-                    + asPath());
-        }
-        return factory;
     }
 
     /**



Mime
View raw message