Skip to content

Commit

Permalink
Try to fix/workaround problems reported by Google Play console
Browse files Browse the repository at this point in the history
  • Loading branch information
schwabe committed Aug 12, 2022
1 parent 328ea1b commit 62a4c42
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 3 additions & 2 deletions main/src/main/java/de/blinkt/openvpn/core/LogItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.io.UnsupportedEncodingException;
import java.nio.BufferOverflowException;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
Expand Down Expand Up @@ -195,7 +196,7 @@ public LogItem(byte[] in, int length) throws UnsupportedEncodingException {
}

private void marschalString(String str, ByteBuffer bb) throws UnsupportedEncodingException {
byte[] utf8bytes = str.getBytes("UTF-8");
byte[] utf8bytes = str.getBytes(StandardCharsets.UTF_8);
bb.putInt(utf8bytes.length);
bb.put(utf8bytes);
}
Expand All @@ -204,7 +205,7 @@ private String unmarschalString(ByteBuffer bb) throws UnsupportedEncodingExcepti
int len = bb.getInt();
byte[] utf8bytes = new byte[len];
bb.get(utf8bytes);
return new String(utf8bytes, "UTF-8");
return new String(utf8bytes, StandardCharsets.UTF_8);
}


Expand Down
4 changes: 4 additions & 0 deletions main/src/main/java/de/blinkt/openvpn/core/NetworkUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ public static Vector<String> getLocalNetworks(Context c, boolean ipv6) {

NetworkCapabilities nc = conn.getNetworkCapabilities(network);

// Ignore network if it has no capabilities
if (nc == null)
continue;

// Skip VPN networks like ourselves
if (nc.hasTransport(NetworkCapabilities.TRANSPORT_VPN))
continue;
Expand Down

0 comments on commit 62a4c42

Please sign in to comment.