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