From 843778525afbe46619b0b15962cfc025c8ddc7a6 Mon Sep 17 00:00:00 2001 From: Lyubomir Marinov Date: Sat, 23 Aug 2008 22:10:29 +0000 Subject: [PATCH] Applies the patch contributed by Dai Zhiwei which fixes the throwing of NullPointerException with details on the parameter being the cause in the Gibberish and Icq ProtocolProviderFactory implementations. --- .../ProtocolProviderFactoryGibberishImpl.java | 16 ++++++++-------- .../icq/ProtocolProviderFactoryIcqImpl.java | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/net/java/sip/communicator/impl/protocol/gibberish/ProtocolProviderFactoryGibberishImpl.java b/src/net/java/sip/communicator/impl/protocol/gibberish/ProtocolProviderFactoryGibberishImpl.java index 0d9e68df4..d6c780649 100644 --- a/src/net/java/sip/communicator/impl/protocol/gibberish/ProtocolProviderFactoryGibberishImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/gibberish/ProtocolProviderFactoryGibberishImpl.java @@ -144,6 +144,14 @@ public AccountID installAccount( String userIDStr, public void modifyAccount( ProtocolProviderService protocolProvider, Map accountProperties) { + // Make sure the specified arguments are valid. + if (protocolProvider == null) + throw new NullPointerException( + "The specified Protocol Provider was null"); + if (accountProperties == null) + throw new NullPointerException( + "The specified property map was null"); + BundleContext context = GibberishActivator.getBundleContext(); @@ -151,10 +159,6 @@ public void modifyAccount( ProtocolProviderService protocolProvider, throw new NullPointerException( "The specified BundleContext was null"); - if (protocolProvider == null) - throw new NullPointerException( - "The specified Protocol Provider was null"); - GibberishAccountID accountID = (GibberishAccountID) protocolProvider.getAccountID(); @@ -172,10 +176,6 @@ public void modifyAccount( ProtocolProviderService protocolProvider, accountProperties.put(USER_ID, accountID.getUserID()); - if (accountProperties == null) - throw new NullPointerException( - "The specified property map was null"); - if (!accountProperties.containsKey(PROTOCOL)) accountProperties.put(PROTOCOL, ProtocolNames.GIBBERISH); diff --git a/src/net/java/sip/communicator/impl/protocol/icq/ProtocolProviderFactoryIcqImpl.java b/src/net/java/sip/communicator/impl/protocol/icq/ProtocolProviderFactoryIcqImpl.java index 632049766..8665b4cec 100644 --- a/src/net/java/sip/communicator/impl/protocol/icq/ProtocolProviderFactoryIcqImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/icq/ProtocolProviderFactoryIcqImpl.java @@ -313,6 +313,14 @@ public void modifyAccount( ProtocolProviderService protocolProvider, Map accountProperties) throws NullPointerException { + // Make sure the specified arguments are valid. + if (protocolProvider == null) + throw new NullPointerException( + "The specified Protocol Provider was null"); + if (accountProperties == null) + throw new NullPointerException( + "The specified property map was null"); + BundleContext context = IcqActivator.getBundleContext(); @@ -320,10 +328,6 @@ public void modifyAccount( ProtocolProviderService protocolProvider, throw new NullPointerException( "The specified BundleContext was null"); - if (protocolProvider == null) - throw new NullPointerException( - "The specified Protocol Provider was null"); - IcqAccountID accountID = (IcqAccountID) protocolProvider.getAccountID(); // If the given accountID doesn't correspond to an existing account @@ -340,10 +344,6 @@ public void modifyAccount( ProtocolProviderService protocolProvider, accountProperties.put(USER_ID, accountID.getUserID()); - if (accountProperties == null) - throw new NullPointerException( - "The specified property map was null"); - if (!accountProperties.containsKey(PROTOCOL)) accountProperties.put(PROTOCOL, ProtocolNames.ICQ);