You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by sc...@apache.org on 2007/02/11 06:41:50 UTC

svn commit: r505844 - /incubator/uima/uimaj/trunk/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/DebugControlThread.java

Author: schor
Date: Sat Feb 10 21:41:50 2007
New Revision: 505844

URL: http://svn.apache.org/viewvc?view=rev&rev=505844
Log:
UIMA-210 remove file->string code, use method in FileUtils instead

Modified:
    incubator/uima/uimaj/trunk/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/DebugControlThread.java

Modified: incubator/uima/uimaj/trunk/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/DebugControlThread.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/DebugControlThread.java?view=diff&rev=505844&r1=505843&r2=505844
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/DebugControlThread.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/cpm/engine/DebugControlThread.java Sat Feb 10 21:41:50 2007
@@ -28,6 +28,7 @@
 import org.apache.uima.UIMAFramework;
 import org.apache.uima.collection.impl.cpm.utils.CPMUtils;
 import org.apache.uima.collection.impl.cpm.utils.CpmLocalizedMessage;
+import org.apache.uima.internal.util.FileUtils;
 import org.apache.uima.util.Level;
 
 public class DebugControlThread implements Runnable {
@@ -203,7 +204,6 @@
 
   public String doCheckpoint() {
     File inF = null;
-    BufferedInputStream fis = null;
     try {
       if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
         UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
@@ -212,13 +212,8 @@
                 new Object[] { Thread.currentThread().getName(), fileName });
       }
       inF = new File(fileName);
-      byte[] content = new byte[(int) inF.length()];
-      fis = new BufferedInputStream(new FileInputStream(inF));
 
-      // use a buffered input stream, or wrap the read(buffer) in a while checking
-      // to be sure it read all the input (see javadoc for read(...)
-      fis.read(content);
-      return new String(content);
+      return FileUtils.file2String(inF);
 
     } catch (FileNotFoundException e) {
       if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
@@ -231,16 +226,12 @@
     } catch (Exception e) {
       e.printStackTrace();
     } finally {
-      if (fis != null) {
-        try {
-          fis.close();
-          inF.delete();
-        } catch (Exception e) {
-        }
+      try {
+        inF.delete();
+      } catch (Exception e) {
       }
     }
     return null;
-
   }
 
   public boolean exists() {