java/src/org/openantivirus/scanner Trie.java,1.5,1.6 RecursiveFileFilter.java,1.7,1.8 ScannerDaemon.java,1.16,1.17 ScannerConfiguration.java,1.4,1.5 TrieScannerTest.java,1.2,1.3 Scanner.java,1.3,1.4 StringVirusFinder.java,1.7,1.8 Node.java,1.4,1.5
Kurt Huwig <[email protected]>
| Newsgroups | gmane.comp.security.virus.openantivirus.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/openantivirus/java/src/org/openantivirus/scanner
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20313/src/org/openantivirus/scanner
Modified Files:
Trie.java RecursiveFileFilter.java ScannerDaemon.java
ScannerConfiguration.java TrieScannerTest.java Scanner.java
StringVirusFinder.java Node.java
Log Message:
Removed unused imports
Fixed problems found by FindBugs
Index: RecursiveFileFilter.java
===================================================================
RCS file: /cvsroot/openantivirus/java/src/org/openantivirus/scanner/RecursiveFileFilter.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- RecursiveFileFilter.java 20 May 2002 13:10:35 -0000 1.7
+++ RecursiveFileFilter.java 1 May 2004 14:36:10 -0000 1.8
@@ -65,7 +65,6 @@
filter(afFiles[ i ]);
}
} else {
- long lStart = System.currentTimeMillis();
try {
sff.filter(new RandomAccessFile(f, "r"));
} catch (VirusFoundException vfe) {
Index: ScannerConfiguration.java
===================================================================
RCS file: /cvsroot/openantivirus/java/src/org/openantivirus/scanner/ScannerConfiguration.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- ScannerConfiguration.java 20 May 2002 13:10:35 -0000 1.4
+++ ScannerConfiguration.java 1 May 2004 14:36:10 -0000 1.5
@@ -58,14 +58,14 @@
private List listScannerListener = new ArrayList();
- public Trie getTrie() {
+ public synchronized Trie getTrie() {
return trie;
}
/** Getter for property followSymlinks.
* @return Value of property followSymlinks.
*/
- public boolean getFollowSymlinks() {
+ public synchronized boolean getFollowSymlinks() {
return this.followSymlinks;
}
@@ -79,7 +79,7 @@
/** Getter for property credoLevel.
* @return Value of property credoLevel.
*/
- public int getCredoLevel() {
+ public synchronized int getCredoLevel() {
return this.credoLevel;
}
@@ -93,7 +93,7 @@
/** Getter for property credoPath.
* @return Value of property credoPath.
*/
- public String getCredoPath() {
+ public synchronized String getCredoPath() {
return this.credoPath;
}
@@ -116,17 +116,19 @@
public synchronized void setConfiguration(
ScannerConfiguration newConfiguration) {
- this.followSymlinks = newConfiguration.followSymlinks;
- this.credoLevel = newConfiguration.credoLevel;
- this.credoPath = newConfiguration.credoPath;
- this.trie = newConfiguration.trie;
- this.listScannerListener = newConfiguration.listScannerListener;
+ synchronized (newConfiguration) {
+ this.followSymlinks = newConfiguration.followSymlinks;
+ this.credoLevel = newConfiguration.credoLevel;
+ this.credoPath = newConfiguration.credoPath;
+ this.trie = newConfiguration.trie;
+ this.listScannerListener = newConfiguration.listScannerListener;
+ }
}
/** Getter for property tempDirectory.
* @return Value of property tempDirectory.
*/
- public File getTempDirectory() {
+ public synchronized File getTempDirectory() {
return this.tempDirectory;
}
Index: Scanner.java
===================================================================
RCS file: /cvsroot/openantivirus/java/src/org/openantivirus/scanner/Scanner.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- Scanner.java 20 May 2002 13:10:35 -0000 1.3
+++ Scanner.java 1 May 2004 14:36:10 -0000 1.4
@@ -22,7 +22,6 @@
package org.openantivirus.scanner;
-import java.io.*;
import org.openantivirus.scanner.filter.*;
import org.openantivirus.scanner.scanobject.*;
Index: StringVirusFinder.java
===================================================================
RCS file: /cvsroot/openantivirus/java/src/org/openantivirus/scanner/StringVirusFinder.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- StringVirusFinder.java 16 May 2002 17:16:55 -0000 1.7
+++ StringVirusFinder.java 1 May 2004 14:36:10 -0000 1.8
@@ -39,32 +39,36 @@
throws IOException {
final BufferedReader br = new BufferedReader(patternReader);
-
- String sLine;
- while ((sLine = br.readLine()) != null) {
- int iPos = sLine.indexOf('=');
- if (iPos == -1) {
- System.err.println("Malformed pattern line: " + sLine);
- continue;
- }
-
- String sVirusName = sLine.substring(0, iPos);
- String sPattern = sLine.substring(iPos + 1);
-
- try {
- stringFinder.addString(hexToString(sPattern),
- new StringVirusFoundListener(sVirusName));
- } catch (Exception e) {
- System.err.println(sLine);
- e.printStackTrace();
+
+ try {
+ String sLine;
+ while ((sLine = br.readLine()) != null) {
+ int iPos = sLine.indexOf('=');
+ if (iPos == -1) {
+ System.err.println("Malformed pattern line: " + sLine);
+ continue;
+ }
+
+ String sVirusName = sLine.substring(0, iPos);
+ String sPattern = sLine.substring(iPos + 1);
+
+ try {
+ stringFinder.addString(hexToString(sPattern),
+ new StringVirusFoundListener(sVirusName));
+ } catch (Exception e) {
+ System.err.println(sLine);
+ e.printStackTrace();
+ }
}
+ } finally {
+ br.close();
}
}
protected byte[] hexToString(String hex) {
if (hex.length() % 2 != 0) {
System.err.println("Malformed hexstring: " + hex);
- return null;
+ return new byte[0];
}
final byte[] result = new byte[hex.length() / 2];
Index: ScannerDaemon.java
===================================================================
RCS file: /cvsroot/openantivirus/java/src/org/openantivirus/scanner/ScannerDaemon.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- ScannerDaemon.java 31 Aug 2003 16:56:35 -0000 1.16
+++ ScannerDaemon.java 1 May 2004 14:36:10 -0000 1.17
@@ -22,9 +22,9 @@
package org.openantivirus.scanner;
-import java.net.*;
import java.io.*;
-import java.util.StringTokenizer;
+import java.net.*;
+
import org.openantivirus.credo.*;
/**
Index: TrieScannerTest.java
===================================================================
RCS file: /cvsroot/openantivirus/java/src/org/openantivirus/scanner/TrieScannerTest.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- TrieScannerTest.java 22 Apr 2002 09:44:24 -0000 1.2
+++ TrieScannerTest.java 1 May 2004 14:36:10 -0000 1.3
@@ -22,8 +22,6 @@
package org.openantivirus.scanner;
-import java.util.Iterator;
-
import junit.framework.*;
/**
Index: Node.java
===================================================================
RCS file: /cvsroot/openantivirus/java/src/org/openantivirus/scanner/Node.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- Node.java 16 Oct 2002 11:01:44 -0000 1.4
+++ Node.java 1 May 2004 14:36:10 -0000 1.5
@@ -24,8 +24,6 @@
import java.util.*;
-import org.openantivirus.scanner.*;
-
/**
* A knot in the trie
*
Index: Trie.java
===================================================================
RCS file: /cvsroot/openantivirus/java/src/org/openantivirus/scanner/Trie.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- Trie.java 16 Oct 2002 11:01:44 -0000 1.5
+++ Trie.java 1 May 2004 14:36:10 -0000 1.6
@@ -78,7 +78,7 @@
// initialize the root node
final LinkedList children = new LinkedList();
nRoot.setFailure(null); // null = top node; to end following
- for (int i = 0; i < nRoot.NUM_CHILDS; i++) {
+ for (int i = 0; i < Node.NUM_CHILDS; i++) {
final Node child = nRoot.getTrans(i);
if (child == null) {
nRoot.setTrans(i, nRoot);
@@ -93,7 +93,7 @@
if (node.isLastNode()) {
continue;
}
- for (int i = 0; i < node.NUM_CHILDS; i++) {
+ for (int i = 0; i < Node.NUM_CHILDS; i++) {
final Node child = node.getTrans(i);
if (child == null) {
node.setTrans(i, node.getFailure().getTrans(i));
-------------------------------------------------------
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