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.
This commit is contained in:
Andreas Straub 2015-10-11 16:01:03 +02:00
parent da31582911
commit a7c7a42136

View File

@ -176,7 +176,7 @@ public final class Jid {
return resourcepart.isEmpty() ? this : fromParts(localpart, domainpart, ""); return resourcepart.isEmpty() ? this : fromParts(localpart, domainpart, "");
} catch (final InvalidJidException e) { } catch (final InvalidJidException e) {
// This should never happen. // 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()); return resourcepart.isEmpty() && localpart.isEmpty() ? this : fromString(getDomainpart());
} catch (final InvalidJidException e) { } catch (final InvalidJidException e) {
// This should never happen. // This should never happen.
return null; throw new AssertionError("Jid " + this.toString() + " invalid");
} }
} }