mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-08-29 13:17:43 +00:00
Don't catch and rethrow
This commit is contained in:
parent
93251ee7a6
commit
b97ad28456
@ -57,22 +57,14 @@ public class LanLinkProviderTest extends AndroidTestCase {
|
||||
Mockito.when(networkPacket.serialize()).thenReturn(serialized);
|
||||
|
||||
Socket channel = Mockito.mock(Socket.class);
|
||||
try {
|
||||
Method method = LanLinkProvider.class.getDeclaredMethod("identityPacketReceived", NetworkPacket.class, Socket.class, LanLink.ConnectionStarted.class);
|
||||
method.setAccessible(true);
|
||||
method.invoke(linkProvider, networkPacket, channel, LanLink.ConnectionStarted.Locally);
|
||||
} catch (Exception e) {
|
||||
throw e;
|
||||
}
|
||||
Method method = LanLinkProvider.class.getDeclaredMethod("identityPacketReceived", NetworkPacket.class, Socket.class, LanLink.ConnectionStarted.class);
|
||||
method.setAccessible(true);
|
||||
method.invoke(linkProvider, networkPacket, channel, LanLink.ConnectionStarted.Locally);
|
||||
|
||||
HashMap<String, LanLink> visibleComputers;
|
||||
try {
|
||||
Field field = LanLinkProvider.class.getDeclaredField("visibleComputers");
|
||||
field.setAccessible(true);
|
||||
visibleComputers = (HashMap<String, LanLink>) field.get(linkProvider);
|
||||
} catch (Exception e) {
|
||||
throw e;
|
||||
}
|
||||
Field field = LanLinkProvider.class.getDeclaredField("visibleComputers");
|
||||
field.setAccessible(true);
|
||||
visibleComputers = (HashMap<String, LanLink>) field.get(linkProvider);
|
||||
assertNotNull(visibleComputers.get("testDevice"));
|
||||
|
||||
}
|
||||
|
@ -130,11 +130,7 @@ public class LanLinkTest extends AndroidTestCase {
|
||||
socket.connect(new InetSocketAddress(address.getAddress(), tcpPort));
|
||||
np.setPayload(socket.getInputStream(), np.getPayloadSize());
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
socket.close();
|
||||
} catch (Exception ignored) {
|
||||
throw ignored;
|
||||
}
|
||||
socket.close();
|
||||
e.printStackTrace();
|
||||
Log.e("KDE/LanLinkTest", "Exception connecting to remote socket");
|
||||
throw e;
|
||||
|
Loading…
x
Reference in New Issue
Block a user