Skip to main content

[el-spec commits] [el-spec~source-code:267] Fix NPE when getELResolver() returns null.

  • From: kchung@...
  • To: commits@...
  • Subject: [el-spec commits] [el-spec~source-code:267] Fix NPE when getELResolver() returns null.
  • Date: Thu, 28 Mar 2013 22:02:51 +0000

Project:    el-spec
Repository: source-code
Revision:   267
Author:     kchung
Date:       2013-03-28 22:02:49 UTC
Link:       

Log Message:
------------
Fix NPE when getELResolver() returns null.




Revisions:
----------
267


Modified Paths:
---------------
trunk/src/test/java/org/glassfish/el/test/OperatorTest.java
trunk/src/test/java/org/glassfish/el/test/StreamTest.java
trunk/api/src/main/java/javax/el/ELContext.java


Diffs:
------
Index: trunk/src/test/java/org/glassfish/el/test/OperatorTest.java
===================================================================
--- trunk/src/test/java/org/glassfish/el/test/OperatorTest.java (revision 266)
+++ trunk/src/test/java/org/glassfish/el/test/OperatorTest.java (revision 267)
@@ -97,6 +97,9 @@
                 elm.getELContext(), "#${1+1}", Object.class);
         Object ret = v.getValue(elm.getELContext());
         assertEquals(ret, "#2");
+        
+        elp.setVariable("debug", "true");
+        ret = elp.eval("debug == true");
 //        elp.eval("[1,2][true]"); // throws IllegalArgumentExpression
 /*        
         elp.defineBean("date", new Date(2013, 1,2));
Index: trunk/src/test/java/org/glassfish/el/test/StreamTest.java
===================================================================
--- trunk/src/test/java/org/glassfish/el/test/StreamTest.java   (revision 266)
+++ trunk/src/test/java/org/glassfish/el/test/StreamTest.java   (revision 267)
@@ -37,11 +37,12 @@
         System.out.println(msg);
     }
     /**
-     * Test a collection query that returns an Iterable.
+     * Test a collection query that returns an array, list or Iterable.
      * @param name of the test
      * @param query The EL query string
-     * @param expected The expected result of the Iterable.  The array
-     *           element should equal the Iterable element, when enumerated.
+     * @param expected The expected result of the array, list or Iterable.
+     *     The array element should equal the elements in the array, list or
+     *     Iterable, when enumerated.
      */
 
     void testStream(String name, String query, String[] expected) {
Index: trunk/api/src/main/java/javax/el/ELContext.java
===================================================================
--- trunk/api/src/main/java/javax/el/ELContext.java     (revision 266)
+++ trunk/api/src/main/java/javax/el/ELContext.java     (revision 267)
@@ -456,9 +456,12 @@
         boolean propertyResolvedSave = isPropertyResolved();
         try {
             setPropertyResolved(false);
-            Object res = getELResolver().convertToType(this, obj, 
targetType);
-            if (isPropertyResolved()) {
-                return res;
+            ELResolver elResolver = getELResolver();
+            if (elResolver != null) {
+                Object res = elResolver.convertToType(this, obj, targetType);
+                if (isPropertyResolved()) {
+                    return res;
+                }
             }
         } catch (ELException ex) {
             throw ex;





[el-spec commits] [el-spec~source-code:267] Fix NPE when getELResolver() returns null.

kchung 03/28/2013
 
 
Close
loading
Please Confirm
Close