From 2c468dc0edbbc205201ca99ec9ad25032a19ad3a Mon Sep 17 00:00:00 2001 From: Kaloyan Enimanev Date: Thu, 8 Sep 2011 12:56:02 +0200 Subject: [PATCH 06/10] minor code simplifications --- .../izpack/panels/process/ProcessPanelWorker.java | 40 +++++++++---------- 1 files changed, 19 insertions(+), 21 deletions(-) diff --git a/izpack-panel/src/main/java/com/izforge/izpack/panels/process/ProcessPanelWorker.java b/izpack-panel/src/main/java/com/izforge/izpack/panels/process/ProcessPanelWorker.java index 94cd791..356a73c 100644 --- a/izpack-panel/src/main/java/com/izforge/izpack/panels/process/ProcessPanelWorker.java +++ b/izpack-panel/src/main/java/com/izforge/izpack/panels/process/ProcessPanelWorker.java @@ -1,5 +1,21 @@ package com.izforge.izpack.panels.process; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.PrintWriter; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import com.izforge.izpack.api.adaptator.IXMLElement; import com.izforge.izpack.api.adaptator.IXMLParser; import com.izforge.izpack.api.adaptator.impl.XMLParser; @@ -17,15 +33,6 @@ import com.izforge.izpack.util.Debug; import com.izforge.izpack.util.IoHelper; import com.izforge.izpack.util.OsConstraintHelper; -import java.io.*; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.text.SimpleDateFormat; -import java.util.*; -import java.util.logging.Level; -import java.util.logging.Logger; -import javax.swing.SwingUtilities; - /** * This class does alle the work for the process panel. *

@@ -70,15 +77,10 @@ public class ProcessPanelWorker implements Runnable * @param variableSubstitutor */ public ProcessPanelWorker(AutomatedInstallData idata, VariableSubstitutor variableSubstitutor, RulesEngine rules) - throws IOException { this.idata = idata; this.vs = variableSubstitutor; this.rules = rules; - // Removed this test in order to move out of the CTOR (ExecuteForPack - // Patch) - // if (!readSpec()) - // throw new IOException("Error reading processing specification"); this.variableSubstitutor = new VariableSubstitutorImpl(this.idata .getVariables()); } @@ -500,16 +502,12 @@ public class ProcessPanelWorker implements Runnable if (exitStatus != 0) { QuestionErrorDisplayer myErrorAlter = new QuestionErrorDisplayer(handler); - SwingUtilities.invokeAndWait(myErrorAlter); + Thread t = new Thread(myErrorAlter); + t.start(); + t.join(); return myErrorAlter.shouldContinue(); } } - catch (InvocationTargetException ex) - { - process.destroy(); - this.handler.emitError("process interrupted", ex.toString()); - return false; - } catch (InterruptedException ie) { process.destroy(); -- 1.7.4.1