You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by cw...@apache.org on 2009/09/08 17:42:16 UTC

svn commit: r812564 - /incubator/uima/uimaj/trunk/uimaj-cpe/src/test/java/org/apache/uima/resource/impl/TestResourceInterface_impl.java

Author: cwiklik
Date: Tue Sep  8 15:42:15 2009
New Revision: 812564

URL: http://svn.apache.org/viewvc?rev=812564&view=rev
Log:
UIMA-1560 modified load() method to close input stream

Modified:
    incubator/uima/uimaj/trunk/uimaj-cpe/src/test/java/org/apache/uima/resource/impl/TestResourceInterface_impl.java

Modified: incubator/uima/uimaj/trunk/uimaj-cpe/src/test/java/org/apache/uima/resource/impl/TestResourceInterface_impl.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-cpe/src/test/java/org/apache/uima/resource/impl/TestResourceInterface_impl.java?rev=812564&r1=812563&r2=812564&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-cpe/src/test/java/org/apache/uima/resource/impl/TestResourceInterface_impl.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-cpe/src/test/java/org/apache/uima/resource/impl/TestResourceInterface_impl.java Tue Sep  8 15:42:15 2009
@@ -44,15 +44,25 @@
    * @see org.apache.uima.resource.SharedResourceObject#load(DataResource)
    */
   public void load(DataResource aData) throws ResourceInitializationException {
+    InputStream inStr = null;
     try {
       // try to get an input stream and read from the file
-      InputStream inStr = aData.getInputStream();
+      inStr = aData.getInputStream();
       BufferedReader bufRdr = new BufferedReader(new InputStreamReader(inStr));
       mString = bufRdr.readLine();
       inStr.close();
     } catch (IOException e) {
       throw new ResourceInitializationException(e);
+    } finally {
+      if ( inStr != null ) {
+        try {
+          inStr.close();
+        } catch( Exception e) {
+          System.out.println("CPE.load() - Unable to close Input Stream");
+        }
+      }
     }
+    
   }
 
   /**