From ccd5b7e72cc35fd95d21a63dfcdb22ce9a738992 Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Thu, 21 Jan 2021 12:25:06 +0100 Subject: Make Coverity happy Most of these things are minor to the point that changing them is only to make the scanner happy. --- .../main/java/de/blinkt/openvpn/api/ExternalAppDatabase.java | 2 +- main/src/main/java/de/blinkt/openvpn/core/VPNLaunchHelper.java | 10 +++------- .../src/ui/java/de/blinkt/openvpn/fragments/AboutFragment.java | 3 ++- 3 files changed, 6 insertions(+), 9 deletions(-) (limited to 'main') diff --git a/main/src/main/java/de/blinkt/openvpn/api/ExternalAppDatabase.java b/main/src/main/java/de/blinkt/openvpn/api/ExternalAppDatabase.java index c6cc1beb..57e82778 100644 --- a/main/src/main/java/de/blinkt/openvpn/api/ExternalAppDatabase.java +++ b/main/src/main/java/de/blinkt/openvpn/api/ExternalAppDatabase.java @@ -29,7 +29,7 @@ public class ExternalAppDatabase { mContext =c; } - private final String PREFERENCES_KEY = "allowed_apps"; + private final static String PREFERENCES_KEY = "allowed_apps"; boolean isAllowed(String packagename) { Set allowedapps = getExtAppList(); diff --git a/main/src/main/java/de/blinkt/openvpn/core/VPNLaunchHelper.java b/main/src/main/java/de/blinkt/openvpn/core/VPNLaunchHelper.java index 7c1722e0..7fb01032 100644 --- a/main/src/main/java/de/blinkt/openvpn/core/VPNLaunchHelper.java +++ b/main/src/main/java/de/blinkt/openvpn/core/VPNLaunchHelper.java @@ -51,7 +51,7 @@ public class VPNLaunchHelper { } } - throw new RuntimeException("Cannot find any execulte for this device's ABIs " + abis.toString()); + throw new RuntimeException("Cannot find any execulte for this device's ABIs " + Arrays.toString(abis)); } @TargetApi(Build.VERSION_CODES.LOLLIPOP) @@ -79,17 +79,13 @@ public class VPNLaunchHelper { String binaryName = writeMiniVPN(c); // Add fixed paramenters //args.add("/data/data/de.blinkt.openvpn/lib/openvpn"); - if (binaryName == null) { - VpnStatus.logError("Error writing minivpn binary"); - return null; - } args.add(binaryName); args.add("--config"); args.add(getConfigFilePath(c)); - return args.toArray(new String[args.size()]); + return args.toArray(new String[0]); } private static boolean writeMiniVPNBinary(Context context, String abi, File mvpnout) { @@ -106,7 +102,7 @@ public class VPNLaunchHelper { FileOutputStream fout = new FileOutputStream(mvpnout); - byte buf[] = new byte[4096]; + byte[] buf = new byte[4096]; int lenread = mvpn.read(buf); while (lenread > 0) { diff --git a/main/src/ui/java/de/blinkt/openvpn/fragments/AboutFragment.java b/main/src/ui/java/de/blinkt/openvpn/fragments/AboutFragment.java index 6ab6e2cc..ec07a77c 100644 --- a/main/src/ui/java/de/blinkt/openvpn/fragments/AboutFragment.java +++ b/main/src/ui/java/de/blinkt/openvpn/fragments/AboutFragment.java @@ -45,6 +45,7 @@ import java.util.Vector; import de.blinkt.openvpn.R; import de.blinkt.openvpn.core.VpnStatus; +import kotlin.text.Charsets; public class AboutFragment extends Fragment implements View.OnClickListener { @@ -305,7 +306,7 @@ public class AboutFragment extends Fragment implements View.OnClickListener { try { mvpn = getActivity().getAssets().open("full_licenses.html"); - BufferedReader reader = new BufferedReader(new InputStreamReader(mvpn)); + BufferedReader reader = new BufferedReader(new InputStreamReader(mvpn, Charsets.UTF_8)); StringBuilder sb = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { -- cgit v1.2.3