Skip to content
This repository was archived by the owner on Aug 17, 2018. It is now read-only.

Commit e816bad

Browse files
author
Kin Man Chung
committed
Modify EL parsing to allow nested {} and lambda expression calls svn path=/trunk/; revision=1445
1 parent d159c9a commit e816bad

3 files changed

Lines changed: 19 additions & 2 deletions

File tree

impl/src/main/java/org/apache/jasper/compiler/ELFunctionMapper.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,10 @@ class Fvisitor extends ELNode.Visitor {
193193
new ArrayList<ELNode.Function>();
194194
Set<String> keys = new HashSet<String>();
195195
public void visit(ELNode.Function n) throws JasperException {
196+
if (n.getUri() == null) {
197+
// Can be a lambda expresion call
198+
return;
199+
}
196200
String key = n.getPrefix() + ":" + n.getName();
197201
if (! keys.contains(key)) {
198202
keys.add(key);

impl/src/main/java/org/apache/jasper/compiler/Parser.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -864,6 +864,7 @@ private void parseELExpression(Node parent, String typeEL)
864864
throws JasperException {
865865
start = reader.mark();
866866
boolean singleQuoted = false, doubleQuoted = false;
867+
int curl = 0;
867868
int currentChar;
868869
do {
869870
// XXX could move this logic to JspReader
@@ -877,9 +878,13 @@ private void parseELExpression(Node parent, String typeEL)
877878
err.jspError(start, "jsp.error.unterminated", typeEL);
878879
if (currentChar == '"')
879880
doubleQuoted = !doubleQuoted;
880-
if (currentChar == '\'')
881+
else if (currentChar == '\'')
881882
singleQuoted = !singleQuoted;
882-
} while (currentChar != '}' || (singleQuoted || doubleQuoted));
883+
else if (currentChar == '{')
884+
curl++;
885+
else if (currentChar == '}')
886+
curl--;
887+
} while (currentChar != '}' || curl >= 0 || singleQuoted || doubleQuoted);
883888

884889
String text = typeEL + reader.getText(start, reader.mark());
885890
new Node.ELExpression(text, start, parent);

impl/src/main/java/org/apache/jasper/compiler/Validator.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1596,8 +1596,12 @@ public void visit(ELNode.Function func) throws JasperException {
15961596

15971597
if (uri == null) {
15981598
if (prefix == null) {
1599+
// in EL 3.0, this can be a lambda expression call.
1600+
return;
1601+
/*
15991602
err.jspError(n, "jsp.error.noFunctionPrefix",
16001603
function);
1604+
*/
16011605
}
16021606
else {
16031607
err.jspError(n,
@@ -1720,6 +1724,10 @@ class MapperELVisitor extends ELNode.Visitor {
17201724

17211725
public void visit(ELNode.Function n) throws JasperException {
17221726

1727+
if (n.getUri() == null) {
1728+
// Can be a lambda expression call
1729+
return;
1730+
}
17231731
Class<?> c = null;
17241732
Method method = null;
17251733
try {

0 commit comments

Comments
 (0)