diff --git a/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderFactorySipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderFactorySipImpl.java index 2c464562f..31e66b51f 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderFactorySipImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderFactorySipImpl.java @@ -112,6 +112,12 @@ public AccountID installAccount( String userIDStr, AccountID accountID = new SipAccountID(userIDStr, accountProperties, serverAddress); + //make sure we haven't seen this account id before. + if( registeredAccounts.containsKey(accountID) ) + throw new IllegalStateException( + "An account for id " + userIDStr + " was already installed!"); + + //first store the account and only then load it as the load generates //an osgi event, the osgi event triggers (trhgough the UI) a call to //the register() method and it needs to acces the configuration service @@ -160,11 +166,6 @@ protected AccountID loadAccount(String userIDStr, Map accountProperties) AccountID accountID = new SipAccountID(userIDStr, accountProperties, serverAddress); - //make sure we haven't seen this account id before. - if( registeredAccounts.containsKey(accountID) ) - throw new IllegalStateException( - "An account for id " + userIDStr + " was already installed!"); - //get a reference to the configuration service and register whatever //properties we have in it.