From: <hu...@us...> - 2006-10-17 21:35:13
|
Revision: 299 http://svn.sourceforge.net/cishell/?rev=299&view=rev Author: huangb Date: 2006-10-17 14:35:00 -0700 (Tue, 17 Oct 2006) Log Message: ----------- Bug Fix: Check process exitValue. If the static executable algorithm crashes in the middle of the runtime, display the error using the guibuilder Modified Paths: -------------- trunk/templates/org.cishell.templates/src/org/cishell/templates/staticexecutable/StaticExecutableRunner.java Modified: trunk/templates/org.cishell.templates/src/org/cishell/templates/staticexecutable/StaticExecutableRunner.java =================================================================== --- trunk/templates/org.cishell.templates/src/org/cishell/templates/staticexecutable/StaticExecutableRunner.java 2006-10-17 21:31:54 UTC (rev 298) +++ trunk/templates/org.cishell.templates/src/org/cishell/templates/staticexecutable/StaticExecutableRunner.java 2006-10-17 21:35:00 UTC (rev 299) @@ -35,6 +35,7 @@ import org.cishell.framework.data.BasicData; import org.cishell.framework.data.Data; import org.cishell.framework.data.DataProperty; +import org.cishell.service.guibuilder.GUIBuilderService; import org.cishell.templates.Activator; import org.osgi.framework.BundleContext; import org.osgi.service.log.LogService; @@ -45,10 +46,12 @@ */ public class StaticExecutableRunner implements Algorithm { protected final String tempDir; + protected final GUIBuilderService guiBuilder; protected final Data[] data; protected Dictionary parameters; protected Properties props; protected CIShellContext ciContext; + public StaticExecutableRunner(BundleContext bContext, CIShellContext ciContext, Properties props, Dictionary parameters, Data[] data) throws IOException { this.ciContext = ciContext; @@ -56,6 +59,9 @@ this.parameters = parameters; this.data = data; + guiBuilder = (GUIBuilderService)ciContext.getService(GUIBuilderService.class.getName()); + + if (data == null) data = new Data[0]; if (parameters == null) parameters = new Hashtable(); @@ -147,6 +153,14 @@ logStream(LogService.LOG_ERROR, process.getErrorStream()); process.waitFor(); + //successfully ran? + if (process.exitValue() != 0) { + //display the error message using gui builder + guiBuilder.showError("Algorithm Could Not Finish Execution", "Sorry, the algorithm could not finish execution.", + "Please check the console window for the error log messages and report the bug.\n" + +"Thank you."); + } + //get the outputted files String[] afterFiles = dir.list(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |