Author: mbenson
Date: Tue Dec 11 11:32:58 2007
New Revision: 603339

URL: http://svn.apache.org/viewvc?rev=603339&view=rev
Log:
[JXPATH-107] misplaced null check reported by Michele Vivoda

Modified:
    
commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/PropertyOwnerPointer.java

Modified: 
commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/PropertyOwnerPointer.java
URL: 
http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/PropertyOwnerPointer.java?rev=603339&r1=603338&r2=603339&view=diff
==============================================================================
--- 
commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/PropertyOwnerPointer.java
 (original)
+++ 
commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/PropertyOwnerPointer.java
 Tue Dec 11 11:32:58 2007
@@ -114,17 +114,19 @@
      */
     public void setValue(Object value) {
         this.value = value;
-        if (parent.isContainer()) {
-            parent.setValue(value);
-        }
-        else if (parent != null) {
-            if (index == WHOLE_COLLECTION) {
-                throw new UnsupportedOperationException(
-                    "Cannot setValue of an object that is not "
-                        + "some other object's property");
+        if (parent != null) {
+            if (parent.isContainer()) {
+                parent.setValue(value);
+            }
+            else {
+                if (index == WHOLE_COLLECTION) {
+                    throw new UnsupportedOperationException(
+                        "Cannot setValue of an object that is not "
+                            + "some other object's property");
+                }
+                throw new JXPathInvalidAccessException(
+                    "The specified collection element does not exist: " + 
this);
             }
-            throw new JXPathInvalidAccessException(
-                "The specified collection element does not exist: " + this);
         }
         else {
             throw new UnsupportedOperationException(


Reply via email to