mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-12-23 21:17:58 +01:00
Fixed potential error when #getClassLoader returns null. SMACK-162
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@4774 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
47cc26e234
commit
8879234bbc
2 changed files with 19 additions and 3 deletions
|
@ -25,7 +25,9 @@ import org.xmlpull.v1.XmlPullParser;
|
|||
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Represents the configuration of Smack. The configuration is used for:
|
||||
|
@ -129,7 +131,7 @@ public final class SmackConfiguration {
|
|||
public static int getPacketReplyTimeout() {
|
||||
// The timeout value must be greater than 0 otherwise we will answer the default value
|
||||
if (packetReplyTimeout <= 0) {
|
||||
packetReplyTimeout = 5000;
|
||||
packetReplyTimeout = 5000;
|
||||
}
|
||||
return packetReplyTimeout;
|
||||
}
|
||||
|
@ -204,6 +206,13 @@ public final class SmackConfiguration {
|
|||
ClassLoader[] classLoaders = new ClassLoader[2];
|
||||
classLoaders[0] = SmackConfiguration.class.getClassLoader();
|
||||
classLoaders[1] = Thread.currentThread().getContextClassLoader();
|
||||
return classLoaders;
|
||||
// Clean up possible null values. Note that #getClassLoader may return a null value.
|
||||
List<ClassLoader> loaders = new ArrayList<ClassLoader>();
|
||||
for (ClassLoader classLoader : classLoaders) {
|
||||
if (classLoader != null) {
|
||||
loaders.add(classLoader);
|
||||
}
|
||||
}
|
||||
return (ClassLoader[]) loaders.toArray();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -384,7 +384,14 @@ public class ProviderManager {
|
|||
ClassLoader[] classLoaders = new ClassLoader[2];
|
||||
classLoaders[0] = ProviderManager.class.getClassLoader();
|
||||
classLoaders[1] = Thread.currentThread().getContextClassLoader();
|
||||
return classLoaders;
|
||||
// Clean up possible null values. Note that #getClassLoader may return a null value.
|
||||
List<ClassLoader> loaders = new ArrayList<ClassLoader>();
|
||||
for (ClassLoader classLoader : classLoaders) {
|
||||
if (classLoader != null) {
|
||||
loaders.add(classLoader);
|
||||
}
|
||||
}
|
||||
return (ClassLoader[]) loaders.toArray();
|
||||
}
|
||||
|
||||
private ProviderManager() {
|
||||
|
|
Loading…
Reference in a new issue