aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/app/src/main/java/com/wireguard/android/util
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/com/wireguard/android/util')
-rw-r--r--app/src/main/java/com/wireguard/android/util/ClipboardUtils.java1
-rw-r--r--app/src/main/java/com/wireguard/android/util/ObservableKeyedArrayList.java10
-rw-r--r--app/src/main/java/com/wireguard/android/util/ObservableSortedKeyedArrayList.java8
-rw-r--r--app/src/main/java/com/wireguard/android/util/RootShell.java2
4 files changed, 13 insertions, 8 deletions
diff --git a/app/src/main/java/com/wireguard/android/util/ClipboardUtils.java b/app/src/main/java/com/wireguard/android/util/ClipboardUtils.java
index 04a5fe47..d855dc61 100644
--- a/app/src/main/java/com/wireguard/android/util/ClipboardUtils.java
+++ b/app/src/main/java/com/wireguard/android/util/ClipboardUtils.java
@@ -19,6 +19,7 @@ import android.widget.TextView;
public final class ClipboardUtils {
private ClipboardUtils() {
+ // Prevent instantiation
}
public static void copyTextView(final View view) {
diff --git a/app/src/main/java/com/wireguard/android/util/ObservableKeyedArrayList.java b/app/src/main/java/com/wireguard/android/util/ObservableKeyedArrayList.java
index 731af20d..70842052 100644
--- a/app/src/main/java/com/wireguard/android/util/ObservableKeyedArrayList.java
+++ b/app/src/main/java/com/wireguard/android/util/ObservableKeyedArrayList.java
@@ -25,28 +25,28 @@ public class ObservableKeyedArrayList<K, E extends Keyed<? extends K>>
@Override
public boolean add(final E e) {
if (e == null)
- throw new NullPointerException();
+ throw new NullPointerException("Trying to add a null element");
return super.add(e);
}
@Override
public void add(final int index, final E e) {
if (e == null)
- throw new NullPointerException();
+ throw new NullPointerException("Trying to add a null element");
super.add(index, e);
}
@Override
public boolean addAll(@NonNull final Collection<? extends E> c) {
if (c.contains(null))
- throw new NullPointerException();
+ throw new NullPointerException("Trying to add a collection with null element(s)");
return super.addAll(c);
}
@Override
public boolean addAll(final int index, @NonNull final Collection<? extends E> c) {
if (c.contains(null))
- throw new NullPointerException();
+ throw new NullPointerException("Trying to add a collection with null element(s)");
return super.addAll(index, c);
}
@@ -100,7 +100,7 @@ public class ObservableKeyedArrayList<K, E extends Keyed<? extends K>>
@Override
public E set(final int index, final E e) {
if (e == null)
- throw new NullPointerException();
+ throw new NullPointerException("Trying to set a null key");
return super.set(index, e);
}
}
diff --git a/app/src/main/java/com/wireguard/android/util/ObservableSortedKeyedArrayList.java b/app/src/main/java/com/wireguard/android/util/ObservableSortedKeyedArrayList.java
index 7e41a696..0612deb5 100644
--- a/app/src/main/java/com/wireguard/android/util/ObservableSortedKeyedArrayList.java
+++ b/app/src/main/java/com/wireguard/android/util/ObservableSortedKeyedArrayList.java
@@ -95,7 +95,9 @@ public class ObservableSortedKeyedArrayList<K, E extends Keyed<? extends K>>
@Override
public K firstKey() {
if (isEmpty())
- throw new NoSuchElementException();
+ // The parameter in the exception is only to shut
+ // lint up, we never care for the exception message.
+ throw new NoSuchElementException("Empty set");
return get(0).getKey();
}
@@ -137,7 +139,9 @@ public class ObservableSortedKeyedArrayList<K, E extends Keyed<? extends K>>
@Override
public K lastKey() {
if (isEmpty())
- throw new NoSuchElementException();
+ // The parameter in the exception is only to shut
+ // lint up, we never care for the exception message.
+ throw new NoSuchElementException("Empty set");
return get(size() - 1).getKey();
}
diff --git a/app/src/main/java/com/wireguard/android/util/RootShell.java b/app/src/main/java/com/wireguard/android/util/RootShell.java
index a260c55f..7a73929c 100644
--- a/app/src/main/java/com/wireguard/android/util/RootShell.java
+++ b/app/src/main/java/com/wireguard/android/util/RootShell.java
@@ -50,7 +50,7 @@ public class RootShell {
final File cacheDir = context.getCacheDir();
localBinaryDir = new File(cacheDir, "bin");
localTemporaryDir = new File(cacheDir, "tmp");
- preamble = String.format("export CALLING_PACKAGE=com.wireguard.android; export PATH=\"%s:$PATH\" TMPDIR='%s'; id -u\n",
+ preamble = String.format("export CALLING_PACKAGE=com.wireguard.android PATH=\"%s:$PATH\" TMPDIR='%s'; id -u\n",
localBinaryDir, localTemporaryDir);
}