Archiva

EL Expression failed with empty/not functions

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Blocker Blocker
  • Resolution: Fixed
  • Affects Version/s: 1.1
  • Fix Version/s: 1.1.2
  • Component/s: Web Interface
  • Labels:
    None
  • Environment:
    Windows XP SP3 FR
    java (JDK) "1.6.0_07"
    apache tomcat "6.0.18"
    activation-1.1.jar
    mail-1.4.jar
    derby-10.1.3.1.jar
  • Number of attachments :
    3

Description

After installing as Wiki said, as a tomcat WAR, i get parsing error in some JSP/TAG code.

Some examples :

org.apache.jasper.JasperException: /WEB-INF/jsp/components/companyLogo.jsp(22,0) "${!empty(organisationLogo)}" contient d'incorrecte(s) expression(s): javax.el.ELException: Function ':empty' not found
org.apache.jasper.JasperException: /WEB-INF/tags/currentWWUrl.tag(29,0) "${!empty(action) && !empty(namespace)}" contient d'incorrecte(s) expression(s): javax.el.ELException: Function ':empty' not found

I've added logs as attachments.

The workaround is very simple :
replace EL exepressions containing "empty(" with "empty (", and "not(" with "not (" as EL expression requires.

This is a VERY strange error since i've successufully setup Archiva on my profesionnal server, and i got these error on two distinct personnal systems.

I'll check the professionnal/personnal system differences.

  1. catalina.2008-08-10.log
    10/Aug/08 1:06 PM
    73 kB
    Fabrice Daugan
  2. localhost.2008-08-10.log
    10/Aug/08 1:06 PM
    10 kB
    Fabrice Daugan
  3. MRM-905.patch
    15/Aug/08 5:08 AM
    19 kB
    Fabrice Daugan

Activity

Hide
Maria Odea Ching added a comment - - edited

I couldn't replicate this on trunk (-r685734), with the following environment:

  • ubuntu linux
  • java version "1.5.0_11"
  • tomcat 6.0.14
  • activation-1.1.jar, derby-10.1.3.1.jar and mail-1.4.jar
Show
Maria Odea Ching added a comment - - edited I couldn't replicate this on trunk (-r685734), with the following environment:
  • ubuntu linux
  • java version "1.5.0_11"
  • tomcat 6.0.14
  • activation-1.1.jar, derby-10.1.3.1.jar and mail-1.4.jar
Hide
Maria Odea Ching added a comment -

I was now able to replicate this issue when I deployed Archiva to Tomcat 6.0.18. I don't see the error in 5.5.17 and 6.0.14 though.. there must be a conflict with the EL lib included in 6.0.18. I'll try your suggestion above to fix this, thanks!

Show
Maria Odea Ching added a comment - I was now able to replicate this issue when I deployed Archiva to Tomcat 6.0.18. I don't see the error in 5.5.17 and 6.0.14 though.. there must be a conflict with the EL lib included in 6.0.18. I'll try your suggestion above to fix this, thanks!
Hide
Fabrice Daugan added a comment -

Yes!
that's what i just found during the professionnal/personnal system differences.
Same JDK, but 6.0.14 Tomcat version.

Show
Fabrice Daugan added a comment - Yes! that's what i just found during the professionnal/personnal system differences. Same JDK, but 6.0.14 Tomcat version.
Hide
Roman Legat added a comment - - edited

Same here.
My configuration:
Ubuntu Server 8.04
java 1.6.0_06
tomcat 6.0.18
Archiva 1.1.1 deployed as a .war

Stacktrace starts with:
org.apache.jasper.JasperException: /WEB-INF/jsp/admin/repositories.jsp(53,0) "${empty(managedRepositories)}" contains invalid expression(s): javax.el.ELException: Function ':empty' not found
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)

The suggested fix works for me. Fabrice, you made my day!
I ran
sudo sed -i.BAK -e "s/empty(/empty (/g" *.jsp*
sudo sed -i.BAK -e "s/not(/not (/g" *.jsp*
over the jsp folder and it works like a charm.

