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/07/31 10:07:00 UTC

[Bug 61364] New: Stream not closed when detecting encoding of a JSP

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

            Bug ID: 61364
           Summary: Stream not closed when detecting encoding of a JSP
           Product: Tomcat 8
           Version: 8.5.16
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Jasper
          Assignee: dev@tomcat.apache.org
          Reporter: peter.stockli@alphabot.com
  Target Milestone: ----

We had an issue that prevented us from deleting certain JSPs in an embedded
Tomcat.
The cause of that seems to be that an InputStream is not closed after trying to
figure out the encoding of a .jsp file.

From our point of view this seems to affect at least Tomcat 8.5.16 with
following classes involved:

org.apache.jasper.compiler.ParserController:
> 321: InputStream inStream = JspUtil.getInputStream(absFileName, jar, ctxt);
> 322: EncodingDetector encodingDetector = new EncodingDetector(inStream);
=> The InputStream is retrieved and passed to the EncodingDetector.


org.apache.jasper.compiler.EncodingDetector:
> 96:  XMLStreamReader xmlStreamReader = XML_INPUT_FACTORY.createXMLStreamReader(stream);
=> The EncodingDetector creates an XMLStreamReader on its static
XML_INPUT_FACTORY.


As a workaround we configured the JspConfig like this to prevent the detection
of the encoding:

> <jsp-config>
>   <jsp-property-group>
>     <url-pattern>*.jsp</url-pattern>
>     <is-xml>false</is-xml>
>   </jsp-property-group>
> </jsp-config>

-- 
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 61364] Stream not closed when detecting encoding of a JSP

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

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

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

--- Comment #1 from Mark Thomas <ma...@apache.org> ---
For anyone trying to reproduce this, you'll need to disable resource caching
for the associated Context.

It is also a lot easier to reproduce on Windows since Windows prevents deletion
of locked files.

This has been fixed in :
- trunk for 9.0.0.M26 onwards
- 8.5.x for 8.5.20 onwards

Many thanks for the report and the analysis to pin-point the issue.

-- 
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