Skip to content

Commit aad6654

Browse files
authored
Merge pull request TooTallNate#1259 from TooTallNate/replace-deprecated-integer-constructor
Replace usages of deprecated constructor Integer(String) with Integer.parseInt
2 parents bdf928b + 5d4d527 commit aad6654

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

src/main/java/org/java_websocket/drafts/Draft.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ int readVersion(Handshakedata handshakedata) {
331331
if (vers.length() > 0) {
332332
int v;
333333
try {
334-
v = new Integer(vers.trim());
334+
v = Integer.parseInt(vers.trim());
335335
return v;
336336
} catch (NumberFormatException e) {
337337
return -1;

src/test/java/org/java_websocket/example/AutobahnClientTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ public static void main(String[] args) {
9191
String[] spl = line.split(" ");
9292
if (line.startsWith("r")) {
9393
if (spl.length == 3) {
94-
start = new Integer(spl[1]);
95-
end = new Integer(spl[2]);
94+
start = Integer.parseInt(spl[1]);
95+
end = Integer.parseInt(spl[2]);
9696
}
9797
if (start != null && end != null) {
9898
if (start > end) {

src/test/java/org/java_websocket/example/AutobahnSSLServerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public void onMessage(WebSocket conn, ByteBuffer blob) {
9090
public static void main(String[] args) throws UnknownHostException {
9191
int port;
9292
try {
93-
port = new Integer(args[0]);
93+
port = Integer.parseInt(args[0]);
9494
} catch (Exception e) {
9595
System.out.println("No port specified. Defaulting to 9003");
9696
port = 9003;

src/test/java/org/java_websocket/example/AutobahnServerTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,13 @@ public void onMessage(WebSocket conn, ByteBuffer blob) {
9090
public static void main(String[] args) throws UnknownHostException {
9191
int port, limit;
9292
try {
93-
port = new Integer(args[0]);
93+
port = Integer.parseInt(args[0]);
9494
} catch (Exception e) {
9595
System.out.println("No port specified. Defaulting to 9003");
9696
port = 9003;
9797
}
9898
try {
99-
limit = new Integer(args[1]);
99+
limit = Integer.parseInt(args[1]);
100100
} catch (Exception e) {
101101
System.out.println("No limit specified. Defaulting to MaxInteger");
102102
limit = Integer.MAX_VALUE;

0 commit comments

Comments
 (0)