This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Patch: close I/O channels when a process ends
- From: Andrew Haley <aph at redhat dot com>
- To: java-patches at gcc dot gnu dot org
- Date: Wed, 4 Aug 2004 18:51:43 +0100
- Subject: Patch: close I/O channels when a process ends
I ran out of file handles. Was there any reason we weren't closing the
files in Process.waitFor?
Andrew.
2004-08-04 Andrew Haley <aph@redhat.com>
* java/lang/natPosixProcess.cc (waitFor): Close I/O channels.
Index: java/lang/natPosixProcess.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/natPosixProcess.cc,v
retrieving revision 1.18
diff -c -2 -p -r1.18 natPosixProcess.cc
*** java/lang/natPosixProcess.cc 1 Mar 2004 21:33:27 -0000 1.18
--- java/lang/natPosixProcess.cc 4 Aug 2004 17:16:15 -0000
*************** java::lang::ConcreteProcess::waitFor (vo
*** 78,81 ****
--- 78,105 ----
}
+ try
+ {
+ inputStream->close ();
+ }
+ catch (java::io::IOException *e)
+ {
+ }
+
+ try
+ {
+ outputStream->close ();
+ }
+ catch (java::io::IOException *e)
+ {
+ }
+
+ try
+ {
+ errorStream->close ();
+ }
+ catch (java::io::IOException *e)
+ {
+ }
+
return status;
}