[izpack-devel] fix: PathInputPanel
Julien Ponge
julien.ponge at gmail.com
Sat Jan 6 15:14:30 CET 2007
Hi Stefan,
The hunk #2 failed when trying to apply the patch.
On 1/4/07, Stefan Wachter <stefan.wachter at gmx.de> wrote:
> Hi all,
>
> the current version of PathInputPanel logs a stacktrace on Linux systems when no defaultInstallDir
> is specified and no TargetPanel.dir.x resource is present.
>
>
> There are two problems:
>
> 1. The resouce "TargetPanel.dir.unix" is tried to access twice. The first time the access is not
> surrounded by a try-catch block.
>
> 2. It is possible that no suitable resource is found. In that case no InputStreamReader can be
> instantiated.
>
> Attached you find a corresonding patch.
>
> Cheers,
> --Stefan
>
>
> PS: The problem is also present in older versions of IzPack. But now the stack trace is printed
> because the following lines where added to the loadDefaultInstallDir() method:
>
> //mar: what's the common way to log an exception ?
> e.printStackTrace();
>
>
> Index: lib/com/izforge/izpack/panels/PathInputPanel.java
> ===================================================================
> --- lib/com/izforge/izpack/panels/PathInputPanel.java (Revision 1673)
> +++ lib/com/izforge/izpack/panels/PathInputPanel.java (Arbeitskopie)
> @@ -309,9 +309,6 @@
> catch (ResourceNotFoundException rnfe)
> {}
> // if not specific os, try getting generic 'unix' resource file
> - if (in == null) in = parentFrame.getResource("TargetPanel.dir.unix");
> -
> - // if all those failed, try to look up a generic dir file
> if (in == null)
> {
> try
> @@ -336,19 +333,22 @@
> {}
> }
>
> - // now read the file, once we've identified which one to read
> - InputStreamReader isr = new InputStreamReader(in);
> - br = new BufferedReader(isr);
> - String line;
> - while ((line = br.readLine()) != null)
> + if (in != null)
> {
> - line = line.trim();
> - // use the first non-blank line
> - if (!"".equals(line)) break;
> + // now read the file, once we've identified which one to read
> + InputStreamReader isr = new InputStreamReader(in);
> + br = new BufferedReader(isr);
> + String line;
> + while ((line = br.readLine()) != null)
> + {
> + line = line.trim();
> + // use the first non-blank line
> + if (!"".equals(line)) break;
> + }
> + defaultInstallDir = line;
> + VariableSubstitutor vs = new VariableSubstitutor(idata.getVariables());
> + defaultInstallDir = vs.substitute(defaultInstallDir, null);
> }
> - defaultInstallDir = line;
> - VariableSubstitutor vs = new VariableSubstitutor(idata.getVariables());
> - defaultInstallDir = vs.substitute(defaultInstallDir, null);
> }
> catch (Exception e)
> {
>
>
> _______________________________________________
> izpack-devel mailing list
> izpack-devel at lists.berlios.de
> https://lists.berlios.de/mailman/listinfo/izpack-devel
>
>
>
More information about the izpack-devel
mailing list