Tips for cleaning up org.apache.jasper.compiler.Parser issues

It was decided for 2.9 that we'd *like* to try to clean up the 2 org.apache.jasper.compiler.Parser required workarounds that we have in Sakai if the time and scripts are available to do so.

In order to do this we'll need:

  • Some type of script (regex) to find all of the files that have these issues in them
  • Someone to go in and manually (or maybe automatically) fix the problems
  • People to test that the tools still function correctly and no other issues are present. If there are still problems, the scripts that detect issues may need to be updated.

These 2 workarounds are mentioned on Install Tomcat 7 / 8:

-Dorg.apache.jasper.compiler.Parser.STRICT_WHITESPACE=false

  • This was introduced in Tomcat 7.0.5
  • The bug that references this is: https://issues.apache.org/bugzilla/show_bug.cgi?id=49297
  • Summary: "Enforce the rules in the JSP specification for parsing the attributes of custom
    and standard actions that require that the attribute names are unique within an
    element and that there is whitespace before the attribute name."
    Example:
    Bad: <% @include file="/jsp/discussionForum/includes/dfAreaInclude.jsp"%>
    Good: <%@ include file="/jsp/discussionForum/includes/dfAreaInclude.jsp"%>

Bad: <eg:foo att1="1"att2="2"att3="3">
Good <eg:foo att1="1" att2="2" att3="3">

  • No search and replace suggested yet

-Dorg.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false

Example:
Bad: <mytags:tag value="<%= "hi!" %>" /> (Double outside, double inside)
Good:
<mytags:tag value='<%= "hi!" %>' /> (Single outside, double inside)
<mytags:tag value="<%= \"hi!\" %>" /> (Double outside, escaped double inside)
<mytags:tag value='<%= \"name\" %>' /> (Escaped double inside, single outside)