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

Invalid return type when expected result is null

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 3.0
    • 3.1
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: