Big findbugs cleanup
This commit is contained in:
@ -26,6 +26,7 @@ package i2p.susi.util;
|
||||
import i2p.susi.debug.Debug;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
@ -78,10 +79,15 @@ public class Config {
|
||||
} catch (Exception e) {
|
||||
Debug.debug( Debug.DEBUG, "Could not open WEB-INF/classes/susimail.properties (possibly in jar), reason: " + e.getMessage() );
|
||||
}
|
||||
FileInputStream fis = null;
|
||||
try {
|
||||
config.load( new FileInputStream( "susimail.config" ) );
|
||||
fis = new FileInputStream( "susimail.config" );
|
||||
config.load( fis );
|
||||
} catch (Exception e) {
|
||||
Debug.debug( Debug.DEBUG, "Could not open susimail.config, reason: " + e.getMessage() );
|
||||
} finally {
|
||||
if (fis != null)
|
||||
try { fis.close(); } catch (IOException ioe) {}
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
@ -36,7 +36,6 @@ public class MailCache {
|
||||
public static final boolean FETCH_ALL = false;
|
||||
|
||||
private POP3MailBox mailbox;
|
||||
private String error;
|
||||
private Hashtable mails;
|
||||
private Object synchronizer;
|
||||
|
||||
|
@ -76,6 +76,8 @@ public class MailPart {
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (decodedHeaders == null)
|
||||
return;
|
||||
headerLines = new String( decodedHeaders.content, decodedHeaders.offset, decodedHeaders.length ).split( "\r\n" );
|
||||
|
||||
for( int i = 0; i < headerLines.length; i++ )
|
||||
|
@ -97,7 +97,7 @@ public class RequestWrapper {
|
||||
cachedParameterNames = new Hashtable();
|
||||
String[] partNames = multiPartRequest.getPartNames();
|
||||
for( int i = 0; i < partNames.length; i++ )
|
||||
cachedParameterNames.put( partNames[i], new Integer( i ) );
|
||||
cachedParameterNames.put( partNames[i], Integer.valueOf( i ) );
|
||||
}
|
||||
return cachedParameterNames.keys();
|
||||
}
|
||||
|
@ -556,7 +556,6 @@ public class WebMail extends HttpServlet
|
||||
private void processLogin( SessionObject sessionObject, RequestWrapper request )
|
||||
{
|
||||
if( sessionObject.state == STATE_AUTH ) {
|
||||
String login = request.getParameter( LOGIN );
|
||||
String user = request.getParameter( USER );
|
||||
String pass = request.getParameter( PASS );
|
||||
String host = request.getParameter( HOST );
|
||||
@ -1330,8 +1329,9 @@ public class WebMail extends HttpServlet
|
||||
}
|
||||
}
|
||||
if( content != null ) {
|
||||
ZipOutputStream zip = null;
|
||||
try {
|
||||
ZipOutputStream zip = new ZipOutputStream( response.getOutputStream() );
|
||||
zip = new ZipOutputStream( response.getOutputStream() );
|
||||
String name;
|
||||
if( part.filename != null )
|
||||
name = part.filename;
|
||||
@ -1350,6 +1350,9 @@ public class WebMail extends HttpServlet
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if ( zip != null)
|
||||
try { zip.close(); } catch (IOException ioe) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ import java.util.Set;
|
||||
*/
|
||||
public class EncodingFactory {
|
||||
|
||||
public static String CONFIG_ENCODING = "encodings";
|
||||
public static final String CONFIG_ENCODING = "encodings";
|
||||
|
||||
private static Hashtable encodings = null;
|
||||
|
||||
|
@ -102,7 +102,7 @@ public class POP3MailBox {
|
||||
private ReadBuffer getHeader( int id ) {
|
||||
synchronized( synchronizer ) {
|
||||
Debug.debug(Debug.DEBUG, "getHeader(" + id + ")");
|
||||
Integer idObj = new Integer(id);
|
||||
Integer idObj = Integer.valueOf(id);
|
||||
ReadBuffer header = null;
|
||||
if (id >= 1 && id <= mails) {
|
||||
/*
|
||||
@ -155,7 +155,7 @@ public class POP3MailBox {
|
||||
private ReadBuffer getBody(int id) {
|
||||
synchronized( synchronizer ) {
|
||||
Debug.debug(Debug.DEBUG, "getBody(" + id + ")");
|
||||
Integer idObj = new Integer(id);
|
||||
Integer idObj = Integer.valueOf(id);
|
||||
ReadBuffer body = null;
|
||||
if (id >= 1 && id <= mails) {
|
||||
body = (ReadBuffer)bodyList.get(idObj);
|
||||
@ -236,7 +236,7 @@ public class POP3MailBox {
|
||||
/*
|
||||
* find value in hashtable
|
||||
*/
|
||||
Integer resultObj = (Integer) sizes.get(new Integer(id));
|
||||
Integer resultObj = (Integer) sizes.get(Integer.valueOf(id));
|
||||
if (resultObj != null)
|
||||
result = resultObj.intValue();
|
||||
return result;
|
||||
@ -277,7 +277,7 @@ public class POP3MailBox {
|
||||
|
||||
readBuffer = sendCmdNa( "UIDL", DEFAULT_BUFSIZE );
|
||||
if( readBuffer != null ) {
|
||||
String[] lines = new String( readBuffer.toString() ).split( "\r\n" );
|
||||
String[] lines = readBuffer.toString().split( "\r\n" );
|
||||
|
||||
for( int i = 0; i < lines.length; i++ ) {
|
||||
int j = lines[i].indexOf( " " );
|
||||
@ -285,7 +285,7 @@ public class POP3MailBox {
|
||||
try {
|
||||
int n = Integer.parseInt( lines[i].substring( 0, j ) );
|
||||
String uidl = lines[i].substring( j+1 );
|
||||
uidlToID.put( uidl, new Integer( n ) );
|
||||
uidlToID.put( uidl, Integer.valueOf( n ) );
|
||||
uidlList.add( n-1, uidl );
|
||||
}
|
||||
catch( NumberFormatException nfe ) {
|
||||
@ -319,7 +319,7 @@ public class POP3MailBox {
|
||||
if (j != -1) {
|
||||
int key = Integer.parseInt(lines[i].substring(0, j));
|
||||
int value = Integer.parseInt(lines[i].substring(j + 1));
|
||||
sizes.put(new Integer(key), new Integer(value));
|
||||
sizes.put(Integer.valueOf(key), Integer.valueOf(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -389,7 +389,7 @@ public class POP3MailBox {
|
||||
updateSizes();
|
||||
}
|
||||
else {
|
||||
lastError = new String( lastLine );
|
||||
lastError = lastLine;
|
||||
close();
|
||||
}
|
||||
}
|
||||
@ -721,4 +721,4 @@ public class POP3MailBox {
|
||||
close();
|
||||
connect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user