diff options
author | Vincent Lucas <chenzo@jitsi.org> | 2008-05-27 21:27:39 +0000 |
---|---|---|
committer | Vincent Lucas <chenzo@jitsi.org> | 2008-05-27 21:27:39 +0000 |
commit | a1c864fe2de669ce33aa5751e202ed7ec9339c5f (patch) | |
tree | 9d0a49ab8a1fc2281a1810227701985a51817bc1 /src/net/java/sip | |
parent | bfb8d8936b431d5665e314b77c0685029629b2e1 (diff) | |
download | jitsi-a1c864fe2de669ce33aa5751e202ed7ec9339c5f.zip jitsi-a1c864fe2de669ce33aa5751e202ed7ec9339c5f.tar.gz jitsi-a1c864fe2de669ce33aa5751e202ed7ec9339c5f.tar.bz2 |
Applied Cedric Litzelmann patch for diplaying a plaisant warning when a given dictionary is no more available on a server.
Diffstat (limited to 'src/net/java/sip')
-rw-r--r-- | src/net/java/sip/communicator/impl/protocol/dict/OperationSetBasicInstantMessagingDictImpl.java | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/src/net/java/sip/communicator/impl/protocol/dict/OperationSetBasicInstantMessagingDictImpl.java b/src/net/java/sip/communicator/impl/protocol/dict/OperationSetBasicInstantMessagingDictImpl.java index 4dc2848..908d965 100644 --- a/src/net/java/sip/communicator/impl/protocol/dict/OperationSetBasicInstantMessagingDictImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/dict/OperationSetBasicInstantMessagingDictImpl.java @@ -308,7 +308,7 @@ public class OperationSetBasicInstantMessagingDictImpl } else { // Otherwise we display the error returned by the server - msg = this.createMessage(dex.getErrorMessage()); + msg = this.createMessage(manageException(dex, database)); } } catch(Exception ex) @@ -328,7 +328,7 @@ public class OperationSetBasicInstantMessagingDictImpl } catch(DictException dex) { - msg = this.createMessage(dex.getErrorMessage()); + msg = this.createMessage(manageException(dex, database)); } catch(Exception ex) { @@ -418,4 +418,28 @@ public class OperationSetBasicInstantMessagingDictImpl return result; } + + /** + * Manages the return exception of a dict query. + * + * @param dix The exception returned by the adapter + * @param database The dictionary used + * @return Exception message + */ + private String manageException(DictException dix, String database) + { + int errorCode = dix.getErrorCode(); + + // We change the text only for exception 550 (invalid dictionary) and 551 (invalid strategy) + if (errorCode == 550) + { + return "The current dictionary '" + database + "' doesn't exist anymore on the server"; + } + else if (errorCode == 551) + { + return "The current strategy isn't available on the server"; + } + + return dix.getErrorMessage(); + } } |