1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-22 22:32:06 +01:00

Make JUL Loggers final (SMACK-536)

This commit is contained in:
Florian Schmaus 2014-02-26 21:38:02 +01:00
parent f0c6d1f1d3
commit 54a421e84e
30 changed files with 109 additions and 109 deletions

View file

@ -39,7 +39,7 @@ import java.util.logging.Logger;
* @author Matt Tucker * @author Matt Tucker
*/ */
public class AccountManager { public class AccountManager {
private static Logger logger = Logger.getLogger(AccountManager.class.getName()); private static final Logger LOGGER = Logger.getLogger(AccountManager.class.getName());
private Connection connection; private Connection connection;
private Registration info = null; private Registration info = null;
@ -134,7 +134,7 @@ public class AccountManager {
} }
} }
catch (XMPPException xe) { catch (XMPPException xe) {
logger.log(Level.SEVERE, "Error retrieving account attributes from server", xe); LOGGER.log(Level.SEVERE, "Error retrieving account attributes from server", xe);
} }
return Collections.emptySet(); return Collections.emptySet();
} }
@ -155,7 +155,7 @@ public class AccountManager {
return info.getAttributes().get(name); return info.getAttributes().get(name);
} }
catch (XMPPException xe) { catch (XMPPException xe) {
logger.log(Level.SEVERE, "Error retrieving account attribute " + name + " info from server", xe); LOGGER.log(Level.SEVERE, "Error retrieving account attribute " + name + " info from server", xe);
} }
return null; return null;
} }
@ -175,7 +175,7 @@ public class AccountManager {
return info.getInstructions(); return info.getInstructions();
} }
catch (XMPPException xe) { catch (XMPPException xe) {
logger.log(Level.SEVERE, "Error retrieving account instructions from server", xe); LOGGER.log(Level.SEVERE, "Error retrieving account instructions from server", xe);
return null; return null;
} }
} }

View file

@ -81,7 +81,7 @@ import org.jivesoftware.smack.packet.Presence;
* @author Guenther Niess * @author Guenther Niess
*/ */
public abstract class Connection { public abstract class Connection {
private static Logger log = Logger.getLogger(Connection.class.getName()); private static final Logger LOGGER = Logger.getLogger(Connection.class.getName());
/** /**
* Counter to uniquely identify connections that are created. * Counter to uniquely identify connections that are created.
@ -793,7 +793,7 @@ public abstract class Connection {
debuggerClass = Class.forName(className); debuggerClass = Class.forName(className);
} }
catch (Exception e) { catch (Exception e) {
log.warning("Unabled to instantiate debugger class " + className); LOGGER.warning("Unabled to instantiate debugger class " + className);
} }
} }
if (debuggerClass == null) { if (debuggerClass == null) {
@ -807,7 +807,7 @@ public abstract class Connection {
Class.forName("org.jivesoftware.smack.debugger.LiteDebugger"); Class.forName("org.jivesoftware.smack.debugger.LiteDebugger");
} }
catch (Exception ex2) { catch (Exception ex2) {
log.warning("Unabled to instantiate either Smack debugger class"); LOGGER.warning("Unabled to instantiate either Smack debugger class");
} }
} }
} }

View file

@ -44,7 +44,7 @@ import java.util.logging.Logger;
*/ */
class PacketReader { class PacketReader {
private static Logger log = Logger.getLogger(PacketReader.class.getName()); private static final Logger LOGGER = Logger.getLogger(PacketReader.class.getName());
private Thread readerThread; private Thread readerThread;
private ExecutorService listenerExecutor; private ExecutorService listenerExecutor;
@ -135,7 +135,7 @@ class PacketReader {
catch (Exception e) { catch (Exception e) {
// Catch and print any exception so we can recover // Catch and print any exception so we can recover
// from a faulty listener and finish the shutdown process // from a faulty listener and finish the shutdown process
log.log(Level.SEVERE, "Error in listener while closing connection", e); LOGGER.log(Level.SEVERE, "Error in listener while closing connection", e);
} }
} }
} }
@ -157,7 +157,7 @@ class PacketReader {
parser.setInput(connection.reader); parser.setInput(connection.reader);
} }
catch (XmlPullParserException xppe) { catch (XmlPullParserException xppe) {
log.log(Level.WARNING, "Error while resetting parser", xppe); LOGGER.log(Level.WARNING, "Error while resetting parser", xppe);
} }
} }
@ -457,7 +457,7 @@ class PacketReader {
try { try {
listenerWrapper.notifyListener(packet); listenerWrapper.notifyListener(packet);
} catch (Exception e) { } catch (Exception e) {
log.log(Level.SEVERE, "Exception in packet listener", e); LOGGER.log(Level.SEVERE, "Exception in packet listener", e);
} }
} }
} }

View file

