aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations
diff options
context:
space:
mode:
authorSam Whited <sam@samwhited.com>2014-11-09 09:05:02 -0500
committerSam Whited <sam@samwhited.com>2014-11-09 09:05:02 -0500
commit53c7905631a9cee618157d15b06775c5d633f7a5 (patch)
tree35cd4d707025252b36f5adcbc6af61545e4f03ec /src/main/java/eu/siacs/conversations
parent7cfcf10f487a6b97231508963807039443da16f2 (diff)
Check for illegal arguments to the toASCII func
Diffstat (limited to 'src/main/java/eu/siacs/conversations')
-rw-r--r--src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java8
-rw-r--r--src/main/java/eu/siacs/conversations/xmpp/jid/Jid.java12
2 files changed, 17 insertions, 3 deletions
diff --git a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java
index 534a6667..2b0f0ecc 100644
--- a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java
+++ b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java
@@ -157,7 +157,13 @@ public class XmppConnection implements Runnable {
while (socketError && values.size() > i) {
Bundle namePort = (Bundle) values.get(i);
try {
- String srvRecordServer = IDN.toASCII(namePort.getString("name"));
+ String srvRecordServer;
+ try {
+ srvRecordServer=IDN.toASCII(namePort.getString("name"));
+ } catch (final IllegalArgumentException e) {
+ // TODO: Handle me?`
+ srvRecordServer = "";
+ }
int srvRecordPort = namePort.getInt("port");
String srvIpServer = namePort.getString("ipv4");
InetSocketAddress addr;
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 a53c8096..8e9e0400 100644
--- a/src/main/java/eu/siacs/conversations/xmpp/jid/Jid.java
+++ b/src/main/java/eu/siacs/conversations/xmpp/jid/Jid.java
@@ -108,9 +108,17 @@ public final class Jid {
// Remove trailling "." before storing the domain part.
if (dp.endsWith(".")) {
- domainpart = IDN.toASCII(dp.substring(0, dp.length() - 1), IDN.USE_STD3_ASCII_RULES);
+ try {
+ domainpart = IDN.toASCII(dp.substring(0, dp.length() - 1), IDN.USE_STD3_ASCII_RULES);
+ } catch (final IllegalArgumentException e) {
+ throw new InvalidJidException(e);
+ }
} else {
- domainpart = IDN.toASCII(dp, IDN.USE_STD3_ASCII_RULES);
+ try {
+ domainpart = IDN.toASCII(dp, IDN.USE_STD3_ASCII_RULES);
+ } catch (final IllegalArgumentException e) {
+ throw new InvalidJidException(e);
+ }
}
// TODO: Find a proper domain validation library; validate individual parts, separators, etc.