Skip to content

Commit

Permalink
main: Update some deprecated Java API.
Browse files Browse the repository at this point in the history
We still have some implementations and calls to `Object.finalize()` but changing that is breaking so it should wait until 4.0.
  • Loading branch information
seanbright committed Aug 26, 2024
1 parent 159fb66 commit 3bb53a8
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/main/java/org/asteriskjava/Cli.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ else if ("-a".equals(arg) || "-agi".equals(arg))
Integer port = null;
try
{
port = new Integer(args[1]);
port = Integer.parseInt(args[1], 10);
}
catch (NumberFormatException e)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public Integer getMeetmeBaseAddress() {
// doesn't overlap any conference rooms you are currently running on your pbx.
// You should probably allow 200 conference rooms here e.g. (3000-3200)
// Actions like transfers (and conference calls) use a conference room.
return new Integer(3000);
return 3000;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void testBuildRequest() {
assertEquals("9876", request.getRdnis(), "incorrect rdnis");
assertEquals("local", request.getContext(), "incorrect context");
assertEquals("8870", request.getExtension(), "incorrect extension");
assertEquals(new Integer(1), request.getPriority(), "incorrect priority");
assertEquals(Integer.valueOf(1), request.getPriority(), "incorrect priority");
assertEquals(Boolean.FALSE, request.getEnhanced(), "incorrect enhanced");
assertNull(request.getAccountCode(), "incorrect accountCode must not be set");
assertEquals(AsteriskVersion.ASTERISK_13, request.getAsteriskVersion(), "incorret Asterisk Version Number");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ void setUp() {
@Test
void testWithState() {
newStateEvent.setState("Ring");
assertEquals(new Integer(4), newStateEvent.getChannelState());
assertEquals(Integer.valueOf(4), newStateEvent.getChannelState());
assertEquals("Ring", newStateEvent.getChannelStateDesc());
}

@Test
void testWithUnknownState() {
newStateEvent.setState("Unknown (4)");
assertEquals(new Integer(4), newStateEvent.getChannelState());
assertEquals(Integer.valueOf(4), newStateEvent.getChannelState());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ void setUp() {
void testFrom() {
rtcpReceivedEvent.setFrom("192.168.0.1:1234");
assertEquals(rtcpReceivedEvent.getFromAddress().getHostAddress(), "192.168.0.1");
assertEquals(new Integer(1234), rtcpReceivedEvent.getFromPort());
assertEquals(Integer.valueOf(1234), rtcpReceivedEvent.getFromPort());
}

@Test
void testPt() {
rtcpReceivedEvent.setPt("200(Sender Report)");
assertEquals(new Long(200), rtcpReceivedEvent.getPt());
assertEquals(new Long(RtcpReceivedEvent.PT_SENDER_REPORT), rtcpReceivedEvent.getPt());
assertEquals(Long.valueOf(200), rtcpReceivedEvent.getPt());
assertEquals(Long.valueOf(RtcpReceivedEvent.PT_SENDER_REPORT), rtcpReceivedEvent.getPt());
}

@Test
Expand All @@ -42,6 +42,6 @@ void testDlSrWithSpace() {
@Test
void testRtt() {
rtcpReceivedEvent.setRtt("12345(sec)");
assertEquals(new Double(12345), rtcpReceivedEvent.getRtt());
assertEquals(Double.valueOf(12345), rtcpReceivedEvent.getRtt());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ void testBuildEventWithLong() {
event = eventBuilder.buildEvent(this, properties);

assertNotNull(event);
assertEquals(new Long(569108), ((MeetMeLeaveEvent) event).getDuration(), "Duration property not set correctly");
assertEquals(Long.valueOf(569108), ((MeetMeLeaveEvent) event).getDuration(), "Duration property not set correctly");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ void testWorkaroundForAsteriskBug13319() throws Exception {

RtcpReceivedEvent rtcpReceivedEvent = (RtcpReceivedEvent) dispatcher.dispatchedEvents.get(0);
assertEquals("192.168.0.1", rtcpReceivedEvent.getFromAddress().getHostAddress(), "Invalid from address on RtcpReceivedEvent");
assertEquals(new Integer(1234), rtcpReceivedEvent.getFromPort(), "Invalid from port on RtcpReceivedEvent");
assertEquals(new Long(999), rtcpReceivedEvent.getHighestSequence(), "Invalid highest sequence on RtcpReceivedEvent");
assertEquals(Integer.valueOf(1234), rtcpReceivedEvent.getFromPort(), "Invalid from port on RtcpReceivedEvent");
assertEquals(Long.valueOf(999), rtcpReceivedEvent.getHighestSequence(), "Invalid highest sequence on RtcpReceivedEvent");

assertEquals(DisconnectEvent.class, dispatcher.dispatchedEvents.get(1).getClass(), "second event must be a DisconnectEvent");
}
Expand Down

0 comments on commit 3bb53a8

Please sign in to comment.