@ -37,7 +37,7 @@ import java.util.logging.Logger;
* @author Matt Tucker * @author Matt Tucker
*/ */
class PacketWriter { class PacketWriter {
private static Logger log = Logger.getLogger(PacketWriter.class.getName()); private static final Logger LOGGER = Logger.getLogger(PacketWriter.class.getName());
private Thread writerThread; private Thread writerThread;
private Writer writer; private Writer writer;
@ -88,7 +88,7 @@ class PacketWriter {
queue.put(packet); queue.put(packet);
} }
catch (InterruptedException ie) { catch (InterruptedException ie) {
log.log(Level.SEVERE, "Failed to queue packet to send to server: " + packet.toString(), ie); LOGGER.log(Level.SEVERE, "Failed to queue packet to send to server: " + packet.toString(), ie);
return; return;
} }
synchronized (queue) { synchronized (queue) {
@ -172,7 +172,7 @@ class PacketWriter {
writer.flush(); writer.flush();
} }
catch (Exception e) { catch (Exception e) {
log.warning("Error flushing queue during shutdown, ignore and continue"); LOGGER.warning("Error flushing queue during shutdown, ignore and continue");
} }
// Delete the queue contents (hopefully nothing is left). // Delete the queue contents (hopefully nothing is left).

View file

@ -34,7 +34,7 @@ import java.util.logging.Logger;
* @author Francisco Vives * @author Francisco Vives
*/ */
public class ReconnectionManager implements ConnectionListener { public class ReconnectionManager implements ConnectionListener {
private static Logger log = Logger.getLogger(ReconnectionManager.class.getName()); private static final Logger LOGGER = Logger.getLogger(ReconnectionManager.class.getName());
// Holds the connection to the server // Holds the connection to the server
private Connection connection; private Connection connection;
@ -134,7 +134,7 @@ public class ReconnectionManager implements ConnectionListener {
.notifyAttemptToReconnectIn(remainingSeconds); .notifyAttemptToReconnectIn(remainingSeconds);
} }
catch (InterruptedException e1) { catch (InterruptedException e1) {
log.warning("Sleeping thread interrupted"); LOGGER.warning("Sleeping thread interrupted");
// Notify the reconnection has failed // Notify the reconnection has failed
ReconnectionManager.this.notifyReconnectionFailed(e1); ReconnectionManager.this.notifyReconnectionFailed(e1);
} }

View file

@ -55,7 +55,7 @@ public final class SmackConfiguration {
private static final String SMACK_VERSION; private static final String SMACK_VERSION;
private static final String DEFAULT_CONFIG_FILE = "classpath:org.jivesoftware.smack/smack-config.xml"; private static final String DEFAULT_CONFIG_FILE = "classpath:org.jivesoftware.smack/smack-config.xml";
private static final Logger log = Logger.getLogger(SmackConfiguration.class.getName()); private static final Logger LOGGER = Logger.getLogger(SmackConfiguration.class.getName());
private static int defaultPacketReplyTimeout = 5000; private static int defaultPacketReplyTimeout = 5000;
private static int packetCollectorSize = 5000; private static int packetCollectorSize = 5000;
@ -72,7 +72,7 @@ public final class SmackConfiguration {
is.read(buf); is.read(buf);
smackVersion = new String(buf, "UTF-8"); smackVersion = new String(buf, "UTF-8");
} catch(Exception e) { } catch(Exception e) {
log.log(Level.SEVERE, "Could not determine Smack version", e); LOGGER.log(Level.SEVERE, "Could not determine Smack version", e);
smackVersion = "unkown"; smackVersion = "unkown";
} }
SMACK_VERSION = smackVersion; SMACK_VERSION = smackVersion;
@ -271,7 +271,7 @@ public final class SmackConfiguration {
cfgFileStream.close(); cfgFileStream.close();
} }
catch (IOException e) { catch (IOException e) {
log.log(Level.SEVERE, "Error while closing config file input stream", e); LOGGER.log(Level.SEVERE, "Error while closing config file input stream", e);
} }
} }
@ -284,7 +284,7 @@ public final class SmackConfiguration {
name = parser.getName(); name = parser.getName();
if (eventType == XmlPullParser.START_TAG && "className".equals(name)) { if (eventType == XmlPullParser.START_TAG && "className".equals(name)) {
if (disabledSmackClasses.contains(name)) { if (disabledSmackClasses.contains(name)) {
log.info("Not loading disabled Smack class " + name); LOGGER.info("Not loading disabled Smack class " + name);
} }
else { else {
String classToLoad = parser.nextText(); String classToLoad = parser.nextText();
@ -316,7 +316,7 @@ public final class SmackConfiguration {
else { else {
logLevel = Level.WARNING; logLevel = Level.WARNING;
} }
log.log(logLevel, "A startup class [" + className LOGGER.log(logLevel, "A startup class [" + className
+ "] specified in smack-config.xml could not be loaded: "); + "] specified in smack-config.xml could not be loaded: ");
if (!optional) if (!optional)
throw cnfe; throw cnfe;

View file

@ -33,7 +33,7 @@ import org.jivesoftware.smack.util.FileUtils;
*/ */
public class LoggingInitializer implements SmackInitializer { public class LoggingInitializer implements SmackInitializer {
private static Logger log = Logger.getLogger(LoggingInitializer.class.getName()); private static final Logger LOGGER = Logger.getLogger(LoggingInitializer.class.getName());
private List<Exception> exceptions = new LinkedList<Exception>(); private List<Exception> exceptions = new LinkedList<Exception>();
@ -43,7 +43,7 @@ public class LoggingInitializer implements SmackInitializer {
LogManager.getLogManager().readConfiguration(FileUtils.getStreamForUrl("classpath:org.jivesofware.smack/jul.properties", null)); LogManager.getLogManager().readConfiguration(FileUtils.getStreamForUrl("classpath:org.jivesofware.smack/jul.properties", null));
} }
catch (Exception e) { catch (Exception e) {
log .log(Level.WARNING, "Could not initialize Java Logging from default file.", e); LOGGER.log(Level.WARNING, "Could not initialize Java Logging from default file.", e);
exceptions.add(e); exceptions.add(e);
} }
} }

View file

@ -35,7 +35,7 @@ import org.jivesoftware.smack.util.FileUtils;
* *
*/ */
public abstract class UrlProviderFileInitializer implements SmackInitializer { public abstract class UrlProviderFileInitializer implements SmackInitializer {
private static final Logger log = Logger.getLogger(UrlProviderFileInitializer.class.getName()); private static final Logger LOGGER = Logger.getLogger(UrlProviderFileInitializer.class.getName());
private List<Exception> exceptions = new LinkedList<Exception>(); private List<Exception> exceptions = new LinkedList<Exception>();
@ -47,18 +47,18 @@ public abstract class UrlProviderFileInitializer implements SmackInitializer {
InputStream is = FileUtils.getStreamForUrl(filePath, getClassLoader()); InputStream is = FileUtils.getStreamForUrl(filePath, getClassLoader());
if (is != null) { if (is != null) {
log.log(Level.INFO, "Loading providers for file [" + filePath + "]"); LOGGER.log(Level.INFO, "Loading providers for file [" + filePath + "]");
ProviderFileLoader pfl = new ProviderFileLoader(is); ProviderFileLoader pfl = new ProviderFileLoader(is);
ProviderManager.getInstance().addLoader(pfl); ProviderManager.getInstance().addLoader(pfl);
exceptions.addAll(pfl.getLoadingExceptions()); exceptions.addAll(pfl.getLoadingExceptions());
} }
else { else {
log.log(Level.WARNING, "No input stream created for " + filePath); LOGGER.log(Level.WARNING, "No input stream created for " + filePath);
exceptions.add(new IOException("No input stream created for " + filePath)); exceptions.add(new IOException("No input stream created for " + filePath));
} }
} }
catch (Exception e) { catch (Exception e) {
log.log(Level.SEVERE, "Error trying to load provider file " + filePath, e); LOGGER.log(Level.SEVERE, "Error trying to load provider file " + filePath, e);
exceptions.add(e); exceptions.add(e);
} }
} }

View file

@ -40,7 +40,7 @@ import java.util.logging.Logger;
* @author Matt Tucker * @author Matt Tucker
*/ */
public abstract class Packet { public abstract class Packet {
private static Logger log = Logger.getLogger(Packet.class.getName()); private static final Logger LOGGER = Logger.getLogger(Packet.class.getName());
protected static final String DEFAULT_LANGUAGE = protected static final String DEFAULT_LANGUAGE =
java.util.Locale.getDefault().getLanguage().toLowerCase(); java.util.Locale.getDefault().getLanguage().toLowerCase();
@ -411,7 +411,7 @@ public abstract class Packet {
buf.append(encodedVal).append("</value>"); buf.append(encodedVal).append("</value>");
} }
catch (Exception e) { catch (Exception e) {
log.log(Level.SEVERE, "Error encoding java object", e); LOGGER.log(Level.SEVERE, "Error encoding java object", e);
} }
finally { finally {
if (out != null) { if (out != null) {

View file

@ -27,11 +27,11 @@ import java.util.logging.Logger;
* *
*/ */
public class ExceptionLoggingCallback extends ParsingExceptionCallback { public class ExceptionLoggingCallback extends ParsingExceptionCallback {
private static Logger log = Logger.getLogger(ExceptionLoggingCallback.class.getName()); private static final Logger LOGGER = Logger.getLogger(ExceptionLoggingCallback.class.getName());
@Override @Override
public void handleUnparsablePacket(UnparsablePacket unparsed) throws Exception { public void handleUnparsablePacket(UnparsablePacket unparsed) throws Exception {
log.log(Level.SEVERE, "Smack message parsing exception: ", unparsed.getParsingException()); LOGGER.log(Level.SEVERE, "Smack message parsing exception: ", unparsed.getParsingException());
log.severe("Unparsed content: " + unparsed.getContent()); LOGGER.severe("Unparsed content: " + unparsed.getContent());
} }
} }

View file

@ -38,7 +38,7 @@ import org.xmlpull.v1.XmlPullParser;
* *
*/ */
public class ProviderFileLoader implements ProviderLoader { public class ProviderFileLoader implements ProviderLoader {
private final static Logger log = Logger.getLogger(ProviderFileLoader.class.getName()); private static final Logger LOGGER = Logger.getLogger(ProviderFileLoader.class.getName());
private Collection<IQProviderInfo> iqProviders; private Collection<IQProviderInfo> iqProviders;
private Collection<ExtensionProviderInfo> extProviders; private Collection<ExtensionProviderInfo> extProviders;
@ -135,13 +135,13 @@ public class ProviderFileLoader implements ProviderLoader {
} }
} }
catch (ClassNotFoundException cnfe) { catch (ClassNotFoundException cnfe) {
log.log(Level.SEVERE, "Could not find provider class", cnfe); LOGGER.log(Level.SEVERE, "Could not find provider class", cnfe);
exceptions.add(cnfe); exceptions.add(cnfe);
} }
} }
} }
catch (IllegalArgumentException illExc) { catch (IllegalArgumentException illExc) {
log.log(Level.SEVERE, "Invalid provider type found [" + typeName + "] when expecting iqProvider or extensionProvider", illExc); LOGGER.log(Level.SEVERE, "Invalid provider type found [" + typeName + "] when expecting iqProvider or extensionProvider", illExc);
exceptions.add(illExc); exceptions.add(illExc);
} }
} }
@ -150,7 +150,7 @@ public class ProviderFileLoader implements ProviderLoader {
while (eventType != XmlPullParser.END_DOCUMENT); while (eventType != XmlPullParser.END_DOCUMENT);
} }
catch (Exception e){ catch (Exception e){
log.log(Level.SEVERE, "Unknown error occurred while parsing provider file", e); LOGGER.log(Level.SEVERE, "Unknown error occurred while parsing provider file", e);
} }
finally { finally {
try { try {

View file

@ -30,7 +30,7 @@ import java.util.logging.Logger;
*/ */
public class Base64 public class Base64
{ {
private static Logger log = Logger.getLogger(Base64.class.getName()); private static final Logger LOGGER = Logger.getLogger(Base64.class.getName());
/* ******** P U B L I C F I E L D S ******** */ /* ******** P U B L I C F I E L D S ******** */
@ -494,7 +494,7 @@ public class Base64
} // end try } // end try
catch( java.io.IOException e ) catch( java.io.IOException e )
{ {
log.log(Level.SEVERE, "Error encoding object", e); LOGGER.log(Level.SEVERE, "Error encoding object", e);
return null; return null;
} // end catch } // end catch
finally finally
@ -623,7 +623,7 @@ public class Base64
} // end try } // end try
catch( java.io.IOException e ) catch( java.io.IOException e )
{ {
log.log(Level.SEVERE, "Error encoding bytes", e); LOGGER.log(Level.SEVERE, "Error encoding bytes", e);
return null; return null;
} // end catch } // end catch
finally finally
@ -778,11 +778,11 @@ public class Base64
return 3; return 3;
}catch( Exception e){ }catch( Exception e){
log.log(Level.SEVERE, e.getMessage(), e); LOGGER.log(Level.SEVERE, e.getMessage(), e);
log.severe(""+source[srcOffset]+ ": " + ( DECODABET[ source[ srcOffset ] ] ) ); LOGGER.severe(""+source[srcOffset]+ ": " + ( DECODABET[ source[ srcOffset ] ] ) );
log.severe(""+source[srcOffset+1]+ ": " + ( DECODABET[ source[ srcOffset + 1 ] ] ) ); LOGGER.severe(""+source[srcOffset+1]+ ": " + ( DECODABET[ source[ srcOffset + 1 ] ] ) );
log.severe(""+source[srcOffset+2]+ ": " + ( DECODABET[ source[ srcOffset + 2 ] ] ) ); LOGGER.severe(""+source[srcOffset+2]+ ": " + ( DECODABET[ source[ srcOffset + 2 ] ] ) );
log.severe(""+source[srcOffset+3]+ ": " + ( DECODABET[ source[ srcOffset + 3 ] ] ) ); LOGGER.severe(""+source[srcOffset+3]+ ": " + ( DECODABET[ source[ srcOffset + 3 ] ] ) );
return -1; return -1;
} // end catch } // end catch
} }
@ -840,7 +840,7 @@ public class Base64
} // end if: white space, equals sign or better } // end if: white space, equals sign or better
else else
{ {
log.warning("Bad Base64 input character at " + i + ": " + source[i] + "(decimal)"); LOGGER.warning("Bad Base64 input character at " + i + ": " + source[i] + "(decimal)");
return null; return null;
} // end else: } // end else:
} // each input character } // each input character
@ -968,12 +968,12 @@ public class Base64
} // end try } // end try
catch( java.io.IOException e ) catch( java.io.IOException e )
{ {
log.log(Level.SEVERE, "Error reading object", e); LOGGER.log(Level.SEVERE, "Error reading object", e);
obj = null; obj = null;
} // end catch } // end catch
catch( java.lang.ClassNotFoundException e ) catch( java.lang.ClassNotFoundException e )
{ {
log.log(Level.SEVERE, "Class not found for encoded object", e); LOGGER.log(Level.SEVERE, "Class not found for encoded object", e);
obj = null; obj = null;
} // end catch } // end catch
finally finally
@ -1080,7 +1080,7 @@ public class Base64
// Check for size of file // Check for size of file
if( file.length() > Integer.MAX_VALUE ) if( file.length() > Integer.MAX_VALUE )
{ {
log.warning("File is too big for this convenience method (" + file.length() + " bytes)."); LOGGER.warning("File is too big for this convenience method (" + file.length() + " bytes).");
return null; return null;
} // end if: file too big for int index } // end if: file too big for int index
buffer = new byte[ (int)file.length() ]; buffer = new byte[ (int)file.length() ];
@ -1101,7 +1101,7 @@ public class Base64
} // end try } // end try
catch( java.io.IOException e ) catch( java.io.IOException e )
{ {
log.log(Level.SEVERE, "Error decoding from file " + filename, e); LOGGER.log(Level.SEVERE, "Error decoding from file " + filename, e);
} // end catch: IOException } // end catch: IOException
finally finally
{ {
@ -1149,7 +1149,7 @@ public class Base64
} // end try } // end try
catch( java.io.IOException e ) catch( java.io.IOException e )
{ {
log.log(Level.SEVERE, "Error encoding from file " + filename, e); LOGGER.log(Level.SEVERE, "Error encoding from file " + filename, e);
} // end catch: IOException } // end catch: IOException
finally finally
{ {
@ -1176,7 +1176,7 @@ public class Base64
out.write( encoded.getBytes("US-ASCII") ); // Strict, 7-bit output. out.write( encoded.getBytes("US-ASCII") ); // Strict, 7-bit output.
} // end try } // end try
catch( java.io.IOException ex ) { catch( java.io.IOException ex ) {
log.log(Level.SEVERE, "Error encoding file " + infile, ex); LOGGER.log(Level.SEVERE, "Error encoding file " + infile, ex);
} // end catch } // end catch
finally { finally {
try { out.close(); } try { out.close(); }
@ -1202,7 +1202,7 @@ public class Base64
out.write( decoded ); out.write( decoded );
} // end try } // end try
catch( java.io.IOException ex ) { catch( java.io.IOException ex ) {
log.log(Level.SEVERE, "Error decoding file " + infile, ex); LOGGER.log(Level.SEVERE, "Error decoding file " + infile, ex);
} // end catch } // end catch
finally { finally {
try { out.close(); } try { out.close(); }

View file

@ -47,7 +47,7 @@ import java.util.logging.Logger;
* @author Matt Tucker * @author Matt Tucker
*/ */
public class Cache<K, V> implements Map<K, V> { public class Cache<K, V> implements Map<K, V> {
private static Logger log = Logger.getLogger(Cache.class.getName()); private static final Logger LOGGER = Logger.getLogger(Cache.class.getName());
/** /**
* The map the keys and values are stored in. * The map the keys and values are stored in.
*/ */
@ -382,7 +382,7 @@ public class Cache<K, V> implements Map<K, V> {
while (expireTime > node.timestamp) { while (expireTime > node.timestamp) {
if (remove(node.object, true) == null) { if (remove(node.object, true) == null) {
log.warning("Error attempting to remove(" + node.object.toString() + ") - cacheObject not found in cache!"); LOGGER.warning("Error attempting to remove(" + node.object.toString() + ") - cacheObject not found in cache!");
// remove from the ageList // remove from the ageList
node.remove(); node.remove();
} }
@ -416,7 +416,7 @@ public class Cache<K, V> implements Map<K, V> {
for (int i=map.size(); i>desiredSize; i--) { for (int i=map.size(); i>desiredSize; i--) {
// Get the key and invoke the remove method on it. // Get the key and invoke the remove method on it.
if (remove(lastAccessedList.getLast().object, true) == null) { if (remove(lastAccessedList.getLast().object, true) == null) {
log.warning("Error attempting to cullCache with remove(" + lastAccessedList.getLast().object.toString() + ") - cacheObject not found in cache!"); LOGGER.warning("Error attempting to cullCache with remove(" + lastAccessedList.getLast().object.toString() + ") - cacheObject not found in cache!");
lastAccessedList.getLast().remove(); lastAccessedList.getLast().remove();
} }
} }

View file

@ -55,7 +55,7 @@ import org.xmlpull.v1.XmlPullParserException;
* @author Gaston Dombiak * @author Gaston Dombiak
*/ */
public class PacketParserUtils { public class PacketParserUtils {
private static Logger logger = Logger.getLogger(PacketParserUtils.class.getName()); private static final Logger LOGGER = Logger.getLogger(PacketParserUtils.class.getName());
/** /**
* Namespace used to store packet properties. * Namespace used to store packet properties.
@ -197,7 +197,7 @@ public class PacketParserUtils {
type = Presence.Type.valueOf(typeString); type = Presence.Type.valueOf(typeString);
} }
catch (IllegalArgumentException iae) { catch (IllegalArgumentException iae) {
logger.warning("Found invalid presence type " + typeString); LOGGER.warning("Found invalid presence type " + typeString);
} }
} }
Presence presence = new Presence(type); Presence presence = new Presence(type);
@ -241,7 +241,7 @@ public class PacketParserUtils {
presence.setMode(Presence.Mode.valueOf(modeText)); presence.setMode(Presence.Mode.valueOf(modeText));
} }
catch (IllegalArgumentException iae) { catch (IllegalArgumentException iae) {
logger.warning("Found invalid presence mode " + modeText); LOGGER.warning("Found invalid presence mode " + modeText);
} }
} }
else if (elementName.equals("error")) { else if (elementName.equals("error")) {
@ -262,7 +262,7 @@ public class PacketParserUtils {
presence.addExtension(PacketParserUtils.parsePacketExtension(elementName, namespace, parser)); presence.addExtension(PacketParserUtils.parsePacketExtension(elementName, namespace, parser));
} }
catch (Exception e) { catch (Exception e) {
logger.warning("Failed to parse extension packet in Presence packet."); LOGGER.warning("Failed to parse extension packet in Presence packet.");
} }
} }
} }
@ -642,7 +642,7 @@ public class PacketParserUtils {
value = in.readObject(); value = in.readObject();
} }
catch (Exception e) { catch (Exception e) {
logger.log(Level.SEVERE, "Error parsing java object", e); LOGGER.log(Level.SEVERE, "Error parsing java object", e);
} }
} }
if (name != null && value != null) { if (name != null && value != null) {
@ -785,7 +785,7 @@ public class PacketParserUtils {
} }
} }
catch (IllegalArgumentException iae) { catch (IllegalArgumentException iae) {
logger.log(Level.SEVERE, "Could not find error type for " + type.toUpperCase(), iae); LOGGER.log(Level.SEVERE, "Could not find error type for " + type.toUpperCase(), iae);
} }
return new XMPPError(Integer.parseInt(errorCode), errorType, condition, message, extensions); return new XMPPError(Integer.parseInt(errorCode), errorType, condition, message, extensions);
} }

View file

@ -40,7 +40,7 @@ import java.util.regex.Pattern;
* A collection of utility methods for String objects. * A collection of utility methods for String objects.
*/ */
public class StringUtils { public class StringUtils {
private static Logger log = Logger.getLogger(StringUtils.class.getName()); private static final Logger LOGGER = Logger.getLogger(StringUtils.class.getName());
/** /**
* Date format as defined in XEP-0082 - XMPP Date and Time Profiles. The time zone is set to * Date format as defined in XEP-0082 - XMPP Date and Time Profiles. The time zone is set to
@ -661,7 +661,7 @@ public class StringUtils {
digest = MessageDigest.getInstance("SHA-1"); digest = MessageDigest.getInstance("SHA-1");
} }
catch (NoSuchAlgorithmException nsae) { catch (NoSuchAlgorithmException nsae) {
log.log(Level.SEVERE, "Failed to load the SHA-1 MessageDigest. Smack will be unable to function normally.", nsae); LOGGER.log(Level.SEVERE, "Failed to load the SHA-1 MessageDigest. Smack will be unable to function normally.", nsae);
} }
} }
// Now, compute hash. // Now, compute hash.
@ -669,7 +669,7 @@ public class StringUtils {
digest.update(data.getBytes("UTF-8")); digest.update(data.getBytes("UTF-8"));
} }
catch (UnsupportedEncodingException e) { catch (UnsupportedEncodingException e) {
log.log(Level.SEVERE, "Error computing hash", e); LOGGER.log(Level.SEVERE, "Error computing hash", e);
} }
return encodeHex(digest.digest()); return encodeHex(digest.digest());
} }

View file

@ -63,7 +63,7 @@ import java.util.logging.Logger;
*/ */
public class EnhancedDebugger implements SmackDebugger { public class EnhancedDebugger implements SmackDebugger {
private static Logger log = Logger.getLogger(EnhancedDebugger.class.getName()); private static final Logger LOGGER = Logger.getLogger(EnhancedDebugger.class.getName());
private static final String NEWLINE = "\n"; private static final String NEWLINE = "\n";
@ -428,7 +428,7 @@ public class EnhancedDebugger implements SmackDebugger {
receivedText.replaceRange("", 0, receivedText.getLineEndOffset(0)); receivedText.replaceRange("", 0, receivedText.getLineEndOffset(0));
} }
catch (BadLocationException e) { catch (BadLocationException e) {
log.log(Level.SEVERE, "Error with line offset, MAX_TABLE_ROWS is set too low: " + EnhancedDebuggerWindow.MAX_TABLE_ROWS, e); LOGGER.log(Level.SEVERE, "Error with line offset, MAX_TABLE_ROWS is set too low: " + EnhancedDebuggerWindow.MAX_TABLE_ROWS, e);
} }
} }
receivedText.append(str.substring(0, index + 1)); receivedText.append(str.substring(0, index + 1));
@ -463,7 +463,7 @@ public class EnhancedDebugger implements SmackDebugger {
sentText.replaceRange("", 0, sentText.getLineEndOffset(0)); sentText.replaceRange("", 0, sentText.getLineEndOffset(0));
} }
catch (BadLocationException e) { catch (BadLocationException e) {
log.log(Level.SEVERE, "Error with line offset, MAX_TABLE_ROWS is set too low: " + EnhancedDebuggerWindow.MAX_TABLE_ROWS, e); LOGGER.log(Level.SEVERE, "Error with line offset, MAX_TABLE_ROWS is set too low: " + EnhancedDebuggerWindow.MAX_TABLE_ROWS, e);
} }
} }
@ -896,10 +896,10 @@ public class EnhancedDebugger implements SmackDebugger {
} }
catch (TransformerConfigurationException tce) { catch (TransformerConfigurationException tce) {
log.log(Level.SEVERE, "Transformer Factory error", tce); LOGGER.log(Level.SEVERE, "Transformer Factory error", tce);
} }
catch (TransformerException te) { catch (TransformerException te) {
log.log(Level.SEVERE, "Transformation error", te); LOGGER.log(Level.SEVERE, "Transformation error", te);
} }
return str; return str;
} }

View file

@ -42,7 +42,7 @@ import java.util.logging.Logger;
* @author Gaston Dombiak * @author Gaston Dombiak
*/ */
public class MultipleRecipientManager { public class MultipleRecipientManager {
private static Logger log = Logger.getLogger(MultipleRecipientManager.class.getName()); private static final Logger LOGGER = Logger.getLogger(MultipleRecipientManager.class.getName());
/** /**
* Create a cache to hold the 100 most recently accessed elements for a period of * Create a cache to hold the 100 most recently accessed elements for a period of
@ -315,7 +315,7 @@ public class MultipleRecipientManager {
services.put(serviceName, serviceAddress == null ? "" : serviceAddress); services.put(serviceName, serviceAddress == null ? "" : serviceAddress);
} }
catch (XMPPException e) { catch (XMPPException e) {
log.log(Level.SEVERE, "Error occurred retrieving multiple recipients service", e); LOGGER.log(Level.SEVERE, "Error occurred retrieving multiple recipients service", e);
} }
} }
} }

View file

@ -72,7 +72,7 @@ import org.jivesoftware.smack.XMPPException;
* @author Henning Staib * @author Henning Staib
*/ */
public class Socks5Proxy { public class Socks5Proxy {
private static Logger log = Logger.getLogger(Socks5Proxy.class.getName()); private static final Logger LOGGER = Logger.getLogger(Socks5Proxy.class.getName());
/* SOCKS5 proxy singleton */ /* SOCKS5 proxy singleton */
private static Socks5Proxy socks5Server; private static Socks5Proxy socks5Server;
@ -196,7 +196,7 @@ public class Socks5Proxy {
} }
catch (IOException e) { catch (IOException e) {
// couldn't setup server // couldn't setup server
log.log(Level.SEVERE, "couldn't setup local SOCKS5 proxy on port " + getLocalSocks5ProxyPort(), e); LOGGER.log(Level.SEVERE, "couldn't setup local SOCKS5 proxy on port " + getLocalSocks5ProxyPort(), e);
} }
} }

View file

@ -47,7 +47,7 @@ import org.xmlpull.v1.XmlPullParserException;
* *
*/ */
public class SimpleDirectoryPersistentCache implements EntityCapsPersistentCache { public class SimpleDirectoryPersistentCache implements EntityCapsPersistentCache {
private static Logger log = Logger.getLogger(SimpleDirectoryPersistentCache.class.getName()); private static final Logger LOGGER = Logger.getLogger(SimpleDirectoryPersistentCache.class.getName());
private File cacheDir; private File cacheDir;
private StringEncoder filenameEncoder; private StringEncoder filenameEncoder;
@ -94,7 +94,7 @@ public class SimpleDirectoryPersistentCache implements EntityCapsPersistentCache
if (nodeFile.createNewFile()) if (nodeFile.createNewFile())
writeInfoToFile(nodeFile, info); writeInfoToFile(nodeFile, info);
} catch (IOException e) { } catch (IOException e) {
log.log(Level.SEVERE, "Failed to write disco info to file", e); LOGGER.log(Level.SEVERE, "Failed to write disco info to file", e);
} }
} }
@ -163,7 +163,7 @@ public class SimpleDirectoryPersistentCache implements EntityCapsPersistentCache
parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true); parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
parser.setInput(reader); parser.setInput(reader);
} catch (XmlPullParserException xppe) { } catch (XmlPullParserException xppe) {
log.log(Level.SEVERE, "Exception initializing parser", xppe); LOGGER.log(Level.SEVERE, "Exception initializing parser", xppe);
return null; return null;
} }

View file

@ -75,7 +75,7 @@ import org.jivesoftware.smackx.xdata.Form;
* @author Gaston Dombiak, Larry Kirschner * @author Gaston Dombiak, Larry Kirschner
*/ */
public class MultiUserChat { public class MultiUserChat {
private static Logger log = Logger.getLogger(MultiUserChat.class.getName()); private static final Logger LOGGER = Logger.getLogger(MultiUserChat.class.getName());
private final static String discoNamespace = "http://jabber.org/protocol/muc"; private final static String discoNamespace = "http://jabber.org/protocol/muc";
private final static String discoNode = "http://jabber.org/protocol/muc#rooms"; private final static String discoNode = "http://jabber.org/protocol/muc#rooms";
@ -183,7 +183,7 @@ public class MultiUserChat {
return result.containsFeature(discoNamespace); return result.containsFeature(discoNamespace);
} }
catch (XMPPException e) { catch (XMPPException e) {
log.log(Level.SEVERE, "Error checking user [" + user + "] for MUC support", e); LOGGER.log(Level.SEVERE, "Error checking user [" + user + "] for MUC support", e);
return false; return false;
} }
} }
@ -226,7 +226,7 @@ public class MultiUserChat {
return answer.iterator(); return answer.iterator();
} }
catch (XMPPException e) { catch (XMPPException e) {
log.log(Level.SEVERE, "Error getting joined rooms for user [" + user + "]", e); LOGGER.log(Level.SEVERE, "Error getting joined rooms for user [" + user + "]", e);
// Return an iterator on an empty collection // Return an iterator on an empty collection
return new ArrayList<String>().iterator(); return new ArrayList<String>().iterator();
} }
@ -870,7 +870,7 @@ public class MultiUserChat {
} }
} }
catch (XMPPException e) { catch (XMPPException e) {
log.log(Level.SEVERE, "Error retrieving room nickname", e); LOGGER.log(Level.SEVERE, "Error retrieving room nickname", e);
} }
// If no Identity was found then the user does not have a reserved room nickname // If no Identity was found then the user does not have a reserved room nickname
return null; return null;
@ -1824,11 +1824,11 @@ public class MultiUserChat {
method.invoke(listener, params); method.invoke(listener, params);
} }
} catch (NoSuchMethodException e) { } catch (NoSuchMethodException e) {
log.log(Level.SEVERE, "Failed to invoke method on UserStatusListener", e); LOGGER.log(Level.SEVERE, "Failed to invoke method on UserStatusListener", e);
} catch (InvocationTargetException e) { } catch (InvocationTargetException e) {
log.log(Level.SEVERE, "Failed to invoke method on UserStatusListener", e); LOGGER.log(Level.SEVERE, "Failed to invoke method on UserStatusListener", e);
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
log.log(Level.SEVERE, "Failed to invoke method on UserStatusListener", e); LOGGER.log(Level.SEVERE, "Failed to invoke method on UserStatusListener", e);
} }
} }
@ -1875,11 +1875,11 @@ public class MultiUserChat {
method.invoke(listener, params.toArray()); method.invoke(listener, params.toArray());
} }
} catch (NoSuchMethodException e) { } catch (NoSuchMethodException e) {
log.log(Level.SEVERE, "Failed to invoke method on ParticipantStatusListener", e); LOGGER.log(Level.SEVERE, "Failed to invoke method on ParticipantStatusListener", e);
} catch (InvocationTargetException e) { } catch (InvocationTargetException e) {
log.log(Level.SEVERE, "Failed to invoke method on ParticipantStatusListener", e); LOGGER.log(Level.SEVERE, "Failed to invoke method on ParticipantStatusListener", e);
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
log.log(Level.SEVERE, "Failed to invoke method on ParticipantStatusListener", e); LOGGER.log(Level.SEVERE, "Failed to invoke method on ParticipantStatusListener", e);
} }
} }

