aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Straub <andy@strb.org>2015-10-11 16:01:03 +0200
committerAndreas Straub <andy@strb.org>2015-10-11 16:05:44 +0200
commita7c7a421365dc637e44a956c2be112118a752bc3 (patch)
treec50e269413f35b6c4d349fef0e17a5680896da32
parentda31582911db0f01df2b3427770da165c7c6b0b4 (diff)
Improve InvalidJidException handling in Jid class
This code should never be triggered anway, so with this 'fix', we should at least get more meaningful stack traces. Plus, it makes the linter happy by preventing NullPointerExceptions.
-rw-r--r--src/main/java/eu/siacs/conversations/xmpp/jid/Jid.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/main/java/eu/siacs/conversations/xmpp/jid/Jid.java b/src/main/java/eu/siacs/conversations/xmpp/jid/Jid.java
index f989c0c2..a15abe14 100644
--- a/src/main/java/eu/siacs/conversations/xmpp/jid/Jid.java
+++ b/src/main/java/eu/siacs/conversations/xmpp/jid/Jid.java
@@ -176,7 +176,7 @@ public final class Jid {
return resourcepart.isEmpty() ? this : fromParts(localpart, domainpart, "");
} catch (final InvalidJidException e) {
// This should never happen.
- return null;
+ throw new AssertionError("Jid " + this.toString() + " invalid");
}
}
@@ -185,7 +185,7 @@ public final class Jid {
return resourcepart.isEmpty() && localpart.isEmpty() ? this : fromString(getDomainpart());
} catch (final InvalidJidException e) {
// This should never happen.
- return null;
+ throw new AssertionError("Jid " + this.toString() + " invalid");
}
}