From bbfc7d89913df284649faee1c4d0bcb817c9428e Mon Sep 17 00:00:00 2001 From: Kaloyan Enimanev Date: Thu, 8 Sep 2011 13:02:30 +0200 Subject: [PATCH 10/10] variable substition in INSTALL_PATH values was not working. the logic now refers to a more central VariableSubstitutor from InstallData --- .../panels/target/TargetPanelConsoleHelper.java | 34 +++++++------------ 1 files changed, 13 insertions(+), 21 deletions(-) diff --git a/izpack-panel/src/main/java/com/izforge/izpack/panels/target/TargetPanelConsoleHelper.java b/izpack-panel/src/main/java/com/izforge/izpack/panels/target/TargetPanelConsoleHelper.java index f50af99..b557560 100644 --- a/izpack-panel/src/main/java/com/izforge/izpack/panels/target/TargetPanelConsoleHelper.java +++ b/izpack-panel/src/main/java/com/izforge/izpack/panels/target/TargetPanelConsoleHelper.java @@ -21,19 +21,18 @@ package com.izforge.izpack.panels.target; -import com.izforge.izpack.api.data.AutomatedInstallData; -import com.izforge.izpack.api.data.ResourceManager; -import com.izforge.izpack.api.substitutor.VariableSubstitutor; -import com.izforge.izpack.installer.console.PanelConsole; -import com.izforge.izpack.installer.console.PanelConsoleHelper; -import com.izforge.izpack.panels.path.PathInputPanel; - import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Properties; +import com.izforge.izpack.api.data.AutomatedInstallData; +import com.izforge.izpack.api.data.ResourceManager; +import com.izforge.izpack.installer.console.PanelConsole; +import com.izforge.izpack.installer.console.PanelConsoleHelper; +import com.izforge.izpack.panels.path.PathInputPanel; + /** * The Target panel console helper class. * @@ -41,13 +40,6 @@ import java.util.Properties; */ public class TargetPanelConsoleHelper extends PanelConsoleHelper implements PanelConsole { - private VariableSubstitutor variableSubstitutor; - - public TargetPanelConsoleHelper(VariableSubstitutor variableSubstitutor) - { - this.variableSubstitutor = variableSubstitutor; - } - public boolean runGeneratePropertiesFile(AutomatedInstallData installData, PrintWriter printWriter) { printWriter.println(AutomatedInstallData.INSTALL_PATH + "="); @@ -66,11 +58,10 @@ public class TargetPanelConsoleHelper extends PanelConsoleHelper implements Pane { try { - strTargetPath = variableSubstitutor.substitute(strTargetPath); - } - catch (Exception e) + strTargetPath = installData.getVariableSubstitutor().substitute(strTargetPath); + } catch (Throwable t) { - // ignore + t.printStackTrace(); } installData.setInstallPath(strTargetPath); return true; @@ -81,8 +72,9 @@ public class TargetPanelConsoleHelper extends PanelConsoleHelper implements Pane { ResourceManager resourceManager = ResourceManager.getInstance(); - String strDefaultPath = PathInputPanel.loadDefaultInstallDir( - resourceManager, variableSubstitutor, idata); + String strDefaultPath = + PathInputPanel.loadDefaultInstallDir(resourceManager, + idata.getVariableSubstitutor(), idata); String strTargetPath = ""; @@ -108,7 +100,7 @@ public class TargetPanelConsoleHelper extends PanelConsoleHelper implements Pane try { - strTargetPath = variableSubstitutor.substitute(strTargetPath); + strTargetPath = idata.getVariableSubstitutor().substitute(strTargetPath); } catch (Exception e) { -- 1.7.4.1