java/src/org/openantivirus/scanner/filter NullFilter.java,1.2,1.3 UPXFilter.java,1.5,1.6 Filter.java,1.2,1.3 ZipFilter.java,1.2,1.3 DirectoryFilter.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/filter
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20313/src/org/openantivirus/scanner/filter

Modified Files:
	NullFilter.java UPXFilter.java Filter.java ZipFilter.java 
	DirectoryFilter.java 
Log Message:
Removed unused imports
Fixed problems found by FindBugs

Index: ZipFilter.java
===================================================================
RCS file: /cvsroot/openantivirus/java/src/org/openantivirus/scanner/filter/ZipFilter.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ZipFilter.java	20 May 2002 13:10:35 -0000	1.2
+++ ZipFilter.java	1 May 2004 14:36:09 -0000	1.3
@@ -22,9 +22,9 @@
 
 package org.openantivirus.scanner.filter;
 
-import java.io.*;
 import java.util.*;
 import java.util.zip.*;
+
 import org.openantivirus.scanner.*;
 import org.openantivirus.scanner.scanobject.*;
 
@@ -41,7 +41,9 @@
     
     private static ZipFilter instance = null;
     
-    protected ZipFilter() {}
+    protected ZipFilter() {
+        // constructor shall be protected
+    }
     
     /**
      * Filters the scanObject into other scanObjects and hands them over
@@ -64,7 +66,7 @@
     }
     
     /** some filters are thread-safe, so let them decide themselves  */
-    public static ZipFilter getInstance() {
+    public synchronized static ZipFilter getInstance() {
         if (instance == null) {
             instance = new ZipFilter();
         }

Index: Filter.java
===================================================================
RCS file: /cvsroot/openantivirus/java/src/org/openantivirus/scanner/filter/Filter.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Filter.java	20 May 2002 13:10:35 -0000	1.2
+++ Filter.java	1 May 2004 14:36:09 -0000	1.3
@@ -22,7 +22,6 @@
 
 package org.openantivirus.scanner.filter;
 
-import java.io.*;
 import org.openantivirus.scanner.*;
 import org.openantivirus.scanner.scanobject.*;
 

Index: DirectoryFilter.java
===================================================================
RCS file: /cvsroot/openantivirus/java/src/org/openantivirus/scanner/filter/DirectoryFilter.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- DirectoryFilter.java	20 May 2002 13:10:35 -0000	1.2
+++ DirectoryFilter.java	1 May 2004 14:36:09 -0000	1.3
@@ -39,7 +39,9 @@
     
     private static final DirectoryFilter instance = new DirectoryFilter();
     
-    protected DirectoryFilter() {}
+    protected DirectoryFilter() {
+        // constructor shall be protected
+    }
     
     public static DirectoryFilter getInstance() {
         return instance;

Index: NullFilter.java
===================================================================
RCS file: /cvsroot/openantivirus/java/src/org/openantivirus/scanner/filter/NullFilter.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- NullFilter.java	20 May 2002 13:10:35 -0000	1.2
+++ NullFilter.java	1 May 2004 14:36:09 -0000	1.3
@@ -22,7 +22,6 @@
 
 package org.openantivirus.scanner.filter;
 
-import java.io.*;
 import org.openantivirus.scanner.*;
 import org.openantivirus.scanner.scanobject.*;
 
@@ -37,11 +36,13 @@
     public static final String VERSION =
         "$Id$";
 
-    protected NullFilter() {}
-    
     /** this is really thread safe */
     private static final NullFilter instance = new NullFilter();
     
+    protected NullFilter() {
+        // constructor shall be protected
+    }
+    
     public static NullFilter getInstance() {
         return instance;
     }

Index: UPXFilter.java
===================================================================
RCS file: /cvsroot/openantivirus/java/src/org/openantivirus/scanner/filter/UPXFilter.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- UPXFilter.java	2 Feb 2003 12:42:45 -0000	1.5
+++ UPXFilter.java	1 May 2004 14:36:09 -0000	1.6
@@ -58,8 +58,8 @@
         final ScanObject decompressed = new TemporaryScanObject(
                 scannerConfiguration.getTempDirectory());
         final File decompressedFile = decompressed.getFile();
-        final OutputStream os = new FileOutputStream(decompressedFile);
         boolean wasDecompressed;
+        final OutputStream os = new FileOutputStream(decompressedFile);
         try {
             upxDecompress.decompress(os);
             wasDecompressed = true;
@@ -67,8 +67,9 @@
             // broken UPX files may break decompression
             e.printStackTrace();
             wasDecompressed = false;
+        } finally {
+            os.close();
         }
-        os.close();
         raf.close();
         // UPXDecompress does not generate correct exe files yet
         // scanner.scan(decompressed);



-------------------------------------------------------
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.