Lỗi javax.el.elexception failed to parse the expression

causes the following ParseException. It is a pathological pattern but was accepted before introducing lambda.

Caused by: javax.el.ELException: Error Parsing: ${[var]}
        at com.sun.el.lang.ExpressionBuilder.createNodeInternal[ExpressionBuilder.java:213]
        at com.sun.el.lang.ExpressionBuilder.build[ExpressionBuilder.java:237]
        at com.sun.el.lang.ExpressionBuilder.createValueExpression[ExpressionBuilder.java:295]
        at com.sun.el.ExpressionFactoryImpl.createValueExpression[ExpressionFactoryImpl.java:112]
        at org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate[PageContextImpl.java:916]
        at org.apache.jsp.test2_jsp._jspService[test2_jsp.java:96]
        at org.apache.jasper.runtime.HttpJspBase.service[HttpJspBase.java:70]
        at javax.servlet.http.HttpServlet.service[HttpServlet.java:790]
        at org.apache.jasper.servlet.JspServletWrapper.service[JspServletWrapper.java:433]
        ... 31 more
Caused by: com.sun.el.parser.ParseException: Encountered "}" at line 1, column 10.
Was expecting:
    "->" ...
        at com.sun.el.parser.ELParser.generateParseException[ELParser.java:2963]
        at com.sun.el.parser.ELParser.jj_consume_token[ELParser.java:2845]
        at com.sun.el.parser.ELParser.LambdaExpression[ELParser.java:295]
        at com.sun.el.parser.ELParser.Assignment[ELParser.java:226]
        at com.sun.el.parser.ELParser.SemiColon[ELParser.java:181]
        at com.sun.el.parser.ELParser.Expression[ELParser.java:174]
        at com.sun.el.parser.ELParser.DynamicExpression[ELParser.java:146]
        at com.sun.el.parser.ELParser.CompositeExpression[ELParser.java:43]
        at com.sun.el.lang.ExpressionBuilder.createNodeInternal[ExpressionBuilder.java:182]
        ... 39 more

The parser is trying to interpret it as LambdaParameters. Some other examples:

**Good**${var}
${-[var]}
${[3]*4}

Best Java code snippets using javax.servlet.jsp.el.ELException [Showing top 20 results out of 315]

@SuppressWarnings["rawtypes"] protected Object doEvaluate[String expression, Class expectedType, javax.servlet.jsp.el.FunctionMapper functionMapper]

