This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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;
  }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]