tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felix Schumacher <felix.schumac...@internetallee.de>
Subject Re: svn commit: r1655114 - in /tomcat/tc8.0.x/trunk: ./ java/org/apache/catalina/servlets/DefaultServlet.java
Date Wed, 28 Jan 2015 15:52:15 GMT
Am 28.01.2015 15:36, schrieb Christopher Schultz:
> Felix,
> 
> On 1/27/15 2:21 PM, fschumacher@apache.org wrote:
>> Author: fschumacher
>> Date: Tue Jan 27 19:21:25 2015
>> New Revision: 1655114
>> 
>> URL: http://svn.apache.org/r1655114
>> Log:
>> Close the inputstream that was used to get the content of
>> the readme file. Issue reported by Coverity Scan.
>> 
>> Merged r1654522 from /tomcat/trunk
>> 
>> Modified:
>>     tomcat/tc8.0.x/trunk/   (props changed)
>>     
>> tomcat/tc8.0.x/trunk/java/org/apache/catalina/servlets/DefaultServlet.java
>> 
>> Propchange: tomcat/tc8.0.x/trunk/
>> ------------------------------------------------------------------------------
>> --- svn:mergeinfo (original)
>> +++ svn:mergeinfo Tue Jan 27 19:21:25 2015
>> @@ -1 +1 @@
>> -/tomcat
>> 
>> Modified: 
>> tomcat/tc8.0.x/trunk/java/org/apache/catalina/servlets/DefaultServlet.java
>> URL: 
>> http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/catalina/servlets/DefaultServlet.java?rev=1655114&r1=1655113&r2=1655114&view=diff
>> ==============================================================================
>> --- 
>> tomcat/tc8.0.x/trunk/java/org/apache/catalina/servlets/DefaultServlet.java 
>> (original)
>> +++ 
>> tomcat/tc8.0.x/trunk/java/org/apache/catalina/servlets/DefaultServlet.java 
>> Tue Jan 27 19:21:25 2015
>> @@ -1538,9 +1538,11 @@ public class DefaultServlet extends Http
>>                      directory.getWebappPath() + readmeFile);
>>              if (resource.isFile()) {
>>                  StringWriter buffer = new StringWriter();
>> -                InputStream is = resource.getInputStream();
>> -                copyRange(new InputStreamReader(is),
>> -                        new PrintWriter(buffer));
>> +                try (InputStream is = resource.getInputStream();
>> +                        InputStreamReader reader = new 
>> InputStreamReader(is)) {
>> +                    copyRange(reader, new PrintWriter(buffer));
>> +                } catch (IOException ignored) {
>> +                }
> 
> I know it seems silly and extra, unnecessary code, but I really dislike
> swallowing exceptions like this.
Right, that's why I have added logging in r1655117. I think you will not 
like  r1655115 either :)

Felix
> 
> -chris

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


Mime
View raw message