[jira] (MJAVADOC-342) An incomplete fix for the NPE bugs in AbstractJavadocMojo.java
Guangtai Liang created MJAVADOC-342: --- Summary: An incomplete fix for the NPE bugs in AbstractJavadocMojo.java Key: MJAVADOC-342 URL: https://jira.codehaus.org/browse/MJAVADOC-342 Project: Maven 2.x Javadoc Plugin Issue Type: Bug Reporter: Guangtai Liang Priority: Critical The fix revision 554202 was aimed to remove an NPE bug on the returned value of "getJavadocDirectory()" in the method "getSourcePaths " of the file "/maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java" , but it is incomplete. Since the returned value "getJavadocDirectory()" could be null during the runtime execution, its value should also be null-checked before being dereferenced in other methods. The buggy code locations the same fix needs to be applied at are as bellows: Line 2401 of the method "copyJavadocResources"; Line 1505 of the method "getSourcePaths". -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] (MWAR-275) An incomplete fix for the NPE bugs in WebappStructure.java
Guangtai Liang created MWAR-275: --- Summary: An incomplete fix for the NPE bugs in WebappStructure.java Key: MWAR-275 URL: https://jira.codehaus.org/browse/MWAR-275 Project: Maven 2.x WAR Plugin Issue Type: Bug Reporter: Guangtai Liang Priority: Critical The fix revision 712569 was aimed to remove an NPE bug on the value of "dependenciesInfo " in the method "getDependencies" of the file "/maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/util/WebappStructure.java" , but it is incomplete. Since the value "dependenciesInfo " could be null during the runtime execution, its value should also be null-checked before being dereferenced in other methods. The buggy code locations the same fix needs to be applied at are as bellows: Line 389 of the method "registerTargetFileName"; public void registerTargetFileName( Artifact artifact, String targetFileName ) { [Line 389] final Iterator it = dependenciesInfo.iterator(); while ( it.hasNext() ) { DependencyInfo dependencyInfo = (DependencyInfo) it.next(); if ( WarUtils.isRelated( artifact, dependencyInfo.getDependency() ) ) { dependencyInfo.setTargetFileName( targetFileName ); } } } -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] (MPMD-144) An incomplete fix for the resource leak bugs in PmdReport.java
Guangtai Liang created MPMD-144: --- Summary: An incomplete fix for the resource leak bugs in PmdReport.java Key: MPMD-144 URL: https://jira.codehaus.org/browse/MPMD-144 Project: Maven 2.x PMD Plugin Issue Type: Bug Components: PMD Affects Versions: 2.8 Reporter: Guangtai Liang Priority: Critical The fix revision 935344 was aimed to remove an resource leak bug on the OutputStreamWriter object "writer" (created in line 323) in the method "execute()" of the file "/maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReport.java" , but it is incomplete. There are some problems: 1. when "writer" is not created successfully but the FileOutputStream object "tStream" is created successfully at line 322,"tStream" will be leaked. The best way to close such resource objects is putting such close operations in the finaly block of a try-catch-finally structure. The problem still exists in the head revision. The buggy code is copied as bellows: try { targetDirectory.mkdirs(); File targetFile = new File( targetDirectory, "pmd." + format ); 357FileOutputStream tStream = new FileOutputStream( targetFile ); 358writer = new OutputStreamWriter( tStream, getOutputEncoding() ); r.setWriter( writer ); r.start(); r.renderFileReport( report ); r.end(); writer.close(); File siteDir = getReportOutputDirectory(); siteDir.mkdirs(); FileUtils.copyFile( targetFile, new File( siteDir, "pmd." + format ) ); } catch ( IOException ioe ) { throw new MavenReportException( ioe.getMessage(), ioe ); } finally { 376 IOUtil.close( writer ); } -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] (MPMD-145) An incomplete fix for the resource leak bugs in PmdReportTest.java
Guangtai Liang created MPMD-145: --- Summary: An incomplete fix for the resource leak bugs in PmdReportTest.java Key: MPMD-145 URL: https://jira.codehaus.org/browse/MPMD-145 Project: Maven 2.x PMD Plugin Issue Type: Bug Components: PMD Affects Versions: 2.8 Reporter: Guangtai Liang Priority: Critical The fix revision 729532 was aimed to remove an resource leak bug on the BufferedReader object "in" (created in line 240) in the method "readFile()" of the file "/maven/plugins/trunk/maven-pmd- plugin/src/test/java/org/apache/maven/plugin/pmd/PmdReportTest.java" , but it is incomplete. There are some problems: 1. when "in" is not created successfully but the temp FileReader object is created successfully at line 240,the temp FileReader object will be leaked. The best way to close such resource objects is putting such close operations in the finaly block of a try-catch-finally structure. The problem still exists in the head revision. The buggy code is copied as bellows: private String readFile( File file ) throws IOException { String strTmp; StringBuffer str = new StringBuffer( (int) file.length() ); 246BufferedReader in = new BufferedReader( new FileReader( file ) ); while ( ( strTmp = in.readLine() ) != null ) { str.append( ' ' ); str.append( strTmp ); } 253in.close(); return str.toString(); } -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] (MPMD-146) An incomplete fix for the resource leak bugs in CpdReport.java
Guangtai Liang created MPMD-146: --- Summary: An incomplete fix for the resource leak bugs in CpdReport.java Key: MPMD-146 URL: https://jira.codehaus.org/browse/MPMD-146 Project: Maven 2.x PMD Plugin Issue Type: Bug Components: PMD Affects Versions: 2.8 Reporter: Guangtai Liang Priority: Critical The fix revision 730089 was aimed to remove an resource leak bug on the OutputStreamWriter object "writer" (created in line 188) in the method "writeNonHtml()" of the file "/maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/CpdReport.java" , but it is incomplete. There are some problems: 1. when "writer" is not created successfully at line 189 but the FileOutputStream object "tStream" is created successfully at line 188,"tStream" will be leaked. The best way to close such resource objects is putting such close operations for all resource objects in the finaly block of a try-catch-finally structure. Although a later fix (rev935316) tried to fix it, the problem still exists in the head revision. The buggy code is copied as bellows (the object "tStream" needs to be closed at line 220): void writeNonHtml( CPD cpd ) throws MavenReportException { Renderer r = createRenderer(); if ( r == null ) { return; } String buffer = r.render( cpd.getMatches() ); Writer writer = null; try { targetDirectory.mkdirs(); File targetFile = new File( targetDirectory, "cpd." + format ); 220FileOutputStream tStream = new FileOutputStream( targetFile ); 221writer = new OutputStreamWriter( tStream, getOutputEncoding() ); writer.write( buffer ); writer.close(); File siteDir = getReportOutputDirectory(); siteDir.mkdirs(); FileUtils.copyFile( targetFile, new File( siteDir, "cpd." + format ) ); } catch ( IOException ioe ) { throw new MavenReportException( ioe.getMessage(), ioe ); } finally { 235IOUtil.close( writer ); } } -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] (MVERIFIER-12) An incomplete fix for the resource leak bugs in Verifier.java
Guangtai Liang created MVERIFIER-12: --- Summary: An incomplete fix for the resource leak bugs in Verifier.java Key: MVERIFIER-12 URL: https://jira.codehaus.org/browse/MVERIFIER-12 Project: Maven 2.x Verifier Plugin Issue Type: Bug Affects Versions: 1.4 Reporter: Guangtai Liang Priority: Critical The fix revision 1134539 was aimed to remove resource leak bugs on the BufferedReader object "reader"(created in line 421) in the method "loadFile()", the BufferedReader object "reader" (created in line 1538) of the file "/maven/shared/trunk/maven-verifier/src/main/java/org/apache/maven/it/Verifier.java" , but it is incomplete. There are some problems: 1. when "reader" is not created successfully at line 427 but the temp FileReader object is created successfully at line 427,the temp FileReader object will be leaked. 2. when "reader" is not created successfully at line 1541 but the temp FileReader object is created successfully at line 1541,the temp FileReader object will be leaked. The best way to close such resource objects is putting such close operations for all resource objects in the finaly block of a try-catch-finally structure. The problem still exists in the head revision. The buggy code is copied as bellows (the temp objects created at line 427 and 1541 needs to be closed in the finally clause): 416 public List loadFile( File file, boolean hasCommand ) throws VerificationException { List lines = new ArrayList(); BufferedReader reader = null; if ( file.exists() ) { try { 427 reader = new BufferedReader( new FileReader( file ) ); String line = reader.readLine(); while ( line != null ) { line = line.trim(); if ( !line.startsWith( "#" ) && line.length() != 0 ) { lines.addAll( replaceArtifacts( line, hasCommand ) ); } line = reader.readLine(); } reader.close(); } catch ( FileNotFoundException e ) { throw new VerificationException( e ); } catch ( IOException e ) { throw new VerificationException( e ); } finally { 454 IOUtil.close( reader ); } } return lines; } 1535 private void displayLogFile() { System.out.println( "Log file contents:" ); BufferedReader reader = null; try { 1541 reader = new BufferedReader( new FileReader( new File( getBasedir(), getLogFileName () ) ) ); String line = reader.readLine(); while ( line != null ) { System.out.println( line ); line = reader.readLine(); } reader.close(); } catch ( FileNotFoundException e ) { System.err.println( "Error: " + e ); } catch ( IOException e ) { System.err.println( "Error: " + e ); } finally { 1560 IOUtil.close( reader ); } } -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] (DOXIA-461) An incomplete fix for the resource leak bugs in LatexBookRenderer.java
Guangtai Liang created DOXIA-461: Summary: An incomplete fix for the resource leak bugs in LatexBookRenderer.java Key: DOXIA-461 URL: https://jira.codehaus.org/browse/DOXIA-461 Project: Maven Doxia Issue Type: Bug Components: Module - Latex Reporter: Guangtai Liang Priority: Critical The fix revision 740164 was aimed to remove resource leak bugs on the FileWriter object "writer"(created in line 204) and the FileReader object "reader" (created in line 219) in the method "writeSection()"of the file " /maven/doxia/doxia/trunk/doxia-book/src/main/java/org/apache/maven/doxia/book/services/renderer/LatexBookRenderer.java" , but it is incomplete. There are some problems: 1. the LatexBookSink object "sink" is not closed. 2. when the statements at lines 206-215 throw some exception, "writer" will be leaked. The best way to close such resource objects is putting such close operations for all resource objects in the finaly block of a try-catch-finally structure. Although a later fix (rev1003021) try to close "sink", the problems still exists in the head revision. The buggy code is copied as bellows ("sink" and "writer" will be leaked when the statements at lines 202-207 throw some exception): private SectionInfo writeSection( Section section, BookContext context ) throws IOException, BookDoxiaException { File file = new File( context.getOutputDirectory(), ( section.getId() + ".tex" ) ); 198Writer writer = WriterFactory.newWriter( file, context.getOutputEncoding() ); 200LatexBookSink sink = new LatexBookSink( writer ); BookContext.BookFile bookFile = (BookContext.BookFile) context.getFiles().get( section.getId() ); if ( bookFile == null ) { throw new BookDoxiaException( "No document that matches section with id=" + section.getId() + "." ); } Reader reader = null; try { reader = ReaderFactory.newReader( bookFile.getFile(), context.getInputEncoding() ); doxia.parse( reader, bookFile.getParserId(), sink ); } catch ( ParserNotFoundException e ) { throw new BookDoxiaException( "Parser not found: " + bookFile.getParserId() + ".", e ); } catch ( ParseException e ) { throw new BookDoxiaException( "Error while parsing document: " + bookFile.getFile().getAbsolutePath() + ".", e ); } catch ( FileNotFoundException e ) { throw new BookDoxiaException( "Could not find document: " + bookFile.getFile().getAbsolutePath() + ".", e ); } finally { 233sink.flush(); 234sink.close(); 236IOUtil.close( reader ); 237IOUtil.close( writer ); } SectionInfo info = new SectionInfo(); info.id = section.getId(); info.title = sink.getTitle(); return info; } -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] (DOXIA-462) Another incomplete fix for the resource leak bugs in XHtmlBookRenderer.java
Guangtai Liang created DOXIA-462: Summary: Another incomplete fix for the resource leak bugs in XHtmlBookRenderer.java Key: DOXIA-462 URL: https://jira.codehaus.org/browse/DOXIA-462 Project: Maven Doxia Issue Type: Bug Reporter: Guangtai Liang Priority: Critical The fix revision 740164 was aimed to remove resource leak bugs on the FileWriter object "fileWriter" (created in line 84) in the method "renderBook"of the file "/maven/doxia/doxia/trunk/doxia- book/src/main/java/org/apache/maven/doxia/book/services/renderer/XHtmlBookRenderer.java" , but it is incomplete. There are some problems: 1. when the statements at lines 91 throw some exception, "fileWriter" will be leaked. The best way to close such resource objects is putting such close operations for all resource objects in the finaly block of a try-catch-finally structure and then putting all other code in a try block. The problem still exists in the head revision. The buggy code is copied as bellows: public void renderBook( BookContext context ) throws BookDoxiaException { BookModel book = context.getBook(); if ( !context.getOutputDirectory().exists() ) { if ( !context.getOutputDirectory().mkdirs() ) { throw new BookDoxiaException( "Could not make directory: " + context.getOutputDirectory().getAbsolutePath() + "." ); } } File bookFile = new File( context.getOutputDirectory(), book.getId() + ".xhtml" ); Writer fileWriter; try { 84 fileWriter = new FileWriter( bookFile ); } catch ( IOException e ) { throw new BookDoxiaException( "Error while opening file.", e ); } 91XhtmlBookSink sink = new XhtmlBookSink( fileWriter, new RenderingContext( context.getOutputDirectory(), bookFile.getAbsolutePath() ) ); try { sink.bookHead(); .. } finally { sink.flush(); sink.close(); IOUtil.close( fileWriter ); } } -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] (DOXIA-463) An incomplete fix for the resource leak bugs in XdocBookRenderer.java
Guangtai Liang created DOXIA-463: Summary: An incomplete fix for the resource leak bugs in XdocBookRenderer.java Key: DOXIA-463 URL: https://jira.codehaus.org/browse/DOXIA-463 Project: Maven Doxia Issue Type: Bug Reporter: Guangtai Liang Priority: Critical The fix revision 740164 was aimed to remove resource leak bugs on the Writer object "writer" (created in line 177) in the method "writeBookIndex"of the file "/maven/doxia/doxia/trunk/doxia- book/src/main/java/org/apache/maven/doxia/book/services/renderer/XdocBookRenderer.java" , but it is incomplete. There are some problems: 1. when the statements at lines 177 throw some exception, "writer" will be leaked. The best way to close such resource objects is putting such close operations for all resource objects in the finaly block of a try-catch-finally structure and then putting all other code in a try block. The problem still exists in the head revision (when the statements at line 171 throws some exception, "writer" will be leaked). The buggy code is copied as bellows: private void writeBookIndex( File index, BookModel book, BookContext context ) throws IOException { 169Writer writer = WriterFactory.newXmlWriter( index ); 171XdocSink sink = new IndexXdocBookSink( writer, context.getIndex().getFirstEntry(), i18n, context.getLocale() ); try { .. sink.body_(); } finally { 211sink.flush(); 213sink.close(); 215IOUtil.close( writer ); } } -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] (DOXIA-464) An incomplete fix for the resource leak bugs in XdocBookRenderer.java
Guangtai Liang created DOXIA-464: Summary: An incomplete fix for the resource leak bugs in XdocBookRenderer.java Key: DOXIA-464 URL: https://jira.codehaus.org/browse/DOXIA-464 Project: Maven Doxia Issue Type: Bug Reporter: Guangtai Liang Priority: Critical The fix revision 1003021 was aimed to remove resource leak bugs on the SectionXdocBookSink object "sink " (created in line 409) in the method "renderSection"of the file "/maven/doxia/doxia/trunk/doxia-book/src/main/java/org/apache/maven/doxia/book/services/renderer/XdocBookRenderer.java" , but it is incomplete. There are some problems: 1. when the statements at lines 411-418 throw some exception, "sink" will be leaked. The best way to close such resource objects is putting such close operations for all resource objects in the finaly block of a try-catch-finally structure and then putting all other code in a try block. The problem still exists in the head revision. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] (MPTEST-79) An incomplete fix for the resource leak bugs in TestUtils.java
Guangtai Liang created MPTEST-79: Summary: An incomplete fix for the resource leak bugs in TestUtils.java Key: MPTEST-79 URL: https://jira.codehaus.org/browse/MPTEST-79 Project: Maven 1.x Test Plugin Issue Type: Bug Affects Versions: 1.8.3 Reporter: Guangtai Liang Priority: Critical The fix revision 1085807 was aimed to remove resource leak bugs on the BufferedReader object "reader" (created in line 79) in the method "readFile"of the file "/maven/plugin- testing/trunk/maven-test-tools/src/main/java/org/apache/maven/shared/tools/easymock/TestUtils.java" , but it is incomplete. There are some problems: 1. when "reader" isn't created successfully but the temp FileReader object is created successfully, the temp FileReader object will be leaked. The best way to close such resource objects is putting such close operations for all resource objects in the finaly block of a try-catch-finally structure and then putting all other code in a try block. The problem still exists in the head revision. The buggy code is copied as bellows: public static String readFile( File file ) throws IOException { StringBuffer buffer = new StringBuffer(); BufferedReader reader = null; try { 79 reader = new BufferedReader( new FileReader( file ) ); String line = null; while ( ( line = reader.readLine() ) != null ) { if ( buffer.length() > 0 ) { buffer.append( '\n' ); } buffer.append( line ); } return buffer.toString(); } finally { 96 IOUtil.close( reader ); } } -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira