java/src/org/openantivirus/daemon RequestHandler.java,1.1,1.2

Kurt Huwig <[email protected]> Thu, 20 May 2004 13:54:22 +0000
Newsgroups gmane.comp.security.virus.openantivirus.cvs
Message-ID <[email protected]>
Update of /cvsroot/openantivirus/java/src/org/openantivirus/daemon
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15369/src/org/openantivirus/daemon

Modified Files:
	RequestHandler.java 
Log Message:
Added scan error detection

Index: RequestHandler.java
===================================================================
RCS file: /cvsroot/openantivirus/java/src/org/openantivirus/daemon/RequestHandler.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- RequestHandler.java	18 May 2004 09:03:28 -0000	1.1
+++ RequestHandler.java	20 May 2004 13:54:20 -0000	1.2
@@ -33,6 +33,7 @@
 
 import org.openantivirus.engine.*;
 import org.openantivirus.engine.censor.*;
+import org.openantivirus.engine.vfs.*;
 
 /**
  * ScannerThread
@@ -57,6 +58,22 @@
     private final Socket socket;
     private final ScanConfiguration scanConfiguration;
     private final ScanEngine scanner;
+
+    private boolean exceptionOccurred;
+    
+    private final ScanListener scanListener = new ScanListener() {
+        public void startingScan() {
+        }
+        public void scanning(VfsEntry vfsEntry) throws ScanAbortedException {
+        }
+        public void malwareFound(MalwareFoundException malwareFoundException) {
+        }
+        public void exceptionThrown(Exception exception) {
+            exceptionOccurred = true;
+        }
+        public void finishedScan() {
+        }
+    };
     
     public RequestHandler(Socket socket,
                           ScanEngine scanner,
@@ -99,8 +116,12 @@
                         System.err.println("Filename not found");
                         return;
                     }
+                    scanner.addScanListener(scanListener);
+                    exceptionOccurred = false;
                     scanner.scan(new File(argument), scanConfiguration);
-                    sResult = OK;
+                    if (!exceptionOccurred) {
+                        sResult = OK;
+                    }
 /*                    
                 } else if (sCommand.equals("POST")) {
                     ServerSocket dataInServerSocket = new ServerSocket(



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