Uploaded image for project: 'Commons JEXL'
  1. Commons JEXL
  2. JEXL-192

Invalid return type when expected result is null

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 3.0
    • Fix Version/s: 3.1
    • Labels:
      None

      Description

      In jexl2 this code correctly outputs the line:

      null
      
              JexlEngine jexl = new JexlEngine();
              Record r = new Record();
              r.setHeader(new RecordHeader());
              JexlContext jc = new MapContext();
              jc.set("r", r );
              jc.set("com.s.objects.record.RecordUtils", com.s.objects.record.RecordUtils.class );
              Expression e = jexl.createExpression( "com.s.objects.record.RecordUtils.getHeaderAgeOrResolveItFromDOB(r)" );
              System.out.println( e.evaluate(jc) );        
      

      The signature of the method getHeaderAgeOrResolveItFromDOB() is:

              public static Integer getHeaderAgeOrResolveItFromDOB( final Record rec ) {
              ...
              }
      

      But in jexl3 this code produces:

      	class com.s.objects.record.RecordUtils
      
              JexlEngine jexl = new JexlBuilder().create();
              Record r = new Record();
              r.setHeader(new RecordHeader());
              JexlContext jc = new MapContext();
              jc.set("r", r );
              jc.set("com.s.objects.record.RecordUtils", com.s.objects.record.RecordUtils.class );
              JexlExpression e = jexl.createExpression( "com.s.objects.record.RecordUtils.getHeaderAgeOrResolveItFromDOB(r)" );
              System.out.println( e.evaluate(jc) );        
      

      So it returns the class of the utility rather than the value null! For non null values it returns the proper type (Integer);

      I think jexl3 version 3.0 was not really ready for prime time.
      I really screwed up my project upgrading to 3.0.
      When do you guys anticipate to release 3.1?
      Is there a way to work with a snapshot after this fix?

        Attachments

          Activity

            People

            • Assignee:
              henrib Henri Biestro
              Reporter:
              biliboc Constantin Mitocaru
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: