You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2017/10/10 14:34:37 UTC

[Bug 61604] New: IllegalStateException in SmapStratum on empty JSP

https://bz.apache.org/bugzilla/show_bug.cgi?id=61604

            Bug ID: 61604
           Summary: IllegalStateException in SmapStratum on empty JSP
           Product: Tomcat 9
           Version: 9.0.1
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Jasper
          Assignee: dev@tomcat.apache.org
          Reporter: apache@stefan-sielaff.de
  Target Milestone: -----

We use a JSP that is included at several points to inject data into pages. At
the moment the whole content is commented out.

Tomcat 8.5 (production environment) ignores that page, respectively generates
no output as expected. Tomcat 9.0.1 (development environment) throws an
IllegalstateException. This is caused by a change in SmapStratum, which
previously returned null on getString() if lineData was null, now it throws an
unhandled exception.

Reproduction:

Create an "empty" JSP or one containing only JSP comments and using
trimDirectiveWhitespaces="true":

<%@ page pageEncoding="UTF-8" contentType="text/html; charset=utf-8"
language="java" import="java.util.Vector" errorPage=""
trimDirectiveWhitespaces="true" %>
<%-- This is a comment --%>

Result:

java.lang.IllegalStateException
        at
org.apache.jasper.compiler.SmapStratum.getSmapStringInternal(SmapStratum.java:318)
        at
org.apache.jasper.compiler.SmapStratum.getSmapString(SmapStratum.java:304)
        at org.apache.jasper.compiler.SmapUtil.installSmap(SmapUtil.java:145)
        at
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:473)
[...]

Expected result:

an empty page

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 61604] IllegalStateException in SmapStratum on empty JSP

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61604

--- Comment #1 from stef.an <ap...@stefan-sielaff.de> ---
Sorry, of course lineData is not null at that point, it is the empty array
causing the exception being thrown.

// print our StratumSection, FileSection, and LineSections
if (fileNameList.size() == 0 || lineData.size() == 0) {
  throw new IllegalStateException();
}

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 61604] IllegalStateException in SmapStratum on empty JSP

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61604

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Mark Thomas <ma...@apache.org> ---
Thanks for the report. This has been fixed for 9.0.2 onwards.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 61604] IllegalStateException in SmapStratum on empty JSP

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61604

--- Comment #3 from Mark Thomas <ma...@apache.org> ---
Going back to the SMAP spec, it is legal for there to be zero LineInfo lines so
the lineData.size() == 0 test can be removed.

I'll double-check the rest of the spec while I am at it.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 61604] IllegalStateException in SmapStratum on empty JSP

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61604

--- Comment #2 from Remy Maucherat <re...@apache.org> ---
So this was done during the (major) 49176 enhancement in r1800201.
Switching back to returning null will likely cause some NPEs in some cases, but
this used to be the case before from what I can see.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org