diff options
author | Damian Minkov <damencho@jitsi.org> | 2015-04-28 15:45:23 +0300 |
---|---|---|
committer | Damian Minkov <damencho@jitsi.org> | 2015-04-28 15:45:23 +0300 |
commit | fc5c9d6d0b938f6962be6b6ba3be8cd9153f53ba (patch) | |
tree | ecc61524d106ec7c691bd9ac1e37077842039a9a /src/net/java/sip/communicator/impl | |
parent | 8f11719b14053c9161c9ada88509f9b8ccd9fa44 (diff) | |
download | jitsi-fc5c9d6d0b938f6962be6b6ba3be8cd9153f53ba.zip jitsi-fc5c9d6d0b938f6962be6b6ba3be8cd9153f53ba.tar.gz jitsi-fc5c9d6d0b938f6962be6b6ba3be8cd9153f53ba.tar.bz2 |
Fixes tests, unloading/loading bundle ProviderManagerExt class is loaded two times.
Diffstat (limited to 'src/net/java/sip/communicator/impl')
-rw-r--r-- | src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderFactoryJabberImpl.java | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderFactoryJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderFactoryJabberImpl.java index 8d0a34f..2d4f002 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderFactoryJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderFactoryJabberImpl.java @@ -33,11 +33,26 @@ public class ProtocolProviderFactoryJabberImpl static { - ProviderManager.setInstance(new ProviderManagerExt()); - - providerManager = ProviderManager.getInstance(); + try + { + ProviderManager.setInstance(new ProviderManagerExt()); + } + catch(Throwable t) + { + // once loaded if we try to set instance second time + // IllegalStateException is thrown + } + finally + { + providerManager = ProviderManager.getInstance(); + } - if (!(providerManager instanceof ProviderManagerExt)) + // checks class names, not using instanceof + // tests do unloading and loading the protocol bundle and + // ProviderManagerExt class get loaded two times from different + // classloaders + if (!(providerManager.getClass().getName() + .equals(ProviderManagerExt.class.getName()))) { throw new RuntimeException( "ProviderManager set to the default one"); |