View file

@ -37,7 +37,7 @@ import org.xmlpull.v1.XmlPullParser;
* *
*/ */
public class StreamInitiationProvider implements IQProvider { public class StreamInitiationProvider implements IQProvider {
private static Logger log = Logger.getLogger(StreamInitiationProvider.class.getName()); private static final Logger LOGGER = Logger.getLogger(StreamInitiationProvider.class.getName());
public IQ parseIQ(final XmlPullParser parser) throws Exception { public IQ parseIQ(final XmlPullParser parser) throws Exception {
boolean done = false; boolean done = false;
@ -91,7 +91,7 @@ public class StreamInitiationProvider implements IQProvider {
fileSize = Long.parseLong(size); fileSize = Long.parseLong(size);
} }
catch (NumberFormatException e) { catch (NumberFormatException e) {
log.log(Level.SEVERE, "Failed to parse file size from " + fileSize, e); LOGGER.log(Level.SEVERE, "Failed to parse file size from " + fileSize, e);
} }
} }

View file

@ -60,7 +60,7 @@ import java.util.logging.Logger;
* @author Matt Tucker * @author Matt Tucker
*/ */
public class Time extends IQ { public class Time extends IQ {
private static Logger log = Logger.getLogger(Time.class.getName()); private static final Logger LOGGER = Logger.getLogger(Time.class.getName());
private static SimpleDateFormat utcFormat = new SimpleDateFormat("yyyyMMdd'T'HH:mm:ss"); private static SimpleDateFormat utcFormat = new SimpleDateFormat("yyyyMMdd'T'HH:mm:ss");
private static DateFormat displayFormat = DateFormat.getDateTimeInstance(); private static DateFormat displayFormat = DateFormat.getDateTimeInstance();
@ -109,7 +109,7 @@ public class Time extends IQ {
date = cal.getTime(); date = cal.getTime();
} }
catch (Exception e) { catch (Exception e) {
log.log(Level.SEVERE, "Error getting local time", e); LOGGER.log(Level.SEVERE, "Error getting local time", e);
} }
return date; return date;
} }

