java/src/org/openantivirus/scanner/scanobject TemporaryScanObject.java,1.3,1.4 FileScanObject.java,1.2,1.3

Kurt Huwig <[email protected]>
Newsgroups gmane.comp.security.virus.openantivirus.cvs
Message-ID <[email protected]>
Update of /cvsroot/openantivirus/java/src/org/openantivirus/scanner/scanobject
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20313/src/org/openantivirus/scanner/scanobject

Modified Files:
	TemporaryScanObject.java FileScanObject.java 
Log Message:
Removed unused imports
Fixed problems found by FindBugs

Index: TemporaryScanObject.java
===================================================================
RCS file: /cvsroot/openantivirus/java/src/org/openantivirus/scanner/scanobject/TemporaryScanObject.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- TemporaryScanObject.java	20 May 2002 13:10:35 -0000	1.3
+++ TemporaryScanObject.java	1 May 2004 14:36:11 -0000	1.4
@@ -32,8 +32,6 @@
  * @version $Revision$
  */
 public class TemporaryScanObject extends ScanObject {
-    public static final String VERSION =
-        "$Id$";
     
     private static final String
             TEMP_PREFIX = "file",
@@ -52,31 +50,33 @@
         file = createTempFile(directory);
         
         final OutputStream os = new FileOutputStream(file);
-        
-        // read the start of the stream
-        int pos = 0;
-        byte[] buffer = new byte[BUFFER_SIZE];
-        int read;
-        while ((read = is.read(buffer, pos, MAX_START_SIZE - pos))
-               != -1) {
-            os.write(buffer, pos, read);
-            pos += read;
-            if (pos == MAX_START_SIZE) {
-                break;
+        try {
+            // read the start of the stream
+            int pos = 0;
+            byte[] buffer = new byte[BUFFER_SIZE];
+            int read;
+            while ((read = is.read(buffer, pos, MAX_START_SIZE - pos))
+                   != -1) {
+                os.write(buffer, pos, read);
+                pos += read;
+                if (pos == MAX_START_SIZE) {
+                    break;
+                }
             }
+            
+            // copy the start into the start-array
+            start = new byte[pos];
+            for (int i = 0; i < pos; i++) {
+                start[i] = buffer[i];
+            }
+            
+            // read the rest of the stream
+            while ((read = is.read(buffer)) != -1) {
+                os.write(buffer, 0, read);
+            }
+        } finally {
+            os.close();
         }
-        
-        // copy the start into the start-array
-        start = new byte[pos];
-        for (int i = 0; i < pos; i++) {
-            start[i] = buffer[i];
-        }
-        
-        // read the rest of the stream
-        while ((read = is.read(buffer)) != -1) {
-            os.write(buffer, 0, read);
-        }
-        os.close();
     }
 
     protected File createTempFile(File directory) throws IOException {

Index: FileScanObject.java
===================================================================
RCS file: /cvsroot/openantivirus/java/src/org/openantivirus/scanner/scanobject/FileScanObject.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- FileScanObject.java	20 May 2002 13:10:35 -0000	1.2
+++ FileScanObject.java	1 May 2004 14:36:11 -0000	1.3
@@ -32,8 +32,6 @@
  * @version $Revision$
  */
 public class FileScanObject extends ScanObject {
-    public static final String VERSION =
-        "$Id$";
     
     private final File file;
     



-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.