You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Johannes Stelzer (JIRA)" <ji...@apache.org> on 2011/06/07 12:27:58 UTC

[jira] [Updated] (JXPATH-151) a != null results in false!

     [ https://issues.apache.org/jira/browse/JXPATH-151?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Johannes Stelzer updated JXPATH-151:
------------------------------------

    Description: 
Comparing a vaule to null using unequals (!=) yields false!

{{quote}}
        Map<String, Integer> m = new HashMap<String, Integer>();
        m.put("a", 1);
        m.put("b", null);
        m.put("c", 1);
        JXPathContext c = JXPathContext.newContext(m);
        System.out.println(c.getValue("a != b") + " should be true");
        System.out.println(c.getValue("a != c") + " should be false");
        System.out.println(c.getValue("a = b") + " should be false");
        System.out.println(c.getValue("a = c") + " should be true");
        System.out.println(c.getValue("not(a = b)") + " should be true");
        System.out.println(c.getValue("not(a = c)") + " should be false");
{{quote}}

Output using 1.3:
{color:red} false should be true{color}
false should be false
false should be false
true should be true
true should be true
false should be false


In 1.2 it works correctly!

  was:
Comparing an vaule to null using unequals(!=) yields false!

Example code:
    public static void main(String[] args) {
        Map<String, Integer> m = new HashMap<String, Integer>();
        m.put("a", 1);
        m.put("b", null);
        m.put("c", 1);
        JXPathContext c = JXPathContext.newContext(m);
        System.out.println(c.getValue("a != b") + " should be true");
        System.out.println(c.getValue("a != c") + " should be false");
        System.out.println(c.getValue("a = b") + " should be false");
        System.out.println(c.getValue("a = c") + " should be true");
        System.out.println(c.getValue("not(a = b)") + " should be true");
        System.out.println(c.getValue("not(a = c)") + " should be false");
    }


> a != null results in false!
> ---------------------------
>
>                 Key: JXPATH-151
>                 URL: https://issues.apache.org/jira/browse/JXPATH-151
>             Project: Commons JXPath
>          Issue Type: Bug
>    Affects Versions: 1.3
>         Environment: windows oracle jvm 1.6_25
>            Reporter: Johannes Stelzer
>            Priority: Blocker
>
> Comparing a vaule to null using unequals (!=) yields false!
> {{quote}}
>         Map<String, Integer> m = new HashMap<String, Integer>();
>         m.put("a", 1);
>         m.put("b", null);
>         m.put("c", 1);
>         JXPathContext c = JXPathContext.newContext(m);
>         System.out.println(c.getValue("a != b") + " should be true");
>         System.out.println(c.getValue("a != c") + " should be false");
>         System.out.println(c.getValue("a = b") + " should be false");
>         System.out.println(c.getValue("a = c") + " should be true");
>         System.out.println(c.getValue("not(a = b)") + " should be true");
>         System.out.println(c.getValue("not(a = c)") + " should be false");
> {{quote}}
> Output using 1.3:
> {color:red} false should be true{color}
> false should be false
> false should be false
> true should be true
> true should be true
> false should be false
> In 1.2 it works correctly!

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira