Skip to main content

[el-spec commits] [el-spec~source-code:100] Check for empty import handler

  • From: kchung@...
  • To: commits@...
  • Subject: [el-spec commits] [el-spec~source-code:100] Check for empty import handler
  • Date: Thu, 17 May 2012 22:43:17 +0000

Project:    el-spec
Repository: source-code
Revision:   100
Author:     kchung
Date:       2012-05-17 22:38:00 UTC
Link:       

Log Message:
------------
Check for empty import handler



Revisions:
----------
100


Modified Paths:
---------------
trunk/impl/src/main/java/com/sun/el/parser/AstFunction.java
trunk/impl/src/main/java/com/sun/el/parser/AstValue.java
trunk/impl/src/main/java/com/sun/el/parser/AstType.java


Diffs:
------
Index: trunk/impl/src/main/java/com/sun/el/parser/AstValue.java
===================================================================
--- trunk/impl/src/main/java/com/sun/el/parser/AstValue.java    (revision 99)
+++ trunk/impl/src/main/java/com/sun/el/parser/AstValue.java    (revision 100)
@@ -50,6 +50,7 @@
 import javax.el.ELClass;
 import javax.el.PropertyNotFoundException;
 import javax.el.PropertyNotWritableException;
+import javax.el.ImportHandler;
 
 import com.sun.el.lang.EvaluationContext;
 import com.sun.el.lang.ELSupport;
@@ -149,9 +150,12 @@
         // First check if the base is an imported class
         if (this.children[0] instanceof AstIdentifier) {
             String name = ((AstIdentifier) this.children[0]).image;
-            Class<?> c = ctx.getImportHandler().resolve(name);
-            if (c != null) {
-                return new ELClass(c);
+            ImportHandler importHandler = ctx.getImportHandler();
+            if (importHandler != null) {
+                Class<?> c = importHandler.resolve(name);
+                if (c != null) {
+                    return new ELClass(c);
+                }
             }
         }
         return this.children[0].getValue(ctx);
Index: trunk/impl/src/main/java/com/sun/el/parser/AstType.java
===================================================================
--- trunk/impl/src/main/java/com/sun/el/parser/AstType.java     (revision 99)
+++ trunk/impl/src/main/java/com/sun/el/parser/AstType.java     (revision 100)
@@ -45,6 +45,7 @@
 import javax.el.ELClass;
 import javax.el.ELContext;
 import javax.el.PropertyNotFoundException;
+import javax.el.ImportHandler;
 
 import com.sun.el.lang.EvaluationContext;
 import com.sun.el.util.MessageFactory;
@@ -108,12 +109,15 @@
 
         if (className.indexOf('.') < 0) {
             // No package, assume it has been imported
-            Class<?> c = context.getImportHandler().resolve(className);
-            if (c == null) {
-                throw new PropertyNotFoundException(
+            ImportHandler importHandler = context.getImportHandler();
+            if (importHandler != null) {
+                Class<?> c = importHandler.resolve(className);
+                if (c == null) {
+                    throw new PropertyNotFoundException(
                         MessageFactory.get("error.class.notfound", 
className));
+                }
+                return c;
             }
-            return c;
         }
 
         try {
Index: trunk/impl/src/main/java/com/sun/el/parser/AstFunction.java
===================================================================
--- trunk/impl/src/main/java/com/sun/el/parser/AstFunction.java (revision 99)
+++ trunk/impl/src/main/java/com/sun/el/parser/AstFunction.java (revision 100)
@@ -134,7 +134,7 @@
         // Check to see if a function is a bean that is a Lambdaexpression.
         // If so, invoke it.  Also allow for the case that a Lambda 
expression
         // can return another Lambda expression.
-        if (prefix.length() == 0) {
+        if (prefix.length() == 0 && ctx.getImportHandler() != null) {
             // First check if this is an imported class
             Class<?> c = ctx.getImportHandler().resolve(this.localName);
             if (c != null) {





[el-spec commits] [el-spec~source-code:100] Check for empty import handler

kchung 05/17/2012

<Possible follow-up(s)>

[el-spec commits] [el-spec~source-code:100] Check for empty import handler

kchung 05/17/2012

[el-spec commits] [el-spec~source-code:100] Check for empty import handler

kchung 05/17/2012
 
 
Close
loading
Please Confirm
Close