commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r670727 - in /commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath: ./ ri/ ri/axes/ ri/model/beans/ ri/model/dom/ util/
Date Mon, 23 Jun 2008 20:10:38 GMT
Author: mbenson
Date: Mon Jun 23 13:10:38 2008
New Revision: 670727

URL: http://svn.apache.org/viewvc?rev=670727&view=rev
Log:
checkstyle/pmd

Modified:
    commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/JXPathContextFactory.java
    commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/JXPathIntrospector.java
    commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/PackageFunctions.java
    commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/JXPathContextReferenceImpl.java
    commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/axes/DescendantContext.java
    commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/axes/PrecedingOrFollowingContext.java
    commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/axes/SelfContext.java
    commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/BeanPointer.java
    commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/BeanPropertyPointer.java
    commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMAttributePointer.java
    commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/util/BasicTypeConverter.java
    commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/util/MethodLookupUtils.java
    commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/util/ValueUtils.java

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/JXPathContextFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/JXPathContextFactory.java?rev=670727&r1=670726&r2=670727&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/JXPathContextFactory.java
(original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/JXPathContextFactory.java
Mon Jun 23 13:10:38 2008
@@ -148,7 +148,7 @@
         try {
             debug = System.getProperty("jxpath.debug") != null;
         }
-        catch (SecurityException se) {
+        catch (SecurityException se) { //NOPMD
             // This is ok
         }
     }
@@ -174,7 +174,7 @@
             }
 
         }
