diff options
| author | 2019-07-08 18:08:30 -0700 | |
|---|---|---|
| committer | 2019-07-08 18:08:30 -0700 | |
| commit | 8f0da80b260a65862ad0b64d26cc3daf79509cc8 (patch) | |
| tree | 13caa147f1076b4e85b89eed42dae12d1fad8e94 | |
| parent | 8d32fefac4e09a0b7e6b3f9484b12111290f7931 (diff) | |
| parent | 70e4d3c3a20ec3f63cfbeade052028ec1d50e161 (diff) | |
Merge "Fix bad arguments handling" am: 79a2b5215d am: 8c64a5a4ff
am: 70e4d3c3a2
Change-Id: Iab78aec4281338c13d99cf9ab168699d1c24915c
| -rw-r--r-- | services/core/java/com/android/server/net/watchlist/NetworkWatchlistShellCommand.java | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/services/core/java/com/android/server/net/watchlist/NetworkWatchlistShellCommand.java b/services/core/java/com/android/server/net/watchlist/NetworkWatchlistShellCommand.java index 766d8ca8a47c..3b24f46d4714 100644 --- a/services/core/java/com/android/server/net/watchlist/NetworkWatchlistShellCommand.java +++ b/services/core/java/com/android/server/net/watchlist/NetworkWatchlistShellCommand.java @@ -17,8 +17,6 @@ package com.android.server.net.watchlist; import android.content.Context; -import android.content.Intent; -import android.net.NetworkWatchlistManager; import android.os.Binder; import android.os.ParcelFileDescriptor; import android.os.RemoteException; @@ -26,7 +24,6 @@ import android.os.ShellCommand; import android.provider.Settings; import java.io.FileInputStream; -import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; @@ -74,10 +71,12 @@ class NetworkWatchlistShellCommand extends ShellCommand { try { final String configXmlPath = getNextArgRequired(); final ParcelFileDescriptor pfd = openFileForSystem(configXmlPath, "r"); - if (pfd != null) { - final InputStream fileStream = new FileInputStream(pfd.getFileDescriptor()); - WatchlistConfig.getInstance().setTestMode(fileStream); + if (pfd == null) { + pw.println("Error: can't open input file " + configXmlPath); + return -1; } + final InputStream fileStream = new FileInputStream(pfd.getFileDescriptor()); + WatchlistConfig.getInstance().setTestMode(fileStream); pw.println("Success!"); } catch (Exception ex) { pw.println("Error: " + ex.toString()); |