Konstantin, On 11/21/14 3:59 PM, Konstantin Kolinko wrote: > 2014-11-21 22:01 GMT+03:00 <schu...@apache.org>: >> Author: schultz >> Date: Fri Nov 21 19:01:45 2014 >> New Revision: 1640978 >> >> URL: http://svn.apache.org/r1640978 >> Log: >> Fix Coverty issue 45276: close Jar resource after use. >> >> Modified: >> tomcat/trunk/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java >> >> Modified: >> tomcat/trunk/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java >> URL: >> http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java?rev=1640978&r1=1640977&r2=1640978&view=diff >> ============================================================================== >> --- tomcat/trunk/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java >> (original) >> +++ tomcat/trunk/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java Fri >> Nov 21 19:01:45 2014 >> @@ -124,12 +124,9 @@ class TagLibraryInfoImpl extends TagLibr >> tldResourcePath = generateTldResourcePath(uri, ctxt); >> } >> >> - Jar jar; >> + Jar jar = null; >> try { >> jar = tldResourcePath.getJar(); > > Good catch. > > The "getJar()" method creates a Jar (with JarFactory.newInstance(..)), > but it is a bit unexpected from a getter method.
Coverty found it... I just confirmed it by inspection. >> - } catch (IOException ioe) { >> - throw new JasperException(ioe); >> - } >> >> // Add the dependencies on the TLD to the referencing page >> PageInfo pageInfo = ctxt.createCompiler().getPageInfo(); >> @@ -218,6 +215,14 @@ class TagLibraryInfoImpl extends TagLibr >> this.tags = tagInfos.toArray(new TagInfo[tagInfos.size()]); >> this.tagFiles = tagFileInfos.toArray(new >> TagFileInfo[tagFileInfos.size()]); >> this.functions = functionInfos.toArray(new >> FunctionInfo[functionInfos.size()]); >> + } catch (IOException ioe) { >> + throw new JasperException(ioe); >> + } >> + finally >> + { > > Your code formatting is odd. It would better be " } finally { ". Sorry... that's my habit on other projects. I had also intended to commit another patch with indentation fixed, but I see you have already done that. I wanted 2 commits to make it easier to see the functional changes versus the formatting ones. -chris
signature.asc
Description: OpenPGP digital signature