Uploaded image for project: 'Commons JXPath'
  1. Commons JXPath
  2. JXPATH-7

number() function doesn't work correctly on Boolean variable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.1 Final
    • Fix Version/s: None
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Bugzilla Id:
      28753

      Description

      When running the number() function on a Boolean variable, as in the following
      code:
      JXPathContext context = JXPathContextFactory.newInstance().newContext
      (null, null);
      Variables vars = new BasicVariables();
      vars.declareVariable("bool", new Boolean("true"));
      context.setVariables(vars);
      Number num = (Number)context.getValue("number($bool)");
      System.out.println("num = " + num);
      The value returned is NaN, instead of 1.0, as per the XPath spec.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              sm@jacada.com Shahar Mosek
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: