Commit f1194e88 authored by Nicolas Fella's avatar Nicolas Fella

Use Log.e instead of printStackTrace

parent 386a9f3f
...@@ -149,7 +149,7 @@ public class BluetoothLinkProvider extends BaseLinkProvider { ...@@ -149,7 +149,7 @@ public class BluetoothLinkProvider extends BaseLinkProvider {
try { try {
serverSocket.close(); serverSocket.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); Log.e("KDEConnect", "Exception", e);
} }
} }
} }
...@@ -160,7 +160,7 @@ public class BluetoothLinkProvider extends BaseLinkProvider { ...@@ -160,7 +160,7 @@ public class BluetoothLinkProvider extends BaseLinkProvider {
serverSocket = bluetoothAdapter serverSocket = bluetoothAdapter
.listenUsingRfcommWithServiceRecord("KDE Connect", SERVICE_UUID); .listenUsingRfcommWithServiceRecord("KDE Connect", SERVICE_UUID);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); Log.e("KDEConnect", "Exception", e);
return; return;
} }
......
...@@ -71,7 +71,7 @@ public class LanLink extends BaseLink { ...@@ -71,7 +71,7 @@ public class LanLink extends BaseLink {
try { try {
socket.close(); socket.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); Log.e("LanLink", "Error", e);
} }
} }
...@@ -257,8 +257,7 @@ public class LanLink extends BaseLink { ...@@ -257,8 +257,7 @@ public class LanLink extends BaseLink {
try { try {
np = RsaHelper.decrypt(np, privateKey); np = RsaHelper.decrypt(np, privateKey);
} catch(Exception e) { } catch(Exception e) {
e.printStackTrace(); Log.e("KDE/onPacketReceived","Exception decrypting the package", e);
Log.e("KDE/onPacketReceived","Exception decrypting the package");
} }
} }
...@@ -275,8 +274,7 @@ public class LanLink extends BaseLink { ...@@ -275,8 +274,7 @@ public class LanLink extends BaseLink {
np.setPayload(new NetworkPacket.Payload(payloadSocket, np.getPayloadSize())); np.setPayload(new NetworkPacket.Payload(payloadSocket, np.getPayloadSize()));
} catch (Exception e) { } catch (Exception e) {
try { payloadSocket.close(); } catch(Exception ignored) { } try { payloadSocket.close(); } catch(Exception ignored) { }
e.printStackTrace(); Log.e("KDE/LanLink", "Exception connecting to payload remote socket", e);
Log.e("KDE/LanLink", "Exception connecting to payload remote socket");
} }
} }
......
...@@ -102,7 +102,7 @@ public class LanLinkProvider extends BaseLinkProvider implements LanLink.LinkDis ...@@ -102,7 +102,7 @@ public class LanLinkProvider extends BaseLinkProvider implements LanLink.LinkDis
networkPacket = NetworkPacket.unserialize(message); networkPacket = NetworkPacket.unserialize(message);
//Log.e("TcpListener","Received TCP package: "+networkPacket.serialize()); //Log.e("TcpListener","Received TCP package: "+networkPacket.serialize());
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); Log.e("KDE/LanLinkProvider", "Exception while receiving TCP packet", e);
return; return;
} }
...@@ -157,8 +157,7 @@ public class LanLinkProvider extends BaseLinkProvider implements LanLink.LinkDis ...@@ -157,8 +157,7 @@ public class LanLinkProvider extends BaseLinkProvider implements LanLink.LinkDis
identityPacketReceived(identityPacket, socket, LanLink.ConnectionStarted.Remotely); identityPacketReceived(identityPacket, socket, LanLink.ConnectionStarted.Remotely);
} catch (Exception e) { } catch (Exception e) {
Log.e("KDE/LanLinkProvider", "Cannot connect to " + address); Log.e("KDE/LanLinkProvider", "Cannot connect to " + address, e);
e.printStackTrace();
if (!reverseConnectionBlackList.contains(address)) { if (!reverseConnectionBlackList.contains(address)) {
Log.w("KDE/LanLinkProvider", "Blacklisting " + address); Log.w("KDE/LanLinkProvider", "Blacklisting " + address);
reverseConnectionBlackList.add(address); reverseConnectionBlackList.add(address);
...@@ -179,7 +178,7 @@ public class LanLinkProvider extends BaseLinkProvider implements LanLink.LinkDis ...@@ -179,7 +178,7 @@ public class LanLinkProvider extends BaseLinkProvider implements LanLink.LinkDis
try { try {
socket.setKeepAlive(true); socket.setKeepAlive(true);
} catch (SocketException e) { } catch (SocketException e) {
e.printStackTrace(); Log.e("LanLink", "Exception", e);
} }
} }
...@@ -236,8 +235,7 @@ public class LanLinkProvider extends BaseLinkProvider implements LanLink.LinkDis ...@@ -236,8 +235,7 @@ public class LanLinkProvider extends BaseLinkProvider implements LanLink.LinkDis
Log.i("KDE/LanLinkProvider", "Handshake as " + mode + " successful with " + identityPacket.getString("deviceName") + " secured with " + event.getCipherSuite()); Log.i("KDE/LanLinkProvider", "Handshake as " + mode + " successful with " + identityPacket.getString("deviceName") + " secured with " + event.getCipherSuite());
addLink(identityPacket, sslsocket, connectionStarted); addLink(identityPacket, sslsocket, connectionStarted);
} catch (Exception e) { } catch (Exception e) {
Log.e("KDE/LanLinkProvider", "Handshake as " + mode + " failed with " + identityPacket.getString("deviceName")); Log.e("KDE/LanLinkProvider", "Handshake as " + mode + " failed with " + identityPacket.getString("deviceName"), e);
e.printStackTrace();
BackgroundService.RunCommand(context, service -> { BackgroundService.RunCommand(context, service -> {
Device device = service.getDevice(deviceId); Device device = service.getDevice(deviceId);
if (device == null) return; if (device == null) return;
...@@ -252,8 +250,7 @@ public class LanLinkProvider extends BaseLinkProvider implements LanLink.LinkDis ...@@ -252,8 +250,7 @@ public class LanLinkProvider extends BaseLinkProvider implements LanLink.LinkDis
sslsocket.startHandshake(); sslsocket.startHandshake();
} }
} catch (Exception e) { } catch (Exception e) {
Log.e("KDE/LanLinkProvider", "Handshake failed with " + identityPacket.getString("deviceName")); Log.e("KDE/LanLinkProvider", "Handshake failed with " + identityPacket.getString("deviceName"), e);
e.printStackTrace();
//String[] ciphers = sslsocket.getSupportedCipherSuites(); //String[] ciphers = sslsocket.getSupportedCipherSuites();
//for (String cipher : ciphers) { //for (String cipher : ciphers) {
...@@ -265,7 +262,7 @@ public class LanLinkProvider extends BaseLinkProvider implements LanLink.LinkDis ...@@ -265,7 +262,7 @@ public class LanLinkProvider extends BaseLinkProvider implements LanLink.LinkDis
addLink(identityPacket, socket, connectionStarted); addLink(identityPacket, socket, connectionStarted);
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); Log.e("LanLink", "Exception", e);
} }
} }
...@@ -311,8 +308,7 @@ public class LanLinkProvider extends BaseLinkProvider implements LanLink.LinkDis ...@@ -311,8 +308,7 @@ public class LanLinkProvider extends BaseLinkProvider implements LanLink.LinkDis
udpServer.setReuseAddress(true); udpServer.setReuseAddress(true);
udpServer.setBroadcast(true); udpServer.setBroadcast(true);
} catch (SocketException e) { } catch (SocketException e) {
Log.e("LanLinkProvider", "Error creating udp server"); Log.e("LanLinkProvider", "Error creating udp server", e);
e.printStackTrace();
return; return;
} }
new Thread(() -> { new Thread(() -> {
...@@ -324,8 +320,7 @@ public class LanLinkProvider extends BaseLinkProvider implements LanLink.LinkDis ...@@ -324,8 +320,7 @@ public class LanLinkProvider extends BaseLinkProvider implements LanLink.LinkDis
udpServer.receive(packet); udpServer.receive(packet);
udpPacketReceived(packet); udpPacketReceived(packet);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); Log.e("LanLinkProvider", "UdpReceive exception", e);
Log.e("LanLinkProvider", "UdpReceive exception");
} }
} }
Log.w("UdpListener", "Stopping UDP listener"); Log.w("UdpListener", "Stopping UDP listener");
...@@ -336,8 +331,7 @@ public class LanLinkProvider extends BaseLinkProvider implements LanLink.LinkDis ...@@ -336,8 +331,7 @@ public class LanLinkProvider extends BaseLinkProvider implements LanLink.LinkDis
try { try {
tcpServer = openServerSocketOnFreePort(MIN_PORT); tcpServer = openServerSocketOnFreePort(MIN_PORT);
} catch (Exception e) { } catch (Exception e) {
Log.e("LanLinkProvider", "Error creating tcp server"); Log.e("LanLinkProvider", "Error creating tcp server", e);
e.printStackTrace();
return; return;
} }
new Thread(() -> { new Thread(() -> {
...@@ -347,8 +341,7 @@ public class LanLinkProvider extends BaseLinkProvider implements LanLink.LinkDis ...@@ -347,8 +341,7 @@ public class LanLinkProvider extends BaseLinkProvider implements LanLink.LinkDis
configureSocket(socket); configureSocket(socket);
tcpPacketReceived(socket); tcpPacketReceived(socket);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); Log.e("LanLinkProvider", "TcpReceive exception", e);
Log.e("LanLinkProvider", "TcpReceive exception");
} }
} }
Log.w("TcpListener", "Stopping TCP listener"); Log.w("TcpListener", "Stopping TCP listener");
...@@ -398,8 +391,7 @@ public class LanLinkProvider extends BaseLinkProvider implements LanLink.LinkDis ...@@ -398,8 +391,7 @@ public class LanLinkProvider extends BaseLinkProvider implements LanLink.LinkDis
socket.setBroadcast(true); socket.setBroadcast(true);
bytes = identity.serialize().getBytes(StringsHelper.UTF8); bytes = identity.serialize().getBytes(StringsHelper.UTF8);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); Log.e("KDE/LanLinkProvider", "Failed to create DatagramSocket", e);
Log.e("KDE/LanLinkProvider", "Failed to create DatagramSocket");
} }
if (bytes != null) { if (bytes != null) {
...@@ -410,8 +402,7 @@ public class LanLinkProvider extends BaseLinkProvider implements LanLink.LinkDis ...@@ -410,8 +402,7 @@ public class LanLinkProvider extends BaseLinkProvider implements LanLink.LinkDis
socket.send(new DatagramPacket(bytes, bytes.length, client, MIN_PORT)); socket.send(new DatagramPacket(bytes, bytes.length, client, MIN_PORT));
//Log.i("KDE/LanLinkProvider","Udp identity package sent to address "+client); //Log.i("KDE/LanLinkProvider","Udp identity package sent to address "+client);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); Log.e("KDE/LanLinkProvider", "Sending udp identity package failed. Invalid address? (" + ipstr + ")", e);
Log.e("KDE/LanLinkProvider", "Sending udp identity package failed. Invalid address? (" + ipstr + ")");
} }
} }
} }
...@@ -449,12 +440,12 @@ public class LanLinkProvider extends BaseLinkProvider implements LanLink.LinkDis ...@@ -449,12 +440,12 @@ public class LanLinkProvider extends BaseLinkProvider implements LanLink.LinkDis
try { try {
tcpServer.close(); tcpServer.close();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); Log.e("LanLink", "Exception", e);
} }
try { try {
udpServer.close(); udpServer.close();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); Log.e("LanLink", "Exception", e);
} }
} }
......
...@@ -158,11 +158,7 @@ public class LanPairingHandler extends BasePairingHandler { ...@@ -158,11 +158,7 @@ public class LanPairingHandler extends BasePairingHandler {
@Override @Override
public void onFailure(Throwable e) { public void onFailure(Throwable e) {
if (e != null) { Log.e("LanPairing/onFailure", "Exception", e);
e.printStackTrace();
} else {
Log.e("LanPairing/onFailure", "Unknown (null) exception");
}
mCallback.pairingFailed(mDevice.getContext().getString(R.string.error_could_not_send_package)); mCallback.pairingFailed(mDevice.getContext().getString(R.string.error_could_not_send_package));
} }
}; };
...@@ -187,11 +183,7 @@ public class LanPairingHandler extends BasePairingHandler { ...@@ -187,11 +183,7 @@ public class LanPairingHandler extends BasePairingHandler {
@Override @Override
public void onFailure(Throwable e) { public void onFailure(Throwable e) {
if (e != null) { Log.e("LanPairing/onFailure", "Exception", e);
e.printStackTrace();
} else {
Log.e("LanPairing/onFailure", "Unknown (null) exception");
}
mCallback.pairingFailed(mDevice.getContext().getString(R.string.error_not_reachable)); mCallback.pairingFailed(mDevice.getContext().getString(R.string.error_not_reachable));
} }
}; };
...@@ -217,7 +209,7 @@ public class LanPairingHandler extends BasePairingHandler { ...@@ -217,7 +209,7 @@ public class LanPairingHandler extends BasePairingHandler {
String encodedPublicKey = Base64.encodeToString(mDevice.publicKey.getEncoded(), 0); String encodedPublicKey = Base64.encodeToString(mDevice.publicKey.getEncoded(), 0);
editor.putString("publicKey", encodedPublicKey); editor.putString("publicKey", encodedPublicKey);
} catch (Exception e) { } catch (Exception e) {
Log.e("KDE/PairingDone", "Error encoding public key"); Log.e("KDE/PairingDone", "Error encoding public key", e);
} }
} }
...@@ -225,12 +217,11 @@ public class LanPairingHandler extends BasePairingHandler { ...@@ -225,12 +217,11 @@ public class LanPairingHandler extends BasePairingHandler {
String encodedCertificate = Base64.encodeToString(mDevice.certificate.getEncoded(), 0); String encodedCertificate = Base64.encodeToString(mDevice.certificate.getEncoded(), 0);
editor.putString("certificate", encodedCertificate); editor.putString("certificate", encodedCertificate);
} catch (NullPointerException n) { } catch (NullPointerException n) {
Log.w("KDE/PairingDone", "Certificate is null, remote device does not support ssl"); Log.w("KDE/PairingDone", "Certificate is null, remote device does not support ssl", n);
} catch (CertificateEncodingException c) { } catch (CertificateEncodingException c) {
Log.e("KDE/PairingDOne", "Error encoding certificate"); Log.e("KDE/PairingDOne", "Error encoding certificate", c);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); Log.e("KDE/Pairng", "Exception", e);
Log.e("KDE/Pairng", "Exception");
} }
editor.apply(); editor.apply();
......
...@@ -157,8 +157,7 @@ public class Device implements BaseLink.PacketReceiver { ...@@ -157,8 +157,7 @@ public class Device implements BaseLink.PacketReceiver {
publicKey = KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(publicKeyBytes)); publicKey = KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(publicKeyBytes));
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); Log.e("KDE/Device", "Exception deserializing stored public key for device", e);
Log.e("KDE/Device", "Exception deserializing stored public key for device");
} }
//Assume every plugin is supported until addLink is called and we can get the actual list //Assume every plugin is supported until addLink is called and we can get the actual list
...@@ -459,8 +458,7 @@ public class Device implements BaseLink.PacketReceiver { ...@@ -459,8 +458,7 @@ public class Device implements BaseLink.PacketReceiver {
certificate = SslHelper.parseCertificate(certificateBytes); certificate = SslHelper.parseCertificate(certificateBytes);
Log.i("KDE/Device", "Got certificate "); Log.i("KDE/Device", "Got certificate ");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); Log.e("KDE/Device", "Error getting certificate", e);
Log.e("KDE/Device", "Error getting certificate");
} }
} }
...@@ -474,8 +472,7 @@ public class Device implements BaseLink.PacketReceiver { ...@@ -474,8 +472,7 @@ public class Device implements BaseLink.PacketReceiver {
PrivateKey privateKey = KeyFactory.getInstance("RSA").generatePrivate(new PKCS8EncodedKeySpec(privateKeyBytes)); PrivateKey privateKey = KeyFactory.getInstance("RSA").generatePrivate(new PKCS8EncodedKeySpec(privateKeyBytes));
link.setPrivateKey(privateKey); link.setPrivateKey(privateKey);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); Log.e("KDE/Device", "Exception reading our own private key", e); //Should not happen
Log.e("KDE/Device", "Exception reading our own private key"); //Should not happen
} }
Log.i("KDE/Device", "addLink " + link.getLinkProvider().getName() + " -> " + getName() + " active links: " + links.size()); Log.i("KDE/Device", "addLink " + link.getLinkProvider().getName() + " -> " + getName() + " active links: " + links.size());
...@@ -559,8 +556,7 @@ public class Device implements BaseLink.PacketReceiver { ...@@ -559,8 +556,7 @@ public class Device implements BaseLink.PacketReceiver {
try { try {
ph.packageReceived(np); ph.packageReceived(np);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); Log.e("PairingPacketReceived", "Exception", e);
Log.e("PairingPacketReceived", "Exception");
} }
} }
} else if (isPaired()) { } else if (isPaired()) {
...@@ -578,8 +574,7 @@ public class Device implements BaseLink.PacketReceiver { ...@@ -578,8 +574,7 @@ public class Device implements BaseLink.PacketReceiver {
try { try {
plugin.onPacketReceived(np); plugin.onPacketReceived(np);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); Log.e("KDE/Device", "Exception in " + plugin.getPluginKey() + "'s onPacketReceived()", e);
Log.e("KDE/Device", "Exception in " + plugin.getPluginKey() + "'s onPacketReceived()");
//try { Log.e("KDE/Device", "NetworkPacket:" + np.serialize()); } catch (Exception _) { } //try { Log.e("KDE/Device", "NetworkPacket:" + np.serialize()); } catch (Exception _) { }
} }
} }
...@@ -604,8 +599,7 @@ public class Device implements BaseLink.PacketReceiver { ...@@ -604,8 +599,7 @@ public class Device implements BaseLink.PacketReceiver {
try { try {
plugin.onUnpairedDevicePacketReceived(np); plugin.onUnpairedDevicePacketReceived(np);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); Log.e("KDE/Device", "Exception in " + plugin.getDisplayName() + "'s onPacketReceived() in unPairedPacketListeners", e);
Log.e("KDE/Device", "Exception in " + plugin.getDisplayName() + "'s onPacketReceived() in unPairedPacketListeners");
} }
} }
} else { } else {
...@@ -631,11 +625,7 @@ public class Device implements BaseLink.PacketReceiver { ...@@ -631,11 +625,7 @@ public class Device implements BaseLink.PacketReceiver {
@Override @Override
public void onFailure(Throwable e) { public void onFailure(Throwable e) {
if (e != null) { Log.e("KDE/sendPacket", "Exception", e);
e.printStackTrace();
} else {
Log.e("KDE/sendPacket", "Unknown (null) exception");
}
} }
}; };
...@@ -734,10 +724,7 @@ public class Device implements BaseLink.PacketReceiver { ...@@ -734,10 +724,7 @@ public class Device implements BaseLink.PacketReceiver {
success = plugin.onCreate(); success = plugin.onCreate();
} catch (Exception e) { } catch (Exception e) {
success = false; success = false;
e.printStackTrace(); Log.e("KDE/addPlugin", "plugin failed to load " + pluginKey, e);
}
if (!success) {
Log.e("KDE/addPlugin", "plugin failed to load " + pluginKey);
} }
plugins.put(pluginKey, plugin); plugins.put(pluginKey, plugin);
...@@ -775,8 +762,7 @@ public class Device implements BaseLink.PacketReceiver { ...@@ -775,8 +762,7 @@ public class Device implements BaseLink.PacketReceiver {
plugin.onDestroy(); plugin.onDestroy();
//Log.e("removePlugin","removed " + pluginKey); //Log.e("removePlugin","removed " + pluginKey);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); Log.e("KDE/removePlugin", "Exception calling onDestroy for plugin " + pluginKey, e);
Log.e("KDE/removePlugin", "Exception calling onDestroy for plugin " + pluginKey);
} }
return true; return true;
......
...@@ -39,8 +39,7 @@ public class AppsHelper { ...@@ -39,8 +39,7 @@ public class AppsHelper {
} catch (final PackageManager.NameNotFoundException e) { } catch (final PackageManager.NameNotFoundException e) {
e.printStackTrace(); Log.e("AppsHelper", "Could not resolve name " + packageName, e);
Log.e("AppsHelper", "Could not resolve name " + packageName);
return null; return null;
...@@ -57,15 +56,8 @@ public class AppsHelper { ...@@ -57,15 +56,8 @@ public class AppsHelper {
return pm.getApplicationIcon(ai); return pm.getApplicationIcon(ai);
} catch (final PackageManager.NameNotFoundException e) { } catch (final PackageManager.NameNotFoundException e) {
Log.e("AppsHelper", "Could not find icon for " + packageName, e);
e.printStackTrace();
Log.e("AppsHelper", "Could not find icon for " + packageName);
return null; return null;
} }
} }
} }
...@@ -191,7 +191,7 @@ public class ContactsHelper { ...@@ -191,7 +191,7 @@ public class ContactsHelper {
} }
} catch (IOException e) { } catch (IOException e) {
// If you are experiencing this, please open a bug report indicating how you got here // If you are experiencing this, please open a bug report indicating how you got here
e.printStackTrace(); Log.e("Contacts", "Exception while fetching vcards", e);
} }
// At this point we are screwed: // At this point we are screwed:
...@@ -239,10 +239,10 @@ public class ContactsHelper { ...@@ -239,10 +239,10 @@ public class ContactsHelper {
toReturn.put(ID, new VCardBuilder(vcard.toString())); toReturn.put(ID, new VCardBuilder(vcard.toString()));
} catch (IOException e) { } catch (IOException e) {
// If you are experiencing this, please open a bug report indicating how you got here // If you are experiencing this, please open a bug report indicating how you got here
e.printStackTrace(); Log.e("Contacts", "Exception while fetching vcards", e);
} catch (NullPointerException e) { } catch (NullPointerException e) {
// If you are experiencing this, please open a bug report indicating how you got here // If you are experiencing this, please open a bug report indicating how you got here
e.printStackTrace(); Log.e("Contacts", "Exception while fetching vcards", e);
} }
} }
......
...@@ -496,8 +496,7 @@ public class DeviceHelper { ...@@ -496,8 +496,7 @@ public class DeviceHelper {
} }
} catch (Exception e) { } catch (Exception e) {
//Some phones might not define BRAND or MODEL, ignore exceptions //Some phones might not define BRAND or MODEL, ignore exceptions
Log.e("Exception", e.getMessage()); Log.e("Exception", e.getMessage(), e);
e.printStackTrace();
} }
if (deviceName == null || deviceName.isEmpty()) { if (deviceName == null || deviceName.isEmpty()) {
return "Android"; //Could not find a name return "Android"; //Could not find a name
......
...@@ -129,8 +129,7 @@ public class FilesHelper { ...@@ -129,8 +129,7 @@ public class FilesHelper {
try { try {
size = new File(uri.getPath()).length(); size = new File(uri.getPath()).length();
} catch (Exception e) { } catch (Exception e) {
Log.e("SendFileActivity", "Could not obtain file size"); Log.e("SendFileActivity", "Could not obtain file size", e);
e.printStackTrace();
} }
} else { } else {
...@@ -155,8 +154,7 @@ public class FilesHelper { ...@@ -155,8 +154,7 @@ public class FilesHelper {
String name = cursor.getString(column_index); String name = cursor.getString(column_index);
np.set("filename", name); np.set("filename", name);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); Log.e("SendFileActivity", "Could not obtain file name", e);
Log.e("SendFileActivity", "Could not obtain file name");
} }
try { try {
...@@ -165,8 +163,7 @@ public class FilesHelper { ...@@ -165,8 +163,7 @@ public class FilesHelper {
//For some reason this size can differ from the actual file size! //For some reason this size can differ from the actual file size!
size = cursor.getInt(column_index); size = cursor.getInt(column_index);
} catch (Exception e) { } catch (Exception e) {
Log.e("SendFileActivity", "Could not obtain file size"); Log.e("SendFileActivity", "Could not obtain file size", e);
e.printStackTrace();
} }
} finally { } finally {
try { try {
...@@ -182,7 +179,6 @@ public class FilesHelper { ...@@ -182,7 +179,6 @@ public class FilesHelper {
return np; return np;
} catch (Exception e) { } catch (Exception e) {
Log.e("SendFileActivity", "Exception creating network packet", e); Log.e("SendFileActivity", "Exception creating network packet", e);
e.printStackTrace();
return null; return null;
} }
} }
......
...@@ -45,14 +45,12 @@ public class NetworkHelper { ...@@ -45,14 +45,12 @@ public class NetworkHelper {
return false; //I have neighbours, so this doesn't look like a mobile network return false; //I have neighbours, so this doesn't look like a mobile network
} }
} catch (Exception e) { } catch (Exception e) {
Log.e("NetworkHelper", "Exception reading procnetarp"); Log.e("NetworkHelper", "Exception reading procnetarp", e);
e.printStackTrace();
} }
} }
return mobile; return mobile;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); Log.e("isOnMobileNetwork", "Something went wrong, but this is non-critical.", e);
Log.d("isOnMobileNetwork", "Something went wrong, but this is non-critical.");
} }
return false; return false;
} }
......
...@@ -55,8 +55,7 @@ public class RsaHelper { ...@@ -55,8 +55,7 @@ public class RsaHelper {
keyGen.initialize(2048); keyGen.initialize(2048);
keyPair = keyGen.genKeyPair(); keyPair = keyGen.genKeyPair();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); Log.e("KDE/initializeRsaKeys", "Exception", e);
Log.e("KDE/initializeRsaKeys", "Exception");
return; return;
} }
......
...@@ -114,8 +114,7 @@ public class SslHelper { ...@@ -114,8 +114,7 @@ public class SslHelper {
edit.apply(); edit.apply();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); Log.e("KDE/initialiseCert", "Exception", e);
Log.e("KDE/initialiseCert", "Exception");
} }
} else { } else {
...@@ -125,8 +124,7 @@ public class SslHelper { ...@@ -125,8 +124,7 @@ public class SslHelper {
X509CertificateHolder certificateHolder = new X509CertificateHolder(certificateBytes); X509CertificateHolder certificateHolder = new X509CertificateHolder(certificateBytes);
certificate = new JcaX509CertificateConverter().setProvider(BC).getCertificate(certificateHolder); certificate = new JcaX509CertificateConverter().setProvider(BC).getCertificate(certificateHolder);
} catch (Exception e) { } catch (Exception e) {
Log.e("KDE/SslHelper", "Exception reading own certificate"); Log.e("KDE/SslHelper", "Exception reading own certificate", e);
e.printStackTrace();
} }
} }
} }
...@@ -195,8 +193,7 @@ public class SslHelper { ...@@ -195,8 +193,7 @@ public class SslHelper {
} }
return tlsContext; return tlsContext;
} catch (Exception e) { } catch (Exception e) {
Log.e("KDE/SslHelper", "Error creating tls context"); Log.e("KDE/SslHelper", "Error creating tls context", e);