[ 
https://issues.apache.org/jira/browse/XERCESJ-1556?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Guangtai Liang reopened XERCESJ-1556:
-------------------------------------


There are two possible exceptions this code piece can throw. 

The first exception is  OutOfMemoryError.  In the  constructor of 
"BufferedOutputStream(OutputStream out, int size)" , a new byte array will be 
allocated, which can result a runtime exception (Out of memory exception). When 
this eception happens, rd cannot created but the temp InputStreamReader object 
created at Line 462 or 464 can be created successfully.  This is a very hidden 
problem but it has been focused on by many research work (e.g., ICSE 2010 paper 
: "Effective Interprocedural Resource Leak Detection, by Emina Torlak, and 
SatishChandra")

The second exception is the IllegalArgumentException, which happens when the 
DEFAULT_LINE_LENGTH <= 0 (I think the second exception won't happen in this 
code). 



                
> An incomplete fix for the resource leak bugs in ObjectFactory.java
> ------------------------------------------------------------------
>
>                 Key: XERCESJ-1556
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1556
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: DOM (HTML)
>            Reporter: Guangtai Liang
>            Priority: Critical
>              Labels: incomplete_fix, missing_fixes
>   Original Estimate: 10m
>  Remaining Estimate: 10m
>
> The fix revision 319937 was aimed to remove an resource leak bug on the 
> BufferedReader object  "rd" in the method "findJarServiceProvider" of the 
> file "/xerces/java/trunk/src/org/apache/html/dom/ObjectFactory.java
> " , but it is incomplete. 
> However, when "rd" is not created successfully but the temp InputStreamReader 
> object created at Line 462 or 464 is created successfully, these temp objects 
> will be leaked. 
> The buggy code locations the same fix needs to be applied at are as bellows: 
> Line  462 and 464 of the method "findJarServiceProvider":
>  
>       try {
> [line 462]            rd = new BufferedReader(new InputStreamReader(is, 
> "UTF-8"), DEFAULT_LINE_LENGTH);
>         } catch (java.io.UnsupportedEncodingException e) {
> [line 464]            rd = new BufferedReader(new InputStreamReader(is), 
> DEFAULT_LINE_LENGTH);
>         }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to