diff options
author | Andrei Kapishnikov <kapishnikov@google.com> | 2014-12-22 12:40:48 -0500 |
---|---|---|
committer | Andrei Kapishnikov <kapishnikov@google.com> | 2015-01-16 15:57:55 -0500 |
commit | 44c02590374bda5928669be0d14110b12c271461 (patch) | |
tree | 619b4cf3ce45d7db81d65ea4719575e6be58f429 /packages | |
parent | 84c2744108506abf910fe41314a43e9ace7dd07a (diff) | |
download | frameworks_base-44c02590374bda5928669be0d14110b12c271461.zip frameworks_base-44c02590374bda5928669be0d14110b12c271461.tar.gz frameworks_base-44c02590374bda5928669be0d14110b12c271461.tar.bz2 |
Do not throw NullPointerException from PacService
Do not throw NullPointerException from PacService
since the calling client may not expect it and crash.
Fix of Bug 18818567
Change-Id: Ic36e8a1ca13cdaa7f605b6ade9cc6783517cbf40
Diffstat (limited to 'packages')
-rw-r--r-- | packages/services/PacProcessor/src/com/android/pacprocessor/PacService.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/packages/services/PacProcessor/src/com/android/pacprocessor/PacService.java b/packages/services/PacProcessor/src/com/android/pacprocessor/PacService.java index c6b76f1..74391eb 100644 --- a/packages/services/PacProcessor/src/com/android/pacprocessor/PacService.java +++ b/packages/services/PacProcessor/src/com/android/pacprocessor/PacService.java @@ -72,16 +72,22 @@ public class PacService extends Service { @Override public String resolvePacFile(String host, String url) throws RemoteException { try { + if (host == null) { + throw new IllegalArgumentException("The host must not be null"); + } + if (url == null) { + throw new IllegalArgumentException("The URL must not be null"); + } // Check for characters that could be used for an injection attack. new URL(url); for (char c : host.toCharArray()) { if (!Character.isLetterOrDigit(c) && (c != '.') && (c != '-')) { - throw new RemoteException("Invalid host was passed"); + throw new IllegalArgumentException("Invalid host was passed"); } } return mPacNative.makeProxyRequest(url, host); } catch (MalformedURLException e) { - throw new RemoteException("Invalid URL was passed"); + throw new IllegalArgumentException("Invalid URL was passed"); } } |