throws javax.servlet.jsp.el.ELException {
try {
return ExpressionEvaluatorManager.evaluate["JSP EL expression", expression, expectedType, this.pageContext];
} catch [JspException ex] {
throw new [javax.servlet.jsp.el.ELException][//www.tabnine.com/code/java/methods/javax.servlet.jsp.el.ELException/%3Cinit%3E]["Parsing of JSP EL expression \"" + expression + "\" failed", ex];
} }

@Override public Object getValue[ELContext context, Object base, Object property] { Objects.requireNonNull[context]; if [base == null] {

context.setPropertyResolved[base, property];
if [property != null] {
  try {
    return this.variableResolver.resolveVariable[property
        .toString[]];
  } catch [javax.servlet.jsp.el.ELException e] {
    throw new ELException[e.[getMessage][//www.tabnine.com/code/java/methods/javax.servlet.jsp.el.ELException/getMessage][], e.[getCause][//www.tabnine.com/code/java/methods/javax.servlet.jsp.el.ELException/getCause][]];
  }
}
} if [!context.isPropertyResolved[]] {
return elResolver.getValue[context, base, property];
} return null; }

} catch [ELException e] { throw new SCXMLExpressionException["eval['" + expr + "']:"

  • e.getMessage[], e];

public Throwable getRootCause[] { return getCause[]; } }

@SuppressWarnings[{"unchecked", "deprecation"}] public T evaluate[String expr, Class clazz] throws Exception { ELEvaluator existing = current.get[]; try {

current.set[this];
return [T] evaluator.evaluate[expr, clazz, context, context];
} catch [ELException ex] {
if [ex.[getRootCause][//www.tabnine.com/code/java/methods/javax.servlet.jsp.el.ELException/getRootCause][] instanceof Exception] {
  throw [Exception] ex.[getRootCause][//www.tabnine.com/code/java/methods/javax.servlet.jsp.el.ELException/getRootCause][];
}
else {
  throw ex;
}
} finally {
current.set[existing];
} }

@Override public Class getType[ELContext context, Object base, Object property] { Objects.requireNonNull[context]; if [base == null] {

context.setPropertyResolved[base, property];
if [property != null] {
  try {
    Object obj = this.variableResolver.resolveVariable[property
        .toString[]];
    return [obj != null] ? obj.getClass[] : null;
  } catch [javax.servlet.jsp.el.ELException e] {
    throw new ELException[e.[getMessage][//www.tabnine.com/code/java/methods/javax.servlet.jsp.el.ELException/getMessage][], e.[getCause][//www.tabnine.com/code/java/methods/javax.servlet.jsp.el.ELException/getCause][]];
  }
}
} if [!context.isPropertyResolved[]] {
return elResolver.getType[context, base, property];
} return null; }

public Boolean evalCond[final Context ctx, final String expr] throws SCXMLExpressionException { if [expr == null] {
return null;
} VariableResolver vr = null; if [ctx instanceof VariableResolver] {
vr = [VariableResolver] ctx;
} else {
vr = new ContextWrapper[ctx];
} try {
String evalExpr = inFct.matcher[expr].
  replaceAll["In[_ALL_STATES, "];
evalExpr = dataFct.matcher[evalExpr].
  replaceAll["Data[_ALL_NAMESPACES, "];
Boolean rslt = [Boolean] getEvaluator[].evaluate[evalExpr,
  Boolean.class, vr, builtinFnMapper];
if [log.isDebugEnabled[]] {
  log.debug[expr + " = " + String.valueOf[rslt]];
}
return rslt;
} catch [ELException e] {
throw new SCXMLExpressionException["eval['" + expr + "']:"
  • e.getMessage[], e]; } }

public Throwable getRootCause[] {

return [getCause][//www.tabnine.com/code/java/methods/javax.servlet.jsp.el.ELException/getCause][];
} }

@SuppressWarnings[{"unchecked", "deprecation"}] public T evaluate[String expr, Class clazz] throws Exception { ELEvaluator existing = current.get[]; try {

current.set[this];
return [T] evaluator.evaluate[expr, clazz, context, context];
} catch [ELException ex] {
if [ex.[getRootCause][//www.tabnine.com/code/java/methods/javax.servlet.jsp.el.ELException/getRootCause][] instanceof Exception] {
  throw [Exception] ex.[getRootCause][//www.tabnine.com/code/java/methods/javax.servlet.jsp.el.ELException/getRootCause][];
}
else {
  throw ex;
}
} finally {
current.set[existing];
} }

@SuppressWarnings["rawtypes"] protected Object doEvaluate[String expression, Class expectedType, javax.servlet.jsp.el.FunctionMapper functionMapper]

throws javax.servlet.jsp.el.ELException {
try {
return ExpressionEvaluatorManager.evaluate["JSP EL expression", expression, expectedType, this.pageContext];
} catch [JspException ex] {
throw new [javax.servlet.jsp.el.ELException][//www.tabnine.com/code/java/methods/javax.servlet.jsp.el.ELException/%3Cinit%3E]["Parsing of JSP EL expression \"" + expression + "\" failed", ex];
} }

@Override public Object getValue[ELContext context, Object base, Object property] { Objects.requireNonNull[context]; if [base == null] {

context.setPropertyResolved[base, property];
if [property != null] {
  try {
    return this.variableResolver.resolveVariable[property
        .toString[]];
  } catch [javax.servlet.jsp.el.ELException e] {
    throw new ELException[e.[getMessage][//www.tabnine.com/code/java/methods/javax.servlet.jsp.el.ELException/getMessage][], e.[getCause][//www.tabnine.com/code/java/methods/javax.servlet.jsp.el.ELException/getCause][]];
  }
}
} if [!context.isPropertyResolved[]] {
return elResolver.getValue[context, base, property];
} return null; }

0

@Override public Object getValue[ELContext context, Object base, Object property] { Objects.requireNonNull[context]; if [base == null] {

context.setPropertyResolved[base, property];
if [property != null] {
  try {
    return this.variableResolver.resolveVariable[property
        .toString[]];
  } catch [javax.servlet.jsp.el.ELException e] {
    throw new ELException[e.[getMessage][//www.tabnine.com/code/java/methods/javax.servlet.jsp.el.ELException/getMessage][], e.[getCause][//www.tabnine.com/code/java/methods/javax.servlet.jsp.el.ELException/getCause][]];
  }
}
} if [!context.isPropertyResolved[]] {
return elResolver.getValue[context, base, property];
} return null; }

1

@Override public Object getValue[ELContext context, Object base, Object property] { Objects.requireNonNull[context]; if [base == null] {

context.setPropertyResolved[base, property];
if [property != null] {
  try {
    return this.variableResolver.resolveVariable[property
        .toString[]];
  } catch [javax.servlet.jsp.el.ELException e] {
    throw new ELException[e.[getMessage][//www.tabnine.com/code/java/methods/javax.servlet.jsp.el.ELException/getMessage][], e.[getCause][//www.tabnine.com/code/java/methods/javax.servlet.jsp.el.ELException/getCause][]];
  }
}
} if [!context.isPropertyResolved[]] {
return elResolver.getValue[context, base, property];
} return null; }

2

@Override public Object getValue[ELContext context, Object base, Object property] { Objects.requireNonNull[context]; if [base == null] {

context.setPropertyResolved[base, property];
if [property != null] {
  try {
    return this.variableResolver.resolveVariable[property
        .toString[]];
  } catch [javax.servlet.jsp.el.ELException e] {
    throw new ELException[e.[getMessage][//www.tabnine.com/code/java/methods/javax.servlet.jsp.el.ELException/getMessage][], e.[getCause][//www.tabnine.com/code/java/methods/javax.servlet.jsp.el.ELException/getCause][]];
  }
}
} if [!context.isPropertyResolved[]] {
return elResolver.getValue[context, base, property];
} return null; }

3

@Override public Object getValue[ELContext context, Object base, Object property] { Objects.requireNonNull[context]; if [base == null] {

context.setPropertyResolved[base, property];
if [property != null] {
  try {
    return this.variableResolver.resolveVariable[property
        .toString[]];
  } catch [javax.servlet.jsp.el.ELException e] {
    throw new ELException[e.[getMessage][//www.tabnine.com/code/java/methods/javax.servlet.jsp.el.ELException/getMessage][], e.[getCause][//www.tabnine.com/code/java/methods/javax.servlet.jsp.el.ELException/getCause][]];
  }
}
} if [!context.isPropertyResolved[]] {
return elResolver.getValue[context, base, property];
} return null; }

4

} catch [ELException e] { throw new SCXMLExpressionException["eval['" + expr + "']:"

  • e.getMessage[], e];

@Override public Object getValue[ELContext context, Object base, Object property] { Objects.requireNonNull[context]; if [base == null] {

context.setPropertyResolved[base, property];
if [property != null] {
  try {
    return this.variableResolver.resolveVariable[property
        .toString[]];
  } catch [javax.servlet.jsp.el.ELException e] {
    throw new ELException[e.[getMessage][//www.tabnine.com/code/java/methods/javax.servlet.jsp.el.ELException/getMessage][], e.[getCause][//www.tabnine.com/code/java/methods/javax.servlet.jsp.el.ELException/getCause][]];
  }
}
} if [!context.isPropertyResolved[]] {
return elResolver.getValue[context, base, property];
} return null; }

6

@Override public Object getValue[ELContext context, Object base, Object property] { Objects.requireNonNull[context]; if [base == null] {

context.setPropertyResolved[base, property];
if [property != null] {
  try {
    return this.variableResolver.resolveVariable[property
        .toString[]];
  } catch [javax.servlet.jsp.el.ELException e] {
    throw new ELException[e.[getMessage][//www.tabnine.com/code/java/methods/javax.servlet.jsp.el.ELException/getMessage][], e.[getCause][//www.tabnine.com/code/java/methods/javax.servlet.jsp.el.ELException/getCause][]];
  }
}
} if [!context.isPropertyResolved[]] {
return elResolver.getValue[context, base, property];
} return null; }

7

Chủ Đề