View file

@ -79,7 +79,7 @@ import org.jivesoftware.smack.util.StringUtils;
* @author Kirill Maximov (kir@maxkir.com) * @author Kirill Maximov (kir@maxkir.com)
*/ */
public class VCard extends IQ { public class VCard extends IQ {
private static Logger log = Logger.getLogger(VCard.class.getName()); private static final Logger LOGGER = Logger.getLogger(VCard.class.getName());
private static final String DEFAULT_MIME_TYPE = "image/jpeg"; private static final String DEFAULT_MIME_TYPE = "image/jpeg";
@ -328,7 +328,7 @@ public class VCard extends IQ {
bytes = getBytes(avatarURL); bytes = getBytes(avatarURL);
} }
catch (IOException e) { catch (IOException e) {
log.log(Level.SEVERE, "Error getting bytes from URL: " + avatarURL, e); LOGGER.log(Level.SEVERE, "Error getting bytes from URL: " + avatarURL, e);
} }
setAvatar(bytes); setAvatar(bytes);
@ -485,7 +485,7 @@ public class VCard extends IQ {
digest = MessageDigest.getInstance("SHA-1"); digest = MessageDigest.getInstance("SHA-1");
} }
catch (NoSuchAlgorithmException e) { catch (NoSuchAlgorithmException e) {
log.log(Level.SEVERE, "Failed to get message digest", e); LOGGER.log(Level.SEVERE, "Failed to get message digest", e);
return null; return null;
} }

