java/src/org/openantivirus/engine/credo StringsParser.java,1.1,1.2
Kurt Huwig <[email protected]>
| Newsgroups | gmane.comp.security.virus.openantivirus.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/openantivirus/java/src/org/openantivirus/engine/credo
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20313/src/org/openantivirus/engine/credo
Modified Files:
StringsParser.java
Log Message:
Removed unused imports
Fixed problems found by FindBugs
Index: StringsParser.java
===================================================================
RCS file: /cvsroot/openantivirus/java/src/org/openantivirus/engine/credo/StringsParser.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- StringsParser.java 14 Dec 2003 11:08:26 -0000 1.1
+++ StringsParser.java 1 May 2004 14:36:11 -0000 1.2
@@ -49,32 +49,35 @@
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];
-------------------------------------------------------
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