Replace printStackTrace() with call to Logger

This commit is contained in:
Florian Schmaus 2014-04-23 09:37:16 +02:00
parent cf6076ce43
commit 5b8fd51345
2 changed files with 12 additions and 5 deletions

View File

@ -23,6 +23,8 @@ import java.io.StringReader;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jivesoftware.smack.packet.RosterPacket;
import org.jivesoftware.smack.packet.RosterPacket.Item;
@ -47,6 +49,7 @@ public class DirectoryRosterStore implements RosterStore {
private static final String ENTRY_PREFIX = "entry-";
private static final String VERSION_FILE_NAME = "__version__";
private static final String STORE_ID = "DEFAULT_ROSTER_STORE";
private static final Logger LOGGER = Logger.getLogger(DirectoryRosterStore.class.getName());
private static final FileFilter rosterDirFilter = new FileFilter() {
@ -235,13 +238,13 @@ public class DirectoryRosterStore implements RosterStore {
}
}
catch (IOException e) {
e.printStackTrace();;
LOGGER.log(Level.SEVERE, "readEntry()", e);
return null;
}
catch (XmlPullParserException e) {
log("Invalid group entry in store entry file "
+ file);
e.printStackTrace();
LOGGER.log(Level.SEVERE, "readEntry()", e);
return null;
}

View File

@ -55,6 +55,8 @@ import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* Creates a socket connection to a XMPP server. This is the default connection
@ -65,6 +67,8 @@ import java.util.Locale;
*/
public class XMPPTCPConnection extends XMPPConnection {
private static final Logger LOGGER = Logger.getLogger(XMPPTCPConnection.class.getName());
/**
* The socket which is used for this connection.
*/
@ -384,7 +388,7 @@ public class XMPPTCPConnection extends XMPPConnection {
try {
socket.close();
} catch (Exception e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "shutdown", e);
}
// In most cases the close() should be successful, so set
// connected to false here.
@ -575,7 +579,7 @@ public class XMPPTCPConnection extends XMPPConnection {
reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
}
catch (Exception e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "initReaderAndWriter()", e);
compressionHandler = null;
reader = new BufferedReader(
new InputStreamReader(socket.getInputStream(), "UTF-8"));
@ -925,7 +929,7 @@ public class XMPPTCPConnection extends XMPPConnection {
catch (Exception e) {
// Catch and print any exception so we can recover
// from a faulty listener
e.printStackTrace();
LOGGER.log(Level.WARNING, "notifyReconnection()", e);
}
}
}