[Esbox-commits] r1043 - branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core

eswartz at garage.maemo.org eswartz at garage.maemo.org
Thu Dec 4 22:26:54 EET 2008


Author: eswartz
Date: 2008-12-04 22:26:53 +0200 (Thu, 04 Dec 2008)
New Revision: 1043

Modified:
   branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core/BaseVirtualMachineController.java
Log:
Avoid an NPE: in the event of a timeout, the thread is interrupted before results are gathered.

Modified: branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core/BaseVirtualMachineController.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core/BaseVirtualMachineController.java	2008-12-04 20:25:55 UTC (rev 1042)
+++ branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core/BaseVirtualMachineController.java	2008-12-04 20:26:53 UTC (rev 1043)
@@ -96,12 +96,18 @@
 	 * @return
 	 */
 	protected MachineException processOutput(String message, MachineWatcherThread thread) {
-		return new MachineException(
-				MessageFormat.format("{0}\n\nCommand line: {1}\n\nstdout:\n{2}\nstderr:\n{3}",
-					message, 
-					CommandLineArguments.toCommandLine(thread.launcher.getLaunchCommandArguments()),
-					thread.getResults().stdout,
-					thread.getResults().stderr));
+		if (thread.getResults() != null)
+			return new MachineException(
+					MessageFormat.format("{0}\n\nCommand line: {1}\n\nstdout:\n{2}\nstderr:\n{3}",
+						message, 
+						CommandLineArguments.toCommandLine(thread.launcher.getLaunchCommandArguments()),
+						thread.getResults().stdout,
+						thread.getResults().stderr));
+		else
+			return new MachineException(
+					MessageFormat.format("{0}\n\nCommand line: {1}",
+						message, 
+						CommandLineArguments.toCommandLine(thread.launcher.getLaunchCommandArguments())));
 	}
 
 	@Override



More information about the Esbox-commits mailing list