diff --git a/core/src/main/java/org/jivesoftware/smack/AccountManager.java b/core/src/main/java/org/jivesoftware/smack/AccountManager.java index 0e6f259fd..4509a7203 100644 --- a/core/src/main/java/org/jivesoftware/smack/AccountManager.java +++ b/core/src/main/java/org/jivesoftware/smack/AccountManager.java @@ -39,7 +39,7 @@ import java.util.logging.Logger; * @author Matt Tucker */ 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 Registration info = null; @@ -134,7 +134,7 @@ public class AccountManager { } } 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(); } @@ -155,7 +155,7 @@ public class AccountManager { return info.getAttributes().get(name); } 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; } @@ -175,7 +175,7 @@ public class AccountManager { return info.getInstructions(); } 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; } } diff --git a/core/src/main/java/org/jivesoftware/smack/Connection.java b/core/src/main/java/org/jivesoftware/smack/Connection.java index 256798e38..f8b12e663 100644 --- a/core/src/main/java/org/jivesoftware/smack/Connection.java +++ b/core/src/main/java/org/jivesoftware/smack/Connection.java @@ -81,7 +81,7 @@ import org.jivesoftware.smack.packet.Presence; * @author Guenther Niess */ 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. @@ -793,7 +793,7 @@ public abstract class Connection { debuggerClass = Class.forName(className); } catch (Exception e) { - log.warning("Unabled to instantiate debugger class " + className); + LOGGER.warning("Unabled to instantiate debugger class " + className); } } if (debuggerClass == null) { @@ -807,7 +807,7 @@ public abstract class Connection { Class.forName("org.jivesoftware.smack.debugger.LiteDebugger"); } catch (Exception ex2) { - log.warning("Unabled to instantiate either Smack debugger class"); + LOGGER.warning("Unabled to instantiate either Smack debugger class"); } } } diff --git a/core/src/main/java/org/jivesoftware/smack/PacketReader.java b/core/src/main/java/org/jivesoftware/smack/PacketReader.java index fd73cab7f..0241cf2c0 100644 --- a/core/src/main/java/org/jivesoftware/smack/PacketReader.java +++ b/core/src/main/java/org/jivesoftware/smack/PacketReader.java @@ -44,7 +44,7 @@ import java.util.logging.Logger; */ 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 ExecutorService listenerExecutor; @@ -135,7 +135,7 @@ class PacketReader { catch (Exception e) { // Catch and print any exception so we can recover // 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); } 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 { listenerWrapper.notifyListener(packet); } catch (Exception e) { - log.log(Level.SEVERE, "Exception in packet listener", e); + LOGGER.log(Level.SEVERE, "Exception in packet listener", e); } } } diff --git a/core/src/main/java/org/jivesoftware/smack/PacketWriter.java b/core/src/main/java/org/jivesoftware/smack/PacketWriter.java index 8120edeb6..f1ff4d958 100644 --- a/core/src/main/java/org/jivesoftware/smack/PacketWriter.java +++ b/core/src/main/java/org/jivesoftware/smack/PacketWriter.java @@ -37,7 +37,7 @@ import java.util.logging.Logger; * @author Matt Tucker */ 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 Writer writer; @@ -88,7 +88,7 @@ class PacketWriter { queue.put(packet); } 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; } synchronized (queue) { @@ -172,7 +172,7 @@ class PacketWriter { writer.flush(); } 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). diff --git a/core/src/main/java/org/jivesoftware/smack/ReconnectionManager.java b/core/src/main/java/org/jivesoftware/smack/ReconnectionManager.java index 2c9599bf5..5eabfddf2 100644 --- a/core/src/main/java/org/jivesoftware/smack/ReconnectionManager.java +++ b/core/src/main/java/org/jivesoftware/smack/ReconnectionManager.java @@ -34,7 +34,7 @@ import java.util.logging.Logger; * @author Francisco Vives */ 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 private Connection connection; @@ -134,7 +134,7 @@ public class ReconnectionManager implements ConnectionListener { .notifyAttemptToReconnectIn(remainingSeconds); } catch (InterruptedException e1) { - log.warning("Sleeping thread interrupted"); + LOGGER.warning("Sleeping thread interrupted"); // Notify the reconnection has failed ReconnectionManager.this.notifyReconnectionFailed(e1); } diff --git a/core/src/main/java/org/jivesoftware/smack/SmackConfiguration.java b/core/src/main/java/org/jivesoftware/smack/SmackConfiguration.java index 057caec65..bff22d06b 100644 --- a/core/src/main/java/org/jivesoftware/smack/SmackConfiguration.java +++ b/core/src/main/java/org/jivesoftware/smack/SmackConfiguration.java @@ -55,7 +55,7 @@ public final class SmackConfiguration { private static final String SMACK_VERSION; 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 packetCollectorSize = 5000; @@ -72,7 +72,7 @@ public final class SmackConfiguration { is.read(buf); smackVersion = new String(buf, "UTF-8"); } 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"; } SMACK_VERSION = smackVersion; @@ -271,7 +271,7 @@ public final class SmackConfiguration { cfgFileStream.close(); } 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(); if (eventType == XmlPullParser.START_TAG && "className".equals(name)) { if (disabledSmackClasses.contains(name)) { - log.info("Not loading disabled Smack class " + name); + LOGGER.info("Not loading disabled Smack class " + name); } else { String classToLoad = parser.nextText(); @@ -316,7 +316,7 @@ public final class SmackConfiguration { else { 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: "); if (!optional) throw cnfe; diff --git a/core/src/main/java/org/jivesoftware/smack/initializer/LoggingInitializer.java b/core/src/main/java/org/jivesoftware/smack/initializer/LoggingInitializer.java index cb8560222..a0b2acc41 100644 --- a/core/src/main/java/org/jivesoftware/smack/initializer/LoggingInitializer.java +++ b/core/src/main/java/org/jivesoftware/smack/initializer/LoggingInitializer.java @@ -33,7 +33,7 @@ import org.jivesoftware.smack.util.FileUtils; */ 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 exceptions = new LinkedList(); @@ -43,7 +43,7 @@ public class LoggingInitializer implements SmackInitializer { LogManager.getLogManager().readConfiguration(FileUtils.getStreamForUrl("classpath:org.jivesofware.smack/jul.properties", null)); } 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); } } diff --git a/core/src/main/java/org/jivesoftware/smack/initializer/UrlProviderFileInitializer.java b/core/src/main/java/org/jivesoftware/smack/initializer/UrlProviderFileInitializer.java index a992f7feb..88bf1da05 100644 --- a/core/src/main/java/org/jivesoftware/smack/initializer/UrlProviderFileInitializer.java +++ b/core/src/main/java/org/jivesoftware/smack/initializer/UrlProviderFileInitializer.java @@ -35,7 +35,7 @@ import org.jivesoftware.smack.util.FileUtils; * */ 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 exceptions = new LinkedList(); @@ -47,18 +47,18 @@ public abstract class UrlProviderFileInitializer implements SmackInitializer { InputStream is = FileUtils.getStreamForUrl(filePath, getClassLoader()); 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); ProviderManager.getInstance().addLoader(pfl); exceptions.addAll(pfl.getLoadingExceptions()); } 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)); } } 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); } } diff --git a/core/src/main/java/org/jivesoftware/smack/packet/Packet.java b/core/src/main/java/org/jivesoftware/smack/packet/Packet.java index 3bf09c748..669843d10 100644 --- a/core/src/main/java/org/jivesoftware/smack/packet/Packet.java +++ b/core/src/main/java/org/jivesoftware/smack/packet/Packet.java @@ -40,7 +40,7 @@ import java.util.logging.Logger; * @author Matt Tucker */ 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 = java.util.Locale.getDefault().getLanguage().toLowerCase(); @@ -411,7 +411,7 @@ public abstract class Packet { buf.append(encodedVal).append(""); } catch (Exception e) { - log.log(Level.SEVERE, "Error encoding java object", e); + LOGGER.log(Level.SEVERE, "Error encoding java object", e); } finally { if (out != null) { diff --git a/core/src/main/java/org/jivesoftware/smack/parsing/ExceptionLoggingCallback.java b/core/src/main/java/org/jivesoftware/smack/parsing/ExceptionLoggingCallback.java index f74ed049e..1bd82b14c 100644 --- a/core/src/main/java/org/jivesoftware/smack/parsing/ExceptionLoggingCallback.java +++ b/core/src/main/java/org/jivesoftware/smack/parsing/ExceptionLoggingCallback.java @@ -27,11 +27,11 @@ import java.util.logging.Logger; * */ 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 public void handleUnparsablePacket(UnparsablePacket unparsed) throws Exception { - log.log(Level.SEVERE, "Smack message parsing exception: ", unparsed.getParsingException()); - log.severe("Unparsed content: " + unparsed.getContent()); + LOGGER.log(Level.SEVERE, "Smack message parsing exception: ", unparsed.getParsingException()); + LOGGER.severe("Unparsed content: " + unparsed.getContent()); } } diff --git a/core/src/main/java/org/jivesoftware/smack/provider/ProviderFileLoader.java b/core/src/main/java/org/jivesoftware/smack/provider/ProviderFileLoader.java index dabb94718..55a0c6d94 100644 --- a/core/src/main/java/org/jivesoftware/smack/provider/ProviderFileLoader.java +++ b/core/src/main/java/org/jivesoftware/smack/provider/ProviderFileLoader.java @@ -38,7 +38,7 @@ import org.xmlpull.v1.XmlPullParser; * */ 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 iqProviders; private Collection extProviders; @@ -135,13 +135,13 @@ public class ProviderFileLoader implements ProviderLoader { } } 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); } } } 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); } } @@ -150,7 +150,7 @@ public class ProviderFileLoader implements ProviderLoader { while (eventType != XmlPullParser.END_DOCUMENT); } 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 { try { diff --git a/core/src/main/java/org/jivesoftware/smack/util/Base64.java b/core/src/main/java/org/jivesoftware/smack/util/Base64.java index dc839c639..580bbccfc 100644 --- a/core/src/main/java/org/jivesoftware/smack/util/Base64.java +++ b/core/src/main/java/org/jivesoftware/smack/util/Base64.java @@ -30,7 +30,7 @@ import java.util.logging.Logger; */ 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 ******** */ @@ -494,7 +494,7 @@ public class Base64 } // end try catch( java.io.IOException e ) { - log.log(Level.SEVERE, "Error encoding object", e); + LOGGER.log(Level.SEVERE, "Error encoding object", e); return null; } // end catch finally @@ -623,7 +623,7 @@ public class Base64 } // end try catch( java.io.IOException e ) { - log.log(Level.SEVERE, "Error encoding bytes", e); + LOGGER.log(Level.SEVERE, "Error encoding bytes", e); return null; } // end catch finally @@ -778,11 +778,11 @@ public class Base64 return 3; }catch( Exception e){ - log.log(Level.SEVERE, e.getMessage(), e); - log.severe(""+source[srcOffset]+ ": " + ( DECODABET[ source[ srcOffset ] ] ) ); - log.severe(""+source[srcOffset+1]+ ": " + ( DECODABET[ source[ srcOffset + 1 ] ] ) ); - log.severe(""+source[srcOffset+2]+ ": " + ( DECODABET[ source[ srcOffset + 2 ] ] ) ); - log.severe(""+source[srcOffset+3]+ ": " + ( DECODABET[ source[ srcOffset + 3 ] ] ) ); + LOGGER.log(Level.SEVERE, e.getMessage(), e); + LOGGER.severe(""+source[srcOffset]+ ": " + ( DECODABET[ source[ srcOffset ] ] ) ); + LOGGER.severe(""+source[srcOffset+1]+ ": " + ( DECODABET[ source[ srcOffset + 1 ] ] ) ); + LOGGER.severe(""+source[srcOffset+2]+ ": " + ( DECODABET[ source[ srcOffset + 2 ] ] ) ); + LOGGER.severe(""+source[srcOffset+3]+ ": " + ( DECODABET[ source[ srcOffset + 3 ] ] ) ); return -1; } // end catch } @@ -840,7 +840,7 @@ public class Base64 } // end if: white space, equals sign or better 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; } // end else: } // each input character @@ -968,12 +968,12 @@ public class Base64 } // end try catch( java.io.IOException e ) { - log.log(Level.SEVERE, "Error reading object", e); + LOGGER.log(Level.SEVERE, "Error reading object", e); obj = null; } // end catch 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; } // end catch finally @@ -1080,7 +1080,7 @@ public class Base64 // Check for size of file 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; } // end if: file too big for int index buffer = new byte[ (int)file.length() ]; @@ -1101,7 +1101,7 @@ public class Base64 } // end try 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 finally { @@ -1149,7 +1149,7 @@ public class Base64 } // end try 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 finally { @@ -1176,7 +1176,7 @@ public class Base64 out.write( encoded.getBytes("US-ASCII") ); // Strict, 7-bit output. } // end try 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 finally { try { out.close(); } @@ -1202,7 +1202,7 @@ public class Base64 out.write( decoded ); } // end try 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 finally { try { out.close(); } diff --git a/core/src/main/java/org/jivesoftware/smack/util/Cache.java b/core/src/main/java/org/jivesoftware/smack/util/Cache.java index 98bdaad20..a350faaef 100644 --- a/core/src/main/java/org/jivesoftware/smack/util/Cache.java +++ b/core/src/main/java/org/jivesoftware/smack/util/Cache.java @@ -47,7 +47,7 @@ import java.util.logging.Logger; * @author Matt Tucker */ public class Cache implements Map { - 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. */ @@ -382,7 +382,7 @@ public class Cache implements Map { while (expireTime > node.timestamp) { 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 node.remove(); } @@ -416,7 +416,7 @@ public class Cache implements Map { for (int i=map.size(); i>desiredSize; i--) { // Get the key and invoke the remove method on it. 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(); } } diff --git a/core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java b/core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java index a122e3bd6..d7d2f3913 100644 --- a/core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java +++ b/core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java @@ -55,7 +55,7 @@ import org.xmlpull.v1.XmlPullParserException; * @author Gaston Dombiak */ 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. @@ -197,7 +197,7 @@ public class PacketParserUtils { type = Presence.Type.valueOf(typeString); } catch (IllegalArgumentException iae) { - logger.warning("Found invalid presence type " + typeString); + LOGGER.warning("Found invalid presence type " + typeString); } } Presence presence = new Presence(type); @@ -241,7 +241,7 @@ public class PacketParserUtils { presence.setMode(Presence.Mode.valueOf(modeText)); } catch (IllegalArgumentException iae) { - logger.warning("Found invalid presence mode " + modeText); + LOGGER.warning("Found invalid presence mode " + modeText); } } else if (elementName.equals("error")) { @@ -262,7 +262,7 @@ public class PacketParserUtils { presence.addExtension(PacketParserUtils.parsePacketExtension(elementName, namespace, parser)); } 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(); } 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) { @@ -785,7 +785,7 @@ public class PacketParserUtils { } } 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); } diff --git a/core/src/main/java/org/jivesoftware/smack/util/StringUtils.java b/core/src/main/java/org/jivesoftware/smack/util/StringUtils.java index ac4db6597..73ad26926 100644 --- a/core/src/main/java/org/jivesoftware/smack/util/StringUtils.java +++ b/core/src/main/java/org/jivesoftware/smack/util/StringUtils.java @@ -40,7 +40,7 @@ import java.util.regex.Pattern; * A collection of utility methods for String objects. */ 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 @@ -661,7 +661,7 @@ public class StringUtils { digest = MessageDigest.getInstance("SHA-1"); } 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. @@ -669,7 +669,7 @@ public class StringUtils { digest.update(data.getBytes("UTF-8")); } catch (UnsupportedEncodingException e) { - log.log(Level.SEVERE, "Error computing hash", e); + LOGGER.log(Level.SEVERE, "Error computing hash", e); } return encodeHex(digest.digest()); } diff --git a/debug/src/main/java/org/jivesoftware/smackx/debugger/EnhancedDebugger.java b/debug/src/main/java/org/jivesoftware/smackx/debugger/EnhancedDebugger.java index 21941f885..25d20d64f 100644 --- a/debug/src/main/java/org/jivesoftware/smackx/debugger/EnhancedDebugger.java +++ b/debug/src/main/java/org/jivesoftware/smackx/debugger/EnhancedDebugger.java @@ -63,7 +63,7 @@ import java.util.logging.Logger; */ 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"; @@ -428,7 +428,7 @@ public class EnhancedDebugger implements SmackDebugger { receivedText.replaceRange("", 0, receivedText.getLineEndOffset(0)); } 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)); @@ -463,7 +463,7 @@ public class EnhancedDebugger implements SmackDebugger { sentText.replaceRange("", 0, sentText.getLineEndOffset(0)); } 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) { - log.log(Level.SEVERE, "Transformer Factory error", tce); + LOGGER.log(Level.SEVERE, "Transformer Factory error", tce); } catch (TransformerException te) { - log.log(Level.SEVERE, "Transformation error", te); + LOGGER.log(Level.SEVERE, "Transformation error", te); } return str; } diff --git a/extensions/src/main/java/org/jivesoftware/smackx/address/MultipleRecipientManager.java b/extensions/src/main/java/org/jivesoftware/smackx/address/MultipleRecipientManager.java index b0cc4b950..4faf6a7de 100644 --- a/extensions/src/main/java/org/jivesoftware/smackx/address/MultipleRecipientManager.java +++ b/extensions/src/main/java/org/jivesoftware/smackx/address/MultipleRecipientManager.java @@ -42,7 +42,7 @@ import java.util.logging.Logger; * @author Gaston Dombiak */ 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 @@ -315,7 +315,7 @@ public class MultipleRecipientManager { services.put(serviceName, serviceAddress == null ? "" : serviceAddress); } 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); } } } diff --git a/extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5Proxy.java b/extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5Proxy.java index 9a66e7571..4684da8b5 100644 --- a/extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5Proxy.java +++ b/extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5Proxy.java @@ -72,7 +72,7 @@ import org.jivesoftware.smack.XMPPException; * @author Henning Staib */ 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 */ private static Socks5Proxy socks5Server; @@ -196,7 +196,7 @@ public class Socks5Proxy { } catch (IOException e) { // 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); } } diff --git a/extensions/src/main/java/org/jivesoftware/smackx/caps/cache/SimpleDirectoryPersistentCache.java b/extensions/src/main/java/org/jivesoftware/smackx/caps/cache/SimpleDirectoryPersistentCache.java index 78679c764..867b0efaa 100644 --- a/extensions/src/main/java/org/jivesoftware/smackx/caps/cache/SimpleDirectoryPersistentCache.java +++ b/extensions/src/main/java/org/jivesoftware/smackx/caps/cache/SimpleDirectoryPersistentCache.java @@ -47,7 +47,7 @@ import org.xmlpull.v1.XmlPullParserException; * */ 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 StringEncoder filenameEncoder; @@ -94,7 +94,7 @@ public class SimpleDirectoryPersistentCache implements EntityCapsPersistentCache if (nodeFile.createNewFile()) writeInfoToFile(nodeFile, info); } 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.setInput(reader); } catch (XmlPullParserException xppe) { - log.log(Level.SEVERE, "Exception initializing parser", xppe); + LOGGER.log(Level.SEVERE, "Exception initializing parser", xppe); return null; } diff --git a/extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java b/extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java index 1f761c77c..c41b31637 100644 --- a/extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java +++ b/extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java @@ -75,7 +75,7 @@ import org.jivesoftware.smackx.xdata.Form; * @author Gaston Dombiak, Larry Kirschner */ 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 discoNode = "http://jabber.org/protocol/muc#rooms"; @@ -183,7 +183,7 @@ public class MultiUserChat { return result.containsFeature(discoNamespace); } 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; } } @@ -226,7 +226,7 @@ public class MultiUserChat { return answer.iterator(); } 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 new ArrayList().iterator(); } @@ -870,7 +870,7 @@ public class MultiUserChat { } } 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 return null; @@ -1824,11 +1824,11 @@ public class MultiUserChat { method.invoke(listener, params); } } 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) { - 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) { - 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()); } } 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) { - 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) { - log.log(Level.SEVERE, "Failed to invoke method on ParticipantStatusListener", e); + LOGGER.log(Level.SEVERE, "Failed to invoke method on ParticipantStatusListener", e); } } diff --git a/extensions/src/main/java/org/jivesoftware/smackx/si/provider/StreamInitiationProvider.java b/extensions/src/main/java/org/jivesoftware/smackx/si/provider/StreamInitiationProvider.java index c4d3180f9..c0f0512c9 100644 --- a/extensions/src/main/java/org/jivesoftware/smackx/si/provider/StreamInitiationProvider.java +++ b/extensions/src/main/java/org/jivesoftware/smackx/si/provider/StreamInitiationProvider.java @@ -37,7 +37,7 @@ import org.xmlpull.v1.XmlPullParser; * */ 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 { boolean done = false; @@ -91,7 +91,7 @@ public class StreamInitiationProvider implements IQProvider { fileSize = Long.parseLong(size); } 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); } } diff --git a/extensions/src/main/java/org/jivesoftware/smackx/time/packet/Time.java b/extensions/src/main/java/org/jivesoftware/smackx/time/packet/Time.java index f844c4551..ebe7cdcf2 100644 --- a/extensions/src/main/java/org/jivesoftware/smackx/time/packet/Time.java +++ b/extensions/src/main/java/org/jivesoftware/smackx/time/packet/Time.java @@ -60,7 +60,7 @@ import java.util.logging.Logger; * @author Matt Tucker */ 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 DateFormat displayFormat = DateFormat.getDateTimeInstance(); @@ -109,7 +109,7 @@ public class Time extends IQ { date = cal.getTime(); } catch (Exception e) { - log.log(Level.SEVERE, "Error getting local time", e); + LOGGER.log(Level.SEVERE, "Error getting local time", e); } return date; } diff --git a/extensions/src/main/java/org/jivesoftware/smackx/vcardtemp/packet/VCard.java b/extensions/src/main/java/org/jivesoftware/smackx/vcardtemp/packet/VCard.java index 11c633692..d399c7606 100644 --- a/extensions/src/main/java/org/jivesoftware/smackx/vcardtemp/packet/VCard.java +++ b/extensions/src/main/java/org/jivesoftware/smackx/vcardtemp/packet/VCard.java @@ -79,7 +79,7 @@ import org.jivesoftware.smack.util.StringUtils; * @author Kirill Maximov (kir@maxkir.com) */ 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"; @@ -328,7 +328,7 @@ public class VCard extends IQ { bytes = getBytes(avatarURL); } 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); @@ -485,7 +485,7 @@ public class VCard extends IQ { digest = MessageDigest.getInstance("SHA-1"); } 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; } diff --git a/extensions/src/main/java/org/jivesoftware/smackx/vcardtemp/provider/VCardProvider.java b/extensions/src/main/java/org/jivesoftware/smackx/vcardtemp/provider/VCardProvider.java index 1f0ca8309..04b3579e6 100644 --- a/extensions/src/main/java/org/jivesoftware/smackx/vcardtemp/provider/VCardProvider.java +++ b/extensions/src/main/java/org/jivesoftware/smackx/vcardtemp/provider/VCardProvider.java @@ -42,7 +42,7 @@ import java.util.logging.Logger; * @author Derek DeMoro */ 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"; @@ -72,10 +72,10 @@ public class VCardProvider implements IQProvider { } } catch (XmlPullParserException e) { - log.log(Level.SEVERE, "Exception parsing VCard", e); + LOGGER.log(Level.SEVERE, "Exception parsing VCard", e); } catch (IOException e) { - log.log(Level.SEVERE, "Exception parsing VCard", e); + LOGGER.log(Level.SEVERE, "Exception parsing VCard", e); } String xmlText = sb.toString(); diff --git a/extensions/src/main/java/org/jivesoftware/smackx/xevent/MessageEventManager.java b/extensions/src/main/java/org/jivesoftware/smackx/xevent/MessageEventManager.java index 2d9953a9b..468778130 100644 --- a/extensions/src/main/java/org/jivesoftware/smackx/xevent/MessageEventManager.java +++ b/extensions/src/main/java/org/jivesoftware/smackx/xevent/MessageEventManager.java @@ -40,7 +40,7 @@ import org.jivesoftware.smackx.xevent.packet.MessageEvent; * @author Gaston Dombiak */ public class MessageEventManager { - private static Logger log = Logger.getLogger(MessageEventManager.class.getName()); + private static final Logger LOGGER = Logger.getLogger(MessageEventManager.class.getName()); private List messageEventNotificationListeners = new ArrayList(); private List messageEventRequestListeners = new ArrayList(); @@ -157,7 +157,7 @@ public class MessageEventManager { method.invoke(listeners[i], new Object[] { from, packetID, this }); } } 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 }); } } catch (Exception e) { - log.log(Level.SEVERE, "Error while invoking MessageEventNotificationListener", e); + LOGGER.log(Level.SEVERE, "Error while invoking MessageEventNotificationListener", e); } } diff --git a/extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLManager.java b/extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLManager.java index e15f9dbaa..fc5908921 100644 --- a/extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLManager.java +++ b/extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLManager.java @@ -38,7 +38,7 @@ import java.util.logging.Logger; */ 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"; @@ -139,7 +139,7 @@ public class XHTMLManager { return result.containsFeature(namespace); } 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; } } diff --git a/legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentRoster.java b/legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentRoster.java index 53525420a..08623e2aa 100644 --- a/legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentRoster.java +++ b/legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentRoster.java @@ -44,7 +44,7 @@ import java.util.logging.Logger; * @see AgentSession#getAgentRoster() */ 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_REMOVED = 1; private static final int EVENT_PRESENCE_CHANGED = 2; @@ -283,7 +283,7 @@ public class AgentRoster { String from = presence.getFrom(); if (from == null) { // 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; } String key = getPresenceMapKey(from); diff --git a/legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentSession.java b/legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentSession.java index 3abf3fda7..c0040d795 100644 --- a/legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentSession.java +++ b/legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentSession.java @@ -53,7 +53,7 @@ import java.util.logging.Logger; * @author Derek DeMoro */ 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; @@ -119,7 +119,7 @@ public class AgentSession { handlePacket(packet); } catch (Exception e) { - log.log(Level.SEVERE, "Error processing packet", e); + LOGGER.log(Level.SEVERE, "Error processing packet", e); } } }; diff --git a/legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/QueueDetails.java b/legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/QueueDetails.java index 2df277832..1fb1ef394 100644 --- a/legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/QueueDetails.java +++ b/legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/QueueDetails.java @@ -34,7 +34,7 @@ import java.util.logging.Logger; * currently in a queue. */ 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. @@ -178,7 +178,7 @@ public class QueueDetails implements PacketExtension { } else if( parser.getName().equals( "waitTime" ) ) { Date wait = dateFormat.parse(parser.nextText()); - log.fine(wait.toString()); + LOGGER.fine(wait.toString()); } eventType = parser.next(); diff --git a/legacy/src/main/java/org/jivesoftware/smackx/workgroup/util/ListenerEventDispatcher.java b/legacy/src/main/java/org/jivesoftware/smackx/workgroup/util/ListenerEventDispatcher.java index ff71bf124..40bea535d 100644 --- a/legacy/src/main/java/org/jivesoftware/smackx/workgroup/util/ListenerEventDispatcher.java +++ b/legacy/src/main/java/org/jivesoftware/smackx/workgroup/util/ListenerEventDispatcher.java @@ -35,7 +35,7 @@ import java.util.logging.Logger; * @author loki der quaeler */ 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 triplets; @@ -95,7 +95,7 @@ public class ListenerEventDispatcher implements Runnable { try { tc.getListenerMethod().invoke(tc.getListenerInstance(), tc.getMethodArguments()); } catch (Exception e) { - log.log(Level.SEVERE, "Exception dispatching an event", e); + LOGGER.log(Level.SEVERE, "Exception dispatching an event", e); } }