mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 11:19:04 +01:00
Use Integer.parseInt(String) to get a primitive int.
This commit is contained in:
@@ -84,7 +84,7 @@ implements OnEditorActionListener, OnClickListener {
|
||||
String remoteCodeString = codeEntry.getText().toString();
|
||||
int remoteCode;
|
||||
try {
|
||||
remoteCode = Integer.valueOf(remoteCodeString);
|
||||
remoteCode = Integer.parseInt(remoteCodeString);
|
||||
} catch(NumberFormatException e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ class LanTcpPlugin extends TcpPlugin {
|
||||
!StringUtils.isNullOrEmpty(portString)) {
|
||||
try {
|
||||
addr = InetAddress.getByName(addrString);
|
||||
int port = Integer.valueOf(portString);
|
||||
int port = Integer.parseInt(portString);
|
||||
addrs.add(new InetSocketAddress(addr, port));
|
||||
addrs.add(new InetSocketAddress(addr, 0));
|
||||
} catch(NumberFormatException e) {
|
||||
|
||||
@@ -191,7 +191,7 @@ abstract class TcpPlugin implements DuplexPlugin {
|
||||
if(StringUtils.isNullOrEmpty(portString)) return null;
|
||||
try {
|
||||
InetAddress addr = InetAddress.getByName(addrString);
|
||||
int port = Integer.valueOf(portString);
|
||||
int port = Integer.parseInt(portString);
|
||||
return new InetSocketAddress(addr, port);
|
||||
} catch(NumberFormatException e) {
|
||||
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
|
||||
|
||||
@@ -64,7 +64,7 @@ class WanTcpPlugin extends TcpPlugin {
|
||||
!StringUtils.isNullOrEmpty(portString)) {
|
||||
try {
|
||||
addr = InetAddress.getByName(addrString);
|
||||
port = Integer.valueOf(portString);
|
||||
port = Integer.parseInt(portString);
|
||||
addrs.add(new InetSocketAddress(addr, port));
|
||||
addrs.add(new InetSocketAddress(addr, 0));
|
||||
} catch(NumberFormatException e) {
|
||||
|
||||
@@ -45,7 +45,7 @@ public class LanTcpPluginTest extends BriarTestCase {
|
||||
assertEquals("127.0.0.1", host);
|
||||
String portString = callback.local.get("port");
|
||||
assertNotNull(portString);
|
||||
int port = Integer.valueOf(portString);
|
||||
int port = Integer.parseInt(portString);
|
||||
assertTrue(port > 0 && port < 65536);
|
||||
// The plugin should be listening on the port
|
||||
InetSocketAddress addr = new InetSocketAddress(host, port);
|
||||
|
||||
Reference in New Issue
Block a user