java/src/org/openantivirus/virushammer ScanTarget.java,1.3,1.4 VirusHammer.java,1.9,1.10 StopScanAction.java,1.4,1.5 PatternFindAction.java,1.3,1.4 ScannerThread.java,1.6,1.7 RemoveTargetAction.java,1.3,1.4 StartScanAction.java,1.4,1.5 AddTargetAction.java,1.3,1.4 ExitAction.java,1.3,1.4

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

Modified Files:
	ScanTarget.java VirusHammer.java StopScanAction.java 
	PatternFindAction.java ScannerThread.java 
	RemoveTargetAction.java StartScanAction.java 
	AddTargetAction.java ExitAction.java 
Log Message:
Removed unused imports
Fixed problems found by FindBugs

Index: VirusHammer.java
===================================================================
RCS file: /cvsroot/openantivirus/java/src/org/openantivirus/virushammer/VirusHammer.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- VirusHammer.java	14 Dec 2003 20:24:58 -0000	1.9
+++ VirusHammer.java	1 May 2004 14:36:09 -0000	1.10
@@ -109,7 +109,7 @@
         
         frame.setJMenuBar(createMenuBar());
         
-        frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
+        frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
         frame.addWindowListener(new WindowAdapter() {
             public void windowClosing(WindowEvent we) {
                 if (exitAction.isEnabled()) {
@@ -220,8 +220,11 @@
                 + File.separatorChar + "VirusHammer.properties");
         if (fileProperties.exists()) {
             final FileInputStream fis = new FileInputStream(fileProperties);
-            appProperties.load(fis);
-            fis.close();
+            try {
+                appProperties.load(fis);
+            } finally {
+                fis.close();
+            }
             final String sTargetList = appProperties.getProperty(
                     "scantargets");
             if (sTargetList != null) {

Index: ExitAction.java
===================================================================
RCS file: /cvsroot/openantivirus/java/src/org/openantivirus/virushammer/ExitAction.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ExitAction.java	14 Dec 2003 20:24:58 -0000	1.3
+++ ExitAction.java	1 May 2004 14:36:09 -0000	1.4
@@ -39,8 +39,6 @@
  * @version $Revision$
  */
 public class ExitAction extends PerformableAction {
-    public static final String VERSION =
-        "$Id$";
     
     /** Holds value of property scanTargetList. */
     private ScanTargetList scanTargetList;
@@ -67,8 +65,11 @@
             final FileOutputStream fos = new FileOutputStream(
                     System.getProperty("user.home") + File.separatorChar
                     + "VirusHammer.properties");
-            appProperties.store(fos, "VirusHammer");
-            fos.close();
+            try {
+                appProperties.store(fos, "VirusHammer");
+            } finally {
+                fos.close();
+            }
         } catch (Exception e) {
             e.printStackTrace();
         }

Index: StartScanAction.java
===================================================================
RCS file: /cvsroot/openantivirus/java/src/org/openantivirus/virushammer/StartScanAction.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- StartScanAction.java	14 Dec 2003 20:24:58 -0000	1.4
+++ StartScanAction.java	1 May 2004 14:36:09 -0000	1.5
@@ -43,8 +43,6 @@
  * @version $Revision$
  */
 public class StartScanAction extends PerformableAction {
-    public static final String VERSION =
-        "$Id$";
     
     /** Holds value of property scanTargetList. */
     private ScanTargetList scanTargetList = null;
@@ -117,11 +115,13 @@
      * @param scannerThread New value of property scannerThread.
      */
     public void setScannerThread(ScannerThread scannerThread) {
-        if (scannerThread != null) {
-            scannerThread.removeScanListener(scanListener);
+        if (this.scannerThread != null) {
+            this.scannerThread.removeScanListener(scanListener);
         }
         this.scannerThread = scannerThread;
-        scannerThread.addScanListener(scanListener);
+        if (scannerThread != null) {
+            scannerThread.addScanListener(scanListener);
+        }
         updateEnabled();
     }
 }

Index: ScannerThread.java
===================================================================
RCS file: /cvsroot/openantivirus/java/src/org/openantivirus/virushammer/ScannerThread.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- ScannerThread.java	14 Dec 2003 20:24:58 -0000	1.6
+++ ScannerThread.java	1 May 2004 14:36:09 -0000	1.7
@@ -93,10 +93,12 @@
         scanning = false;
         while (true) {
             synchronized (this) {
-                try {
-                    wait();
-                } catch (InterruptedException ie) {
-                    // that's how it works
+                if (!scanning) {
+                    try {
+                        wait();
+                    } catch (InterruptedException ie) {
+                        // that's how it works
+                    }
                 }
                 scanning       = true;
                 abortRequested = false;
@@ -123,7 +125,9 @@
     
     /** starts the scanning */
     public synchronized void startScanning() {
-        notify();
+        if (scanning == false) {
+            notifyAll();
+        }
     }
     
     /** notifies, that the scanning should be stopped */

Index: PatternFindAction.java
===================================================================
RCS file: /cvsroot/openantivirus/java/src/org/openantivirus/virushammer/PatternFindAction.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- PatternFindAction.java	14 Dec 2003 20:24:58 -0000	1.3
+++ PatternFindAction.java	1 May 2004 14:36:09 -0000	1.4
@@ -37,14 +37,13 @@
  * @version $Revision$
  */
 public class PatternFindAction extends PerformableAction {
-    public static final String VERSION =
-        "$Id$";
     
     public PatternFindAction() {
         super(L10N.getString("Find_pattern"));
     }
     
     public void actionPerformed(ActionEvent actionEvent) {
+        // not implemented yet
     }
     
     /** @returns if this action should be enabled  */

Index: RemoveTargetAction.java
===================================================================
RCS file: /cvsroot/openantivirus/java/src/org/openantivirus/virushammer/RemoveTargetAction.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- RemoveTargetAction.java	14 Dec 2003 20:24:58 -0000	1.3
+++ RemoveTargetAction.java	1 May 2004 14:36:09 -0000	1.4
@@ -37,8 +37,6 @@
  * @version $Id$
  */
 public class RemoveTargetAction extends PerformableAction {
-    public static final String VERSION =
-        "$Id$";
     
     /** Holds value of property scanTarget. */
     private ScanTarget scanTarget = null;

Index: AddTargetAction.java
===================================================================
RCS file: /cvsroot/openantivirus/java/src/org/openantivirus/virushammer/AddTargetAction.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- AddTargetAction.java	14 Dec 2003 20:24:58 -0000	1.3
+++ AddTargetAction.java	1 May 2004 14:36:09 -0000	1.4
@@ -41,8 +41,6 @@
  * @version $Revision$
  */
 public class AddTargetAction extends PerformableAction {
-    public static final String VERSION =
-        "$Id$";
     
     /** Holds value of property selectedFile. */
     private File selectedFile;

Index: StopScanAction.java
===================================================================
RCS file: /cvsroot/openantivirus/java/src/org/openantivirus/virushammer/StopScanAction.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- StopScanAction.java	14 Dec 2003 20:24:58 -0000	1.4
+++ StopScanAction.java	1 May 2004 14:36:09 -0000	1.5
@@ -41,8 +41,6 @@
  * @version $Revision$
  */
 public class StopScanAction extends PerformableAction {
-    public static final String VERSION =
-        "$Id$";
     
     /** Holds value of property scannerThread. */
     private ScannerThread scannerThread;
@@ -81,11 +79,13 @@
      * @param scannerThread New value of property scannerThread.
      */
     public void setScannerThread(ScannerThread scannerThread) {
-        if (scannerThread != null) {
-            scannerThread.removeScanListener(scanListener);
+        if (this.scannerThread != null) {
+            this.scannerThread.removeScanListener(scanListener);
         }
         this.scannerThread = scannerThread;
-        scannerThread.addScanListener(scanListener);
+        if (scannerThread != null) {
+            scannerThread.addScanListener(scanListener);
+        }
         updateEnabled();
     }
 }

Index: ScanTarget.java
===================================================================
RCS file: /cvsroot/openantivirus/java/src/org/openantivirus/virushammer/ScanTarget.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ScanTarget.java	14 Dec 2003 20:24:58 -0000	1.3
+++ ScanTarget.java	1 May 2004 14:36:09 -0000	1.4
@@ -46,7 +46,9 @@
     /** Holds value of property subfolders. */
     private boolean subfolders;
     
-    public ScanTarget() {}
+    public ScanTarget() {
+        // path and folder may be set later
+    }
     
     public ScanTarget(File path, boolean subfolders) {
         this.path       = path;



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