View file

@ -42,7 +42,7 @@ import java.util.logging.Logger;
* @author Derek DeMoro * @author Derek DeMoro
*/ */
public class VCardProvider implements IQProvider { public class VCardProvider implements IQProvider {
private static Logger log = Logger.getLogger(VCardProvider.class.getName()); private static final Logger LOGGER = Logger.getLogger(VCardProvider.class.getName());
private static final String PREFERRED_ENCODING = "UTF-8"; private static final String PREFERRED_ENCODING = "UTF-8";
@ -72,10 +72,10 @@ public class VCardProvider implements IQProvider {
} }
} }
catch (XmlPullParserException e) { catch (XmlPullParserException e) {
log.log(Level.SEVERE, "Exception parsing VCard", e); LOGGER.log(Level.SEVERE, "Exception parsing VCard", e);
} }
catch (IOException e) { catch (IOException e) {
log.log(Level.SEVERE, "Exception parsing VCard", e); LOGGER.log(Level.SEVERE, "Exception parsing VCard", e);
} }
String xmlText = sb.toString(); String xmlText = sb.toString();

View file

@ -40,7 +40,7 @@ import org.jivesoftware.smackx.xevent.packet.MessageEvent;
* @author Gaston Dombiak * @author Gaston Dombiak
*/ */
public class MessageEventManager { public class MessageEventManager {
private static Logger log = Logger.getLogger(MessageEventManager.class.getName()); private static final Logger LOGGER = Logger.getLogger(MessageEventManager.class.getName());
private List<MessageEventNotificationListener> messageEventNotificationListeners = new ArrayList<MessageEventNotificationListener>(); private List<MessageEventNotificationListener> messageEventNotificationListeners = new ArrayList<MessageEventNotificationListener>();
private List<MessageEventRequestListener> messageEventRequestListeners = new ArrayList<MessageEventRequestListener>(); private List<MessageEventRequestListener> messageEventRequestListeners = new ArrayList<MessageEventRequestListener>();
@ -157,7 +157,7 @@ public class MessageEventManager {
method.invoke(listeners[i], new Object[] { from, packetID, this }); method.invoke(listeners[i], new Object[] { from, packetID, this });
} }
} catch (Exception e) { } catch (Exception e) {
log.log(Level.SEVERE, "Error while invoking MessageEventRequestListener", e); LOGGER.log(Level.SEVERE, "Error while invoking MessageEventRequestListener", e);
} }
} }
@ -184,7 +184,7 @@ public class MessageEventManager {
method.invoke(listeners[i], new Object[] { from, packetID }); method.invoke(listeners[i], new Object[] { from, packetID });
} }
} catch (Exception e) { } catch (Exception e) {
log.log(Level.SEVERE, "Error while invoking MessageEventNotificationListener", e); LOGGER.log(Level.SEVERE, "Error while invoking MessageEventNotificationListener", e);
} }
} }