-        catch (SecurityException se) {
+        catch (SecurityException se) { //NOPMD
             // Ignore
        }
 
@@ -193,11 +193,13 @@
                 FileInputStream fis = new FileInputStream(f);
                 try {
                     props.load(fis);
-                } finally {
+                }
+                finally {
                     if (fis != null) {
                         try {
                             fis.close();
-                        } catch (IOException e) {
+                        }
+                        catch (IOException e) { //NOPMD
                             //swallow
                         }
                     }
@@ -240,10 +242,12 @@
                 String factory = null;
                 try {
                     factory = rd.readLine();
-                } finally {
+                }
+                finally {
                     try {
                         rd.close();
-                    } catch (IOException e) {
+                    }
+                    catch (IOException e) { //NOPMD
                         //swallow
                     }
                 }

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/JXPathIntrospector.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/JXPathIntrospector.java?rev=670727&r1=670726&r2=670727&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/JXPathIntrospector.java
(original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/JXPathIntrospector.java
Mon Jun 23 13:10:38 2008
@@ -168,7 +168,7 @@
         try {
             return (JXPathBeanInfo) instantiate(beanClass, name);
         }
-        catch (Exception ex) {
+        catch (Exception ex) { //NOPMD
             // Just drop through
         }
 
@@ -178,7 +178,7 @@
                 return (JXPathBeanInfo) beanClass.newInstance();
             }
         }
-        catch (Exception ex) {
+        catch (Exception ex) { //NOPMD
             // Just drop through
         }
 
@@ -204,7 +204,7 @@
                 Class cls = cl.loadClass(className);
                 return cls.newInstance();
             }
-            catch (Exception ex) {
+            catch (Exception ex) { //NOPMD
                 // Just drop through and try the system classloader.
             }
         }

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/PackageFunctions.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/PackageFunctions.java?rev=670727&r1=670726&r2=670727&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/PackageFunctions.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/PackageFunctions.java Mon
Jun 23 13:10:38 2008
@@ -115,7 +115,7 @@
         String namespace,
         String name,
         Object[] parameters) {
-        if ((namespace == null && this.namespace != null)
+        if ((namespace == null && this.namespace != null) //NOPMD
             || (namespace != null && !namespace.equals(this.namespace))) {
             return null;
         }

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/JXPathContextReferenceImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/JXPathContextReferenceImpl.java?rev=670727&r1=670726&r2=670727&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/JXPathContextReferenceImpl.java
(original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/JXPathContextReferenceImpl.java
Mon Jun 23 13:10:38 2008
@@ -352,11 +352,9 @@
     public Object getValue(String xpath, Expression expr) {
         Object result = expr.computeValue(getEvalContext());
         if (result == null) {
-            if (expr instanceof Path) {
-                if (!isLenient()) {
-                    throw new JXPathNotFoundException("No value for xpath: "
-                            + xpath);
-                }
+            if (expr instanceof Path && !isLenient()) {
+                throw new JXPathNotFoundException("No value for xpath: "
+                        + xpath);
             }
             return null;
         }

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/axes/DescendantContext.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/axes/DescendantContext.java?rev=670727&r1=670726&r2=670727&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/axes/DescendantContext.java
(original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/axes/DescendantContext.java
Mon Jun 23 13:10:38 2008
@@ -89,7 +89,8 @@
             setStarted = true;
             if (stack == null) {
                 stack = new Stack();
-            } else {
+            }
+            else {
                 stack.clear();
             }
             currentNodePointer = parentContext.getCurrentNodePointer();

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/axes/PrecedingOrFollowingContext.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/axes/PrecedingOrFollowingContext.java?rev=670727&r1=670726&r2=670727&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/axes/PrecedingOrFollowingContext.java
(original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/axes/PrecedingOrFollowingContext.java
Mon Jun 23 13:10:38 2008
@@ -83,7 +83,8 @@
             setStarted = true;
             if (stack == null) {
                 stack = new Stack();
-            } else {
+            }
+            else {
                 stack.clear();
             }
             currentRootLocation = parentContext.getCurrentNodePointer();

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/axes/SelfContext.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/axes/SelfContext.java?rev=670727&r1=670726&r2=670727&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/axes/SelfContext.java
(original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/axes/SelfContext.java
Mon Jun 23 13:10:38 2008
@@ -48,10 +48,8 @@
     }
 
     public NodePointer getCurrentNodePointer() {
-        if (position == 0) {
-            if (!setPosition(1)) {
-                return null;
-            }
+        if (position == 0 && !setPosition(1)) {
+            return null;
         }
         return nodePointer;
     }

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/BeanPointer.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/BeanPointer.java?rev=670727&r1=670726&r2=670727&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/BeanPointer.java
(original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/BeanPointer.java
Mon Jun 23 13:10:38 2008
@@ -117,14 +117,12 @@
         }
 
         BeanPointer other = (BeanPointer) object;
-        if (parent != other.parent) {
-            if (parent == null || !parent.equals(other.parent)) {
-                return false;
-            }
+        if (parent != other.parent && (parent == null || !parent.equals(other.parent)))
{
+            return false;
         }
 
         if ((name == null && other.name != null)
-            || (name != null && !name.equals(other.name))) {
+                || (name != null && !name.equals(other.name))) {
             return false;
         }
 
@@ -135,8 +133,8 @@
         }
 
         if (bean instanceof Number
-            || bean instanceof String
-            || bean instanceof Boolean) {
+                || bean instanceof String
+                || bean instanceof Boolean) {
             return bean.equals(other.bean);
         }
         return bean == other.bean;

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/BeanPropertyPointer.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/BeanPropertyPointer.java?rev=670727&r1=670726&r2=670727&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/BeanPropertyPointer.java
(original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/BeanPropertyPointer.java
Mon Jun 23 13:10:38 2008
@@ -123,15 +123,16 @@
     }
 
     public void setIndex(int index) {
-        if (this.index != index) {
-            // When dealing with a scalar, index == 0 is equivalent to
-            // WHOLE_COLLECTION, so do not change it.
-            if (this.index != WHOLE_COLLECTION
+        if (this.index == index) {
+            return;
+        }
+        // When dealing with a scalar, index == 0 is equivalent to
+        // WHOLE_COLLECTION, so do not change it.
+        if (this.index != WHOLE_COLLECTION
                 || index != 0
                 || isCollection()) {
-                super.setIndex(index);
-                value = UNINITIALIZED;
-            }
+            super.setIndex(index);
+            value = UNINITIALIZED;
         }
     }
 

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMAttributePointer.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMAttributePointer.java?rev=670727&r1=670726&r2=670727&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMAttributePointer.java
(original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMAttributePointer.java
Mon Jun 23 13:10:38 2008
@@ -33,7 +33,7 @@
  */
 public class DOMAttributePointer extends NodePointer {
     private static final long serialVersionUID = 1115085175427555951L;
-    
+
     private Attr attr;
 
     /**

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/util/BasicTypeConverter.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/util/BasicTypeConverter.java?rev=670727&r1=670726&r2=670727&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/util/BasicTypeConverter.java
(original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/util/BasicTypeConverter.java
Mon Jun 23 13:10:38 2008
@@ -66,29 +66,25 @@
             return true;
         }
 
-        if (object instanceof Boolean) {
-            if (Number.class.isAssignableFrom(useType)
-                    || "java.util.concurrent.atomic.AtomicBoolean"
-                            .equals(useType.getName())) {
-                return true;
-            }
+        if (object instanceof Boolean && (Number.class.isAssignableFrom(useType)
+                || "java.util.concurrent.atomic.AtomicBoolean"
+                        .equals(useType.getName()))) {
+            return true;
         }
-        if (object instanceof Number) {
-            if (Number.class.isAssignableFrom(useType) || useType == Boolean.class) {
-                return true;
-            }
+        if (object instanceof Number
+                && (Number.class.isAssignableFrom(useType) || useType == Boolean.class))
{
+            return true;
         }
-        if (object instanceof String) {
-            if (useType == Boolean.class
-                || useType == Character.class
-                || useType == Byte.class
-                || useType == Short.class
-                || useType == Integer.class
-                || useType == Long.class
-                || useType == Float.class
-                || useType == Double.class) {
+        if (object instanceof String
+                && (useType == Boolean.class
+                        || useType == Character.class
+                        || useType == Byte.class
+                        || useType == Short.class
+                        || useType == Integer.class
+                        || useType == Long.class
+                        || useType == Float.class
+                        || useType == Double.class)) {
                 return true;
-            }
         }
         if (fromType.isArray()) {
             // Collection -> array
@@ -509,7 +505,7 @@
      */
     static final class ValuePointer implements Pointer {
         private static final long serialVersionUID = -4817239482392206188L;
-        
+
         private Object bean;
 
         /**

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/util/MethodLookupUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/util/MethodLookupUtils.java?rev=670727&r1=670726&r2=670727&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/util/MethodLookupUtils.java
(original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/util/MethodLookupUtils.java
Mon Jun 23 13:10:38 2008
@@ -70,7 +70,7 @@
                     return constructor;
                 }
             }
-            catch (NoSuchMethodException ex) {
+            catch (NoSuchMethodException ex) { //NOPMD
                 // Ignore
             }
         }
@@ -139,7 +139,7 @@
                     return method;
                 }
             }
-            catch (NoSuchMethodException ex) {
+            catch (NoSuchMethodException ex) { //NOPMD
                 // Ignore
             }
         }
@@ -224,7 +224,7 @@
                     return method;
                 }
             }
-            catch (NoSuchMethodException ex) {
+            catch (NoSuchMethodException ex) { //NOPMD
                 // Ignore
             }
         }

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/util/ValueUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/util/ValueUtils.java?rev=670727&r1=670726&r2=670727&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/util/ValueUtils.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/util/ValueUtils.java Mon
Jun 23 13:10:38 2008
@@ -599,7 +599,7 @@
                 try {
                     return clazz.getDeclaredMethod(name, parameterTypes);
                 }
-                catch (NoSuchMethodException e) {
+                catch (NoSuchMethodException e) { //NOPMD
                     //ignore
                 }
             }
@@ -637,7 +637,7 @@
                 method =
                     interfaces[i].getDeclaredMethod(methodName, parameterTypes);
             }
-            catch (NoSuchMethodException e) {
+            catch (NoSuchMethodException e) { //NOPMD
                 //ignore
             }
             if (method != null) {



Mime
View raw message