summaryrefslogtreecommitdiffhomepage
path: root/app/src/main/java/com/wireguard/android
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-12-09 05:41:39 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2018-12-09 05:54:47 +0100
commita641a093ad67dfeb30053af4fed66944b4def946 (patch)
tree58f7d51ab0db84e92e7c32509ca465e86beb7366 /app/src/main/java/com/wireguard/android
parent704369d431271553f66ac9efc9b96447160d3bd7 (diff)
Use English lower casing
In Turkish, I becomes ı instead of i, which is a problem when matching things like "AllowedIPs". Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'app/src/main/java/com/wireguard/android')
-rw-r--r--app/src/main/java/com/wireguard/android/backend/WgQuickBackend.java3
-rw-r--r--app/src/main/java/com/wireguard/android/fragment/TunnelListFragment.java7
-rw-r--r--app/src/main/java/com/wireguard/android/preference/VersionPreference.java6
3 files changed, 10 insertions, 6 deletions
diff --git a/app/src/main/java/com/wireguard/android/backend/WgQuickBackend.java b/app/src/main/java/com/wireguard/android/backend/WgQuickBackend.java
index 68799057..b69845be 100644
--- a/app/src/main/java/com/wireguard/android/backend/WgQuickBackend.java
+++ b/app/src/main/java/com/wireguard/android/backend/WgQuickBackend.java
@@ -21,6 +21,7 @@ import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import java.util.Locale;
import java.util.Objects;
import java.util.Set;
@@ -117,7 +118,7 @@ public final class WgQuickBackend implements Backend {
stream.write(config.toWgQuickString().getBytes(StandardCharsets.UTF_8));
}
String command = String.format("wg-quick %s '%s'",
- state.toString().toLowerCase(), tempFile.getAbsolutePath());
+ state.toString().toLowerCase(Locale.ENGLISH), tempFile.getAbsolutePath());
if (state == State.UP)
command = "cat /sys/module/wireguard/version && " + command;
final int result = Application.getRootShell().run(null, command);
diff --git a/app/src/main/java/com/wireguard/android/fragment/TunnelListFragment.java b/app/src/main/java/com/wireguard/android/fragment/TunnelListFragment.java
index de8f6c06..51405745 100644
--- a/app/src/main/java/com/wireguard/android/fragment/TunnelListFragment.java
+++ b/app/src/main/java/com/wireguard/android/fragment/TunnelListFragment.java
@@ -53,6 +53,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
+import java.util.Locale;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
@@ -117,8 +118,8 @@ public class TunnelListFragment extends BaseFragment {
throw new IllegalArgumentException("Illegal file name: " + name);
name = name.substring(idx + 1);
}
- boolean isZip = name.toLowerCase().endsWith(".zip");
- if (name.toLowerCase().endsWith(".conf"))
+ boolean isZip = name.toLowerCase(Locale.ENGLISH).endsWith(".zip");
+ if (name.toLowerCase(Locale.ENGLISH).endsWith(".conf"))
name = name.substring(0, name.length() - ".conf".length());
else if (!isZip)
throw new IllegalArgumentException("File must be .conf or .zip");
@@ -137,7 +138,7 @@ public class TunnelListFragment extends BaseFragment {
continue;
name = name.substring(name.lastIndexOf('/') + 1);
}
- if (name.toLowerCase().endsWith(".conf"))
+ if (name.toLowerCase(Locale.ENGLISH).endsWith(".conf"))
name = name.substring(0, name.length() - ".conf".length());
else
continue;
diff --git a/app/src/main/java/com/wireguard/android/preference/VersionPreference.java b/app/src/main/java/com/wireguard/android/preference/VersionPreference.java
index 1f3f5aa8..ec02eb07 100644
--- a/app/src/main/java/com/wireguard/android/preference/VersionPreference.java
+++ b/app/src/main/java/com/wireguard/android/preference/VersionPreference.java
@@ -17,6 +17,8 @@ import com.wireguard.android.Application;
import com.wireguard.android.BuildConfig;
import com.wireguard.android.R;
+import java.util.Locale;
+
public class VersionPreference extends Preference {
@Nullable private String versionSummary;
@@ -24,11 +26,11 @@ public class VersionPreference extends Preference {
super(context, attrs);
Application.getBackendAsync().thenAccept(backend -> {
- versionSummary = getContext().getString(R.string.version_summary_checking, backend.getTypeName().toLowerCase());
+ versionSummary = getContext().getString(R.string.version_summary_checking, backend.getTypeName().toLowerCase(Locale.ENGLISH));
Application.getAsyncWorker().supplyAsync(backend::getVersion).whenComplete((version, exception) -> {
versionSummary = exception == null
? getContext().getString(R.string.version_summary, backend.getTypeName(), version)
- : getContext().getString(R.string.version_summary_unknown, backend.getTypeName().toLowerCase());
+ : getContext().getString(R.string.version_summary_unknown, backend.getTypeName().toLowerCase(Locale.ENGLISH));
notifyChanged();
});
});