Duplicate Entries in SmackConfiguration.defaultMechs

Smack 3.2.1

If the current thread’s context classloader is the same as the SmackConfiguration’s classloader, we get 2 entries for each mechName element in defaultMechs.

While addSaslMech() protects against duplicates, the static initializer does not.

Further, if 2 or more smack-config.xml files with the same mechName are found on the classpath, the problem is multiplied. Consider calling addSaslMech() from the initializer.

$ svn diff

Index: source/org/jivesoftware/smack/SmackConfiguration.java

===================================================================

— source/org/jivesoftware/smack/SmackConfiguration.java (revision 12950)

+++ source/org/jivesoftware/smack/SmackConfiguration.java (working copy)

@@ -92,7 +92,7 @@

                                 keepAliveInterval = parseIntProperty(parser, keepAliveInterval);

                             }

                             else if (parser.getName().equals("mechName")) {
  •                                defaultMechs.add(parser.nextText());
    
  •                                addSaslMech(parser.nextText());
    
                               }
    
                               else if (parser.getName().equals("localSocks5ProxyEnabled")) {
    
                                   localSocks5ProxyEnabled = Boolean.parseBoolean(parser.nextText());