View file

@ -38,7 +38,7 @@ import java.util.logging.Logger;
*/ */
public class XHTMLManager { public class XHTMLManager {
private static Logger log = Logger.getLogger(XHTMLManager.class.getName()); private static final Logger LOGGER = Logger.getLogger(XHTMLManager.class.getName());
private final static String namespace = "http://jabber.org/protocol/xhtml-im"; private final static String namespace = "http://jabber.org/protocol/xhtml-im";
@ -139,7 +139,7 @@ public class XHTMLManager {
return result.containsFeature(namespace); return result.containsFeature(namespace);
} }
catch (XMPPException e) { catch (XMPPException e) {
log.log(Level.SEVERE, "Error checking if service is available", e); LOGGER.log(Level.SEVERE, "Error checking if service is available", e);
return false; return false;
} }
} }

View file

@ -44,7 +44,7 @@ import java.util.logging.Logger;
* @see AgentSession#getAgentRoster() * @see AgentSession#getAgentRoster()
*/ */
public class AgentRoster { public class AgentRoster {
private static Logger log = Logger.getLogger(AgentRoster.class.getName()); private static final Logger LOGGER = Logger.getLogger(AgentRoster.class.getName());
private static final int EVENT_AGENT_ADDED = 0; private static final int EVENT_AGENT_ADDED = 0;
private static final int EVENT_AGENT_REMOVED = 1; private static final int EVENT_AGENT_REMOVED = 1;
private static final int EVENT_PRESENCE_CHANGED = 2; private static final int EVENT_PRESENCE_CHANGED = 2;
@ -283,7 +283,7 @@ public class AgentRoster {
String from = presence.getFrom(); String from = presence.getFrom();
if (from == null) { if (from == null) {
// TODO Check if we need to ignore these presences or this is a server bug? // TODO Check if we need to ignore these presences or this is a server bug?
log.warning("Presence with no FROM: " + presence.toXML()); LOGGER.warning("Presence with no FROM: " + presence.toXML());
return; return;
} }
String key = getPresenceMapKey(from); String key = getPresenceMapKey(from);

View file

@ -53,7 +53,7 @@ import java.util.logging.Logger;
* @author Derek DeMoro * @author Derek DeMoro
*/ */
public class AgentSession { public class AgentSession {
private static Logger log = Logger.getLogger(AgentSession.class.getName()); private static final Logger LOGGER = Logger.getLogger(AgentSession.class.getName());
private Connection connection; private Connection connection;
@ -119,7 +119,7 @@ public class AgentSession {
handlePacket(packet); handlePacket(packet);
} }
catch (Exception e) { catch (Exception e) {
log.log(Level.SEVERE, "Error processing packet", e); LOGGER.log(Level.SEVERE, "Error processing packet", e);
} }
} }
}; };

