Bug 894454 - Avoid potential NullPointerException crashes in sutAgent; r=wlach
authorGeoff Brown <gbrown@mozilla.com>
Fri, 02 Aug 2013 20:25:32 -0700
changeset 153571 19f48fd7faf1ba1a3b55a386a98e1204689c9c90
parent 153570 c2a1d9258137fc1178ad622c568f0be1c9aed87f
child 153572 b27b567e0bdc82a95311b7f69f3c8a05c20429ef
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswlach
bugs894454
milestone25.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 894454 - Avoid potential NullPointerException crashes in sutAgent; r=wlach
build/mobile/sutagent/android/CmdWorkerThread.java
build/mobile/sutagent/android/DataWorkerThread.java
build/mobile/sutagent/android/DoCommand.java
--- a/build/mobile/sutagent/android/CmdWorkerThread.java
+++ b/build/mobile/sutagent/android/CmdWorkerThread.java
@@ -134,16 +134,20 @@ public class CmdWorkerThread extends Thr
 
                 if ((inputLine += readLine(in)) != null)
                     {
                     String message = String.format("%s : %s",
                                      socket.getInetAddress().getHostAddress(), inputLine);
                     SUTAgentAndroid.log(dc, message);
 
                     outputLine = dc.processCommand(inputLine, out, in, cmdOut);
+                    if (outputLine == null)
+                        {
+                        outputLine = "";
+                        }
                     if (outputLine.length() > 0)
                         {
                         out.print(outputLine + "\n" + prompt);
                         }
                     else
                         out.print(prompt);
                     out.flush();
                     if (outputLine.equals("exit"))
--- a/build/mobile/sutagent/android/DataWorkerThread.java
+++ b/build/mobile/sutagent/android/DataWorkerThread.java
@@ -165,16 +165,20 @@ public class DataWorkerThread extends Th
                             }
                         }
                     else
                         inputLine = "";
 
                     if ((inputLine += readLine(in)) != null)
                         {
                         outputLine = dc.processCommand(inputLine, out, in, cmdOut);
+                        if (outputLine == null)
+                            {
+                            outputLine = "";
+                            }
                         out.print(outputLine + "\n");
                         out.flush();
                         if (outputLine.equals("exit"))
                             {
                             theParent.StopListening();
                             bListening = false;
                             }
                         if (outputLine.equals("quit"))
--- a/build/mobile/sutagent/android/DoCommand.java
+++ b/build/mobile/sutagent/android/DoCommand.java
@@ -102,17 +102,17 @@ public class DoCommand {
 
     String    currentDir = "/";
     String    sErrorPrefix = "##AGENT-WARNING## ";
     boolean bTraceOn = false;
 
     String ffxProvider = "org.mozilla.ffxcp";
     String fenProvider = "org.mozilla.fencp";
 
-    private final String prgVersion = "SUTAgentAndroid Version 1.18";
+    private final String prgVersion = "SUTAgentAndroid Version 1.19";
 
     public enum Command
         {
         RUN ("run"),
         EXEC ("exec"),
         EXECSU ("execsu"),
         EXECCWD ("execcwd"),
         EXECCWDSU ("execcwdsu"),
@@ -1391,17 +1391,17 @@ private void CancelNotification()
         }
         if (tmpFile.exists())
             {
             tmpFile.delete();
             return("/data/local");
             }
         Log.e("SUTAgentAndroid", "ERROR: Cannot access world writeable test root");
 
-        return(null);
+        return sErrorPrefix + " unable to determine test root";
         }
 
     public String GetAppRoot(String AppName)
         {
         String sRet = sErrorPrefix + " internal error [no context]";
         Context ctx = contextWrapper.getApplicationContext();
 
         if (ctx != null)