summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCalin Juravle <calin@google.com>2014-04-24 10:46:04 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-04-24 10:46:04 +0000
commita6735a1f3cbe90f6f6555b4ebf10573a760bdb32 (patch)
treec8941ba46ee8848861203185204f2b4eebf0f533
parent9064b9e19187fc52329c4342051f925c9d3a674a (diff)
parent232c91dce1760b180155256d1896d0d80375ff6d (diff)
downloadlibcore-a6735a1f3cbe90f6f6555b4ebf10573a760bdb32.zip
libcore-a6735a1f3cbe90f6f6555b4ebf10573a760bdb32.tar.gz
libcore-a6735a1f3cbe90f6f6555b4ebf10573a760bdb32.tar.bz2
Merge "Disallow explicit signs in SocketHandler port parsing."
-rw-r--r--luni/src/main/java/java/util/logging/SocketHandler.java7
1 files changed, 2 insertions, 5 deletions
diff --git a/luni/src/main/java/java/util/logging/SocketHandler.java b/luni/src/main/java/java/util/logging/SocketHandler.java
index 85a9e6c..48bfc0e 100644
--- a/luni/src/main/java/java/util/logging/SocketHandler.java
+++ b/luni/src/main/java/java/util/logging/SocketHandler.java
@@ -108,12 +108,9 @@ public class SocketHandler extends StreamHandler {
// check the validity of the port number
int p = 0;
try {
- p = Integer.parseInt(port);
+ p = Integer.parsePositiveInt(port);
} catch (NumberFormatException e) {
- throw new IllegalArgumentException("Illegal port argument");
- }
- if (p <= 0) {
- throw new IllegalArgumentException("Illegal port argument");
+ throw new IllegalArgumentException("Illegal port argument " + port);
}
// establish the network connection
try {