Check for illegal arguments to the toASCII func
This commit is contained in:
parent
7cfcf10f48
commit
53c7905631
|
@ -157,7 +157,13 @@ public class XmppConnection implements Runnable {
|
||||||
while (socketError && values.size() > i) {
|
while (socketError && values.size() > i) {
|
||||||
Bundle namePort = (Bundle) values.get(i);
|
Bundle namePort = (Bundle) values.get(i);
|
||||||
try {
|
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");
|
int srvRecordPort = namePort.getInt("port");
|
||||||
String srvIpServer = namePort.getString("ipv4");
|
String srvIpServer = namePort.getString("ipv4");
|
||||||
InetSocketAddress addr;
|
InetSocketAddress addr;
|
||||||
|
|
|
@ -108,9 +108,17 @@ public final class Jid {
|
||||||
|
|
||||||
// Remove trailling "." before storing the domain part.
|
// Remove trailling "." before storing the domain part.
|
||||||
if (dp.endsWith(".")) {
|
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 {
|
} 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.
|
// TODO: Find a proper domain validation library; validate individual parts, separators, etc.
|
||||||
|
|
Loading…
Reference in New Issue