So the question is, is "empty(" invalid or not. There have been quite some changes in jasper between
6.0.14 and 6.0.18 (http://tomcat.apache.org/tomcat-6.0-doc/changelog.html), but i'm really not into the jsp stuff, so I couldn't tell...

Show
Roman Legat added a comment - - edited Same here. My configuration: Ubuntu Server 8.04 java 1.6.0_06 tomcat 6.0.18 Archiva 1.1.1 deployed as a .war Stacktrace starts with: org.apache.jasper.JasperException: /WEB-INF/jsp/admin/repositories.jsp(53,0) "${empty(managedRepositories)}" contains invalid expression(s): javax.el.ELException: Function ':empty' not found org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40) The suggested fix works for me. Fabrice, you made my day! I ran sudo sed -i.BAK -e "s/empty(/empty (/g" *.jsp* sudo sed -i.BAK -e "s/not(/not (/g" *.jsp* over the jsp folder and it works like a charm. So the question is, is "empty(" invalid or not. There have been quite some changes in jasper between 6.0.14 and 6.0.18 (http://tomcat.apache.org/tomcat-6.0-doc/changelog.html), but i'm really not into the jsp stuff, so I couldn't tell...
Hide
Fabrice Daugan added a comment - - edited

Also, i think there are some common code with Continuum, since the same error (but non blocker) occurs in the header.

As said in the EL specification (simplified version)

${ Expression }
Expression = {(UnaryOp Expression) | Value }
UnaryOp = {'-' | ! | not | empty }
Value = {ValuePrefix | (Value ValueSuffix) }
ValuePrefix = {Literal | '('Expression')' | ImplicitObject | Java language identifier}
ValueSuffix = { . Identifier | '['Expression']'}
Literal = {StringLiteral | null}
StringLiteral = {'[^(' | \) | \' | \\]+' | "[^(" | \) | \" | \\]+"}

If we read well the Tomcat error is right : since the grammar does not validate :
empty("hello")
but validate :
empty ("hello")

Show
Fabrice Daugan added a comment - - edited Also, i think there are some common code with Continuum, since the same error (but non blocker) occurs in the header. As said in the EL specification (simplified version)
${ Expression }
Expression = {(UnaryOp Expression) | Value }
UnaryOp = {'-' | ! | not | empty }
Value = {ValuePrefix | (Value ValueSuffix) }
ValuePrefix = {Literal | '('Expression')' | ImplicitObject | Java language identifier}
ValueSuffix = { . Identifier | '['Expression']'}
Literal = {StringLiteral | null}
StringLiteral = {'[^(' | \) | \' | \\]+' | "[^(" | \) | \" | \\]+"}
If we read well the Tomcat error is right : since the grammar does not validate : empty("hello") but validate : empty ("hello")
Hide
Maria Odea Ching added a comment - - edited

Ok, thanks a lot for both of your help on this! Would either of you like or is interested to submit a patch for the fix?

Show
Maria Odea Ching added a comment - - edited Ok, thanks a lot for both of your help on this! Would either of you like or is interested to submit a patch for the fix?
Hide
Fabrice Daugan added a comment -

The patch did from the revision 686186.
The root path of this patch is http://svn.apache.org/repos/asf/archiva/trunk/archiva-modules/archiva-web/archiva-webapp

Show
Fabrice Daugan added a comment - The patch did from the revision 686186. The root path of this patch is http://svn.apache.org/repos/asf/archiva/trunk/archiva-modules/archiva-web/archiva-webapp
Hide
Maria Odea Ching added a comment -

Thanks for the patch Fabrice! I already applied it in trunk -r686665 and tested it with Tomcat versions 5.5.17, 6.0.14 and 6.0.18. It works nicely

Show
Maria Odea Ching added a comment - Thanks for the patch Fabrice! I already applied it in trunk -r686665 and tested it with Tomcat versions 5.5.17, 6.0.14 and 6.0.18. It works nicely

People

Vote (1)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: