[jbosstools-commits] JBoss Tools SVN: r43686 - trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ca.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Fri Sep 14 05:29:50 EDT 2012


Author: vrubezhny
Date: 2012-09-14 05:29:49 -0400 (Fri, 14 Sep 2012)
New Revision: 43686

Modified:
   trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ca/AbstractELCompletionEngine.java
Log:
JBIDE-12609
NPE when validating EL which uses java.util.Map 

Issue is fixed

Modified: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ca/AbstractELCompletionEngine.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ca/AbstractELCompletionEngine.java	2012-09-14 09:25:38 UTC (rev 43685)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ca/AbstractELCompletionEngine.java	2012-09-14 09:29:49 UTC (rev 43686)
@@ -642,6 +642,7 @@
 				if (left != expr) { // inside expression
 					JavaMemberELSegmentImpl lastSegment = segment;
 					segment = new JavaMemberELSegmentImpl(left.getLastToken());
+					boolean skipSegment = false;
 					if(left instanceof ELArgumentInvocation) { 
 						List<MemberInfo> ms = new ArrayList<MemberInfo>(members);
 						members.clear();
@@ -654,6 +655,7 @@
 								if(type!=null) {
 									try {
 										if(TypeInfoCollector.isInstanceofType(type, "java.util.Map")) { //$NON-NLS-1$
+											skipSegment = true;
 											String s = "#{" + left.getLeft().toString() + ".values().iterator().next()}"; //$NON-NLS-1$ //$NON-NLS-2$
 											if(getParserFactory()!=null) {
 												ELParser p = getParserFactory().createParser();
@@ -665,7 +667,9 @@
 													resolution.setLastResolvedToken(left);
 												}
 											}
+											segment = lastSegment;
 										} else if(TypeInfoCollector.isInstanceofType(type, "java.util.Collection")) { //$NON-NLS-1$
+											skipSegment = true;
 											String s = "#{" + left.getLeft().toString() + collectionAdditionForCollectionDataModel + "}"; //$NON-NLS-1$ //$NON-NLS-2$
 											if(getParserFactory()!=null) {
 												ELParser p = getParserFactory().createParser();
@@ -676,6 +680,7 @@
 													resolution.setLastResolvedToken(left);
 												}
 											}
+											segment = lastSegment;
 										}
 									} catch (JavaModelException e) {
 										log(e);
@@ -705,7 +710,8 @@
 						segment.setResolved(true);
 						segment.setMemberInfo(members.get(0));	// TODO: This is a buggy way to select a member to setup in a segment
 					}
-					resolution.addSegment(segment);
+					if (!skipSegment)
+						resolution.addSegment(segment);
 				} else { // Last segment
 					resolveLastSegment((ELInvocationExpression)operand, members, resolution, returnEqualedVariablesOnly, varIsUsed);
 					break;



More information about the jbosstools-commits mailing list