You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Matt Benson (JIRA)" <ji...@apache.org> on 2007/04/17 18:15:16 UTC

[jira] Commented: (JXPATH-80) boolean conversion of javabean getter values returning NULL fails

    [ https://issues.apache.org/jira/browse/JXPATH-80?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12489449 ] 

Matt Benson commented on JXPATH-80:
-----------------------------------

Wow, this is a nice one.  I understand what's happening; I don't claim that my fundamental xpath knowledge is necessarily up to the task of deciding what to do about it.  I modified your testcase somewhat and find that you are correct.  JXPath has some substantially complex code, but the problem is linked to the fact that a collection encountered in the object graph is like an invisible node:  the collection name refers collectively to its members.  Thus, any property that might hold a collection (e.g. one of type Object) is viewed as an empty collection, so the null node one expects to be compared with false() isn't found.  Similarly, look at this example:

class Bean {
  public Object getValue5() {
    return new Object[] { "foo", "bar", null };
  }
}

Here, both of the following xpaths are true--

  "bean/value5 = true()"
  "bean/value5 = false()"

--because both null and non-null values are found in the property "value."  This seems somewhat nonsensical in the same way the original error does, but I'm not sure how deep the changes to address this would be, nor am I sure whether this is truly incorrect, or just strange.  I will have to do further research as I am able, and of course, input from any other quarter is welcome.

> boolean conversion of javabean getter values returning NULL fails
> -----------------------------------------------------------------
>
>                 Key: JXPATH-80
>                 URL: https://issues.apache.org/jira/browse/JXPATH-80
>             Project: Commons JXPath
>          Issue Type: Bug
>    Affects Versions: 1.2 Final
>         Environment: java.runtime.name=Java(TM) SE Runtime Environment
> java.runtime.version=1.6.0-b105
> java.specification.name=Java Platform API Specification
> java.specification.vendor=Sun Microsystems Inc.
> java.vm.info=mixed mode
> java.vm.name=Java HotSpot(TM) Client VM
>            Reporter: Nico Max
>            Priority: Minor
>         Attachments: test.java
>
>
> According to the JXPath User Guide a Javabean Getter returning NULL, regadless of the type, will be converted bo Boolean FALSE. But trying to build a boolean expression from this fails as the attached testcase shows.
> It seems that the type the bean getter returns matters, as a NULL String for example works as expected.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org