This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 109008 - FileObject's InputStream doesn't get closed
Summary: FileObject's InputStream doesn't get closed
Status: RESOLVED FIXED
Alias: None
Product: soa
Classification: Unclassified
Component: Composite Application (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: _ gmpatil
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-07-06 10:20 UTC by Alexander Zgursky
Modified: 2007-07-26 02:44 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Zgursky 2007-07-06 10:20:15 UTC
There's the following code in
\enterprise\compapp\projectjbi\src\org\netbeans\modules\compapp\javaee\sunresources\ResourceAggregator.java :
...
    public void addResource(FileObject fo) throws Exception {
        Resources inputResources = (Resources) unmarshaller.unmarshal(fo.getInputStream());
                                                                      ^^^^^^^^^^^^^^^^^^^
...

I'm not sure if this really a bug here, but we had similar code in BPEL project which was causing a bug 87550 (Sometimes
BPEL Project can not be saved).
The problem is that fo.getInputStream() puts a read-lock on a file, so it's not possible to modify the file until/unless
you explicitly close the InputStream OR it gets closed as a part of garbage collecting (there's a call to close() in
finalize()). So, it's always better to explicitly close the stream to avoid misleading behavior.
Comment 1 Jun Qian 2007-07-10 02:18:48 UTC
Girish, there are also a few other instances of unclosed input/outputstream in compapp/javaee.
Comment 2 _ gmpatil 2007-07-26 02:44:51 UTC
Fixed.

Change log:
Log:
 109008: Make sure to close all InputStreams  and OutputStreams are closed in comp app/javaee code.
 Also remove unused util classes.

Removed:
  enterprise/compapp/projectjbi/src/org/netbeans/jbi/javeeese/util/ProjectUtil.java
  enterprise/compapp/projectjbi/src/org/netbeans/jbi/javeeese/util/JavaEEProjectFactory.java

Modified:
  enterprise/compapp/projectjbi/src/org/netbeans/modules/compapp/javaee/sunresources/tool/archive/ApplicationArchive.java
  enterprise/compapp/projectjbi/src/org/netbeans/modules/compapp/javaee/sunresources/tool/archive/FileUtil.java
  enterprise/compapp/projectjbi/src/org/netbeans/modules/compapp/javaee/sunresources/tool/archive/EJBArchive.java
 
enterprise/compapp/projectjbi/src/org/netbeans/modules/compapp/javaee/sunresources/tool/archive/SunResourcesDDJaxbHandler.java
  enterprise/compapp/projectjbi/src/org/netbeans/modules/compapp/javaee/codegen/model/WebappProject.java
  enterprise/compapp/projectjbi/src/org/netbeans/modules/compapp/javaee/codegen/model/AbstractProject.java
  enterprise/compapp/projectjbi/src/org/netbeans/modules/compapp/javaee/util/ProjectUtil.java
  enterprise/compapp/projectjbi/src/org/netbeans/modules/compapp/javaee/util/JavaEEProjectFactory.java
  enterprise/compapp/projectjbi/src/org/netbeans/modules/compapp/javaee/sunresources/ResourceAggregator.java
  enterprise/compapp/projectjbi/src/org/netbeans/modules/compapp/javaee/annotation/handler/JarClassFileLoader.java
  enterprise/compapp/projectjbi/src/org/netbeans/modules/compapp/javaee/sunresources/tool/graph/JAXBHandler.java