View file

@ -34,7 +34,7 @@ import java.util.logging.Logger;
* currently in a queue. * currently in a queue.
*/ */
public class QueueDetails implements PacketExtension { public class QueueDetails implements PacketExtension {
private static Logger log = Logger.getLogger(QueueDetails.class.getName()); private static final Logger LOGGER = Logger.getLogger(QueueDetails.class.getName());
/** /**
* Element name of the packet extension. * Element name of the packet extension.
@ -178,7 +178,7 @@ public class QueueDetails implements PacketExtension {
} }
else if( parser.getName().equals( "waitTime" ) ) { else if( parser.getName().equals( "waitTime" ) ) {
Date wait = dateFormat.parse(parser.nextText()); Date wait = dateFormat.parse(parser.nextText());
log.fine(wait.toString()); LOGGER.fine(wait.toString());
} }
eventType = parser.next(); eventType = parser.next();

View file

@ -35,7 +35,7 @@ import java.util.logging.Logger;
* @author loki der quaeler * @author loki der quaeler
*/ */
public class ListenerEventDispatcher implements Runnable { public class ListenerEventDispatcher implements Runnable {
private static Logger log = Logger.getLogger(ListenerEventDispatcher.class.getName()); private static final Logger LOGGER = Logger.getLogger(ListenerEventDispatcher.class.getName());
protected transient ArrayList<TripletContainer> triplets; protected transient ArrayList<TripletContainer> triplets;
@ -95,7 +95,7 @@ public class ListenerEventDispatcher implements Runnable {
try { try {
tc.getListenerMethod().invoke(tc.getListenerInstance(), tc.getMethodArguments()); tc.getListenerMethod().invoke(tc.getListenerInstance(), tc.getMethodArguments());
} catch (Exception e) { } catch (Exception e) {
log.log(Level.SEVERE, "Exception dispatching an event", e); LOGGER.log(Level.SEVERE, "Exception dispatching an event", e);
} }
} }