summaryrefslogtreecommitdiff
path: root/src/de/blinkt/openvpn/core/OpenVpnService.java
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2013-06-23 17:09:52 +0200
committerArne Schwabe <arne@rfc2549.org>2013-06-23 17:09:52 +0200
commit0e76e955ba4848b18ee458cb9f53cc8e64671146 (patch)
tree818cb149d78d508dcc34fa6cdfc3e94e3655db4b /src/de/blinkt/openvpn/core/OpenVpnService.java
parent180642560ef5c8a0139dcd50c1a7fa949c0c20f4 (diff)
Fix issues found by Code Analysis
Diffstat (limited to 'src/de/blinkt/openvpn/core/OpenVpnService.java')
-rw-r--r--src/de/blinkt/openvpn/core/OpenVpnService.java20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/de/blinkt/openvpn/core/OpenVpnService.java b/src/de/blinkt/openvpn/core/OpenVpnService.java
index 230ddbaa..0bfc150a 100644
--- a/src/de/blinkt/openvpn/core/OpenVpnService.java
+++ b/src/de/blinkt/openvpn/core/OpenVpnService.java
@@ -68,7 +68,7 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac
private static boolean mNotificationAlwaysVisible =false;
private final IBinder mBinder = new LocalBinder();
- private boolean mOvpn3;
+ private boolean mOvpn3 = false;
private OpenVPNManagement mManagement;
@@ -269,14 +269,14 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac
OpenVPN.addStateListener(this);
OpenVPN.addByteCountListener(this);
- if(intent != null && intent.getAction() !=null &&intent.getAction().equals(PAUSE_VPN))
+ if(intent != null && PAUSE_VPN.equals(intent.getAction()))
{
if(mDeviceStateReceiver!=null)
mDeviceStateReceiver.userPause(true);
return START_NOT_STICKY;
}
- if(intent != null && intent.getAction() !=null &&intent.getAction().equals(RESUME_VPN))
+ if(intent != null && RESUME_VPN.equals(intent.getAction()))
{
if(mDeviceStateReceiver!=null)
mDeviceStateReceiver.userPause(false);
@@ -284,12 +284,13 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac
}
- if(intent != null && intent.getAction() !=null &&intent.getAction().equals(START_SERVICE))
+ if(intent != null && START_SERVICE.equals(intent.getAction()))
return START_NOT_STICKY;
- if(intent != null && intent.getAction() !=null &&intent.getAction().equals(START_SERVICE_STICKY)) {
+ if(intent != null && START_SERVICE_STICKY.equals(intent.getAction())) {
return START_REDELIVER_INTENT;
}
+ assert(intent!=null);
// Extract information from the intent.
String prefix = getPackageName();
@@ -312,6 +313,7 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
+ e.printStackTrace();
}
@@ -320,6 +322,7 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
+ e.printStackTrace();
}
}
// An old running VPN should now be exited
@@ -512,11 +515,6 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac
}
}
-
- public void addRoute(CIDRIP route)
- {
- mRoutes.add(route );
- }
public void addRoute(String dest, String mask) {
CIDRIP route = new CIDRIP(dest, mask);
if(route.len == 32 && !mask.equals("255.255.255.255")) {
@@ -537,7 +535,7 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac
mMtu=mtu;
}
- public void setLocalIP(CIDRIP cdrip)
+ public void setLocalIP(CIDRIP cdrip)
{
mLocalIP=cdrip;
}