You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Romain Manni-Bucau <rm...@gmail.com> on 2016/10/13 12:13:29 UTC

Re: getResourceAsStream() for a folder

@Svetlin: thanks to catch it, was intended for dev@tomcat (thanks gmail to
have completion ;))

dev@tomcat: can you check please the original question (in short:
getResourceAsStream("/some/folder")
returns a stream)


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-10-13 13:59 GMT+02:00 Svetlin Zarev <sv...@gmail.com>:

> Hi,
>
> IMO this is a bug introduced with [1][2]. Although the root cause is in the
> bad impl. of FileResource [3] that ignores the IOException and despite the
> error, still returns a byte[] as if nothing bad happened.
>
>
> [1] https://bz.apache.org/bugzilla/show_bug.cgi?id=60146
> [2]
> https://github.com/apache/tomcat85/blob/5768426dd27422747f2b9b4da5a092
> 7ee3328ffb/java/org/apache/catalina/webresources/CachedResource.java#L267
> [3]
> https://github.com/apache/tomcat85/blob/5768426dd27422747f2b9b4da5a092
> 7ee3328ffb/java/org/apache/catalina/webresources/FileResource.java#L203
>
> PS: Maybe this should be forwarded to the tomcat dev list ?
>
> Kind regards,
> Svetlin
>
> 2016-10-13 12:06 GMT+03:00 Romain Manni-Bucau <rm...@gmail.com>:
>
> > Hi guys,
> >
> > upgrading tomee to tomcat 8.5.6 I noticed request.getServletContext().
> > getResourceAsStream(path) now returns an empty stream for / (or an
> existing
> > folder probably). Not sure it is expected or unintended.
> >
> > Reading the spec it is not that clear to me since the folder is an
> existing
> > resource but not really a webresource so not it should be considered as a
> > resource and therefore having a stream (which doesn't mean much for a
> > folder).
> >
> > Romain Manni-Bucau
> > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
> > <http://rmannibucau.wordpress.com> | Github <https://github.com/
> > rmannibucau> |
> > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > <http://www.tomitribe.com> | JavaEE Factory
> > <https://javaeefactory-rmannibucau.rhcloud.com>
> >
>

Re: getResourceAsStream() for a folder

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Thanks Mark!


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-10-13 16:05 GMT+02:00 Mark Thomas <ma...@apache.org>:

> On 13/10/2016 14:27, Mark Thomas wrote:
> > On 13/10/2016 13:13, Romain Manni-Bucau wrote:
> >> @Svetlin: thanks to catch it, was intended for dev@tomcat (thanks
> gmail to
> >> have completion ;))
> >>
> >> dev@tomcat: can you check please the original question (in short:
> >> getResourceAsStream("/some/folder")
> >> returns a stream)
> >
> > Thanks for the heads up. I'll take a look.
>
> Fixed.
>
> Mark
>
> >> Romain Manni-Bucau
> >> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> >> <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
> >> <http://rmannibucau.wordpress.com> | Github <https://github.com/
> rmannibucau> |
> >> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> >> <http://www.tomitribe.com> | JavaEE Factory
> >> <https://javaeefactory-rmannibucau.rhcloud.com>
> >>
> >> 2016-10-13 13:59 GMT+02:00 Svetlin Zarev <svetlin.angelov.zarev@gmail.
> com>:
> >>
> >>> Hi,
> >>>
> >>> IMO this is a bug introduced with [1][2]. Although the root cause is
> in the
> >>> bad impl. of FileResource [3] that ignores the IOException and despite
> the
> >>> error, still returns a byte[] as if nothing bad happened.
> >>>
> >>>
> >>> [1] https://bz.apache.org/bugzilla/show_bug.cgi?id=60146
> >>> [2]
> >>> https://github.com/apache/tomcat85/blob/5768426dd27422747f2b9b4da5a092
> >>> 7ee3328ffb/java/org/apache/catalina/webresources/
> CachedResource.java#L267
> >>> [3]
> >>> https://github.com/apache/tomcat85/blob/5768426dd27422747f2b9b4da5a092
> >>> 7ee3328ffb/java/org/apache/catalina/webresources/
> FileResource.java#L203
> >>>
> >>> PS: Maybe this should be forwarded to the tomcat dev list ?
> >>>
> >>> Kind regards,
> >>> Svetlin
> >>>
> >>> 2016-10-13 12:06 GMT+03:00 Romain Manni-Bucau <rm...@gmail.com>:
> >>>
> >>>> Hi guys,
> >>>>
> >>>> upgrading tomee to tomcat 8.5.6 I noticed request.getServletContext().
> >>>> getResourceAsStream(path) now returns an empty stream for / (or an
> >>> existing
> >>>> folder probably). Not sure it is expected or unintended.
> >>>>
> >>>> Reading the spec it is not that clear to me since the folder is an
> >>> existing
> >>>> resource but not really a webresource so not it should be considered
> as a
> >>>> resource and therefore having a stream (which doesn't mean much for a
> >>>> folder).
> >>>>
> >>>> Romain Manni-Bucau
> >>>> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> >>>> <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
> >>>> <http://rmannibucau.wordpress.com> | Github <https://github.com/
> >>>> rmannibucau> |
> >>>> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> >>>> <http://www.tomitribe.com> | JavaEE Factory
> >>>> <https://javaeefactory-rmannibucau.rhcloud.com>
> >>>>
> >>>
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: dev-help@tomcat.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
>

Re: getResourceAsStream() for a folder

Posted by Mark Thomas <ma...@apache.org>.
On 13/10/2016 14:27, Mark Thomas wrote:
> On 13/10/2016 13:13, Romain Manni-Bucau wrote:
>> @Svetlin: thanks to catch it, was intended for dev@tomcat (thanks gmail to
>> have completion ;))
>>
>> dev@tomcat: can you check please the original question (in short:
>> getResourceAsStream("/some/folder")
>> returns a stream)
> 
> Thanks for the heads up. I'll take a look.

Fixed.

Mark

>> Romain Manni-Bucau
>> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
>> <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
>> <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
>> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
>> <http://www.tomitribe.com> | JavaEE Factory
>> <https://javaeefactory-rmannibucau.rhcloud.com>
>>
>> 2016-10-13 13:59 GMT+02:00 Svetlin Zarev <sv...@gmail.com>:
>>
>>> Hi,
>>>
>>> IMO this is a bug introduced with [1][2]. Although the root cause is in the
>>> bad impl. of FileResource [3] that ignores the IOException and despite the
>>> error, still returns a byte[] as if nothing bad happened.
>>>
>>>
>>> [1] https://bz.apache.org/bugzilla/show_bug.cgi?id=60146
>>> [2]
>>> https://github.com/apache/tomcat85/blob/5768426dd27422747f2b9b4da5a092
>>> 7ee3328ffb/java/org/apache/catalina/webresources/CachedResource.java#L267
>>> [3]
>>> https://github.com/apache/tomcat85/blob/5768426dd27422747f2b9b4da5a092
>>> 7ee3328ffb/java/org/apache/catalina/webresources/FileResource.java#L203
>>>
>>> PS: Maybe this should be forwarded to the tomcat dev list ?
>>>
>>> Kind regards,
>>> Svetlin
>>>
>>> 2016-10-13 12:06 GMT+03:00 Romain Manni-Bucau <rm...@gmail.com>:
>>>
>>>> Hi guys,
>>>>
>>>> upgrading tomee to tomcat 8.5.6 I noticed request.getServletContext().
>>>> getResourceAsStream(path) now returns an empty stream for / (or an
>>> existing
>>>> folder probably). Not sure it is expected or unintended.
>>>>
>>>> Reading the spec it is not that clear to me since the folder is an
>>> existing
>>>> resource but not really a webresource so not it should be considered as a
>>>> resource and therefore having a stream (which doesn't mean much for a
>>>> folder).
>>>>
>>>> Romain Manni-Bucau
>>>> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
>>>> <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
>>>> <http://rmannibucau.wordpress.com> | Github <https://github.com/
>>>> rmannibucau> |
>>>> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
>>>> <http://www.tomitribe.com> | JavaEE Factory
>>>> <https://javaeefactory-rmannibucau.rhcloud.com>
>>>>
>>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: getResourceAsStream() for a folder

Posted by Mark Thomas <ma...@apache.org>.
On 13/10/2016 13:13, Romain Manni-Bucau wrote:
> @Svetlin: thanks to catch it, was intended for dev@tomcat (thanks gmail to
> have completion ;))
> 
> dev@tomcat: can you check please the original question (in short:
> getResourceAsStream("/some/folder")
> returns a stream)

Thanks for the heads up. I'll take a look.

Mark

> 
> 
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
> <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com> | JavaEE Factory
> <https://javaeefactory-rmannibucau.rhcloud.com>
> 
> 2016-10-13 13:59 GMT+02:00 Svetlin Zarev <sv...@gmail.com>:
> 
>> Hi,
>>
>> IMO this is a bug introduced with [1][2]. Although the root cause is in the
>> bad impl. of FileResource [3] that ignores the IOException and despite the
>> error, still returns a byte[] as if nothing bad happened.
>>
>>
>> [1] https://bz.apache.org/bugzilla/show_bug.cgi?id=60146
>> [2]
>> https://github.com/apache/tomcat85/blob/5768426dd27422747f2b9b4da5a092
>> 7ee3328ffb/java/org/apache/catalina/webresources/CachedResource.java#L267
>> [3]
>> https://github.com/apache/tomcat85/blob/5768426dd27422747f2b9b4da5a092
>> 7ee3328ffb/java/org/apache/catalina/webresources/FileResource.java#L203
>>
>> PS: Maybe this should be forwarded to the tomcat dev list ?
>>
>> Kind regards,
>> Svetlin
>>
>> 2016-10-13 12:06 GMT+03:00 Romain Manni-Bucau <rm...@gmail.com>:
>>
>>> Hi guys,
>>>
>>> upgrading tomee to tomcat 8.5.6 I noticed request.getServletContext().
>>> getResourceAsStream(path) now returns an empty stream for / (or an
>> existing
>>> folder probably). Not sure it is expected or unintended.
>>>
>>> Reading the spec it is not that clear to me since the folder is an
>> existing
>>> resource but not really a webresource so not it should be considered as a
>>> resource and therefore having a stream (which doesn't mean much for a
>>> folder).
>>>
>>> Romain Manni-Bucau
>>> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
>>> <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
>>> <http://rmannibucau.wordpress.com> | Github <https://github.com/
>>> rmannibucau> |
>>> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
>>> <http://www.tomitribe.com> | JavaEE Factory
>>> <https://javaeefactory-rmannibucau.rhcloud.com>
>>>
>>
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org