IzPack

resolveIzPackHome fails when standalone-compiler.jar resides in directory with spaces

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 3.11.0
  • Fix Version/s: 4.0.0
  • Component/s: Compiler
  • Labels:
    None
  • Environment:
    Windows XP SP2, JDK 1.6.0
  • Number of attachments :
    1

Description

When using a standalone-compiler.jar located in a path that contains spaces the lookup of izpack home fails. This scenario is quite common when using maven on windows. I could not get it to work by setting the home explicitly (eg -DIZPACK_HOME=. or -h . )

C:\tmp>java -cp "C:\Documents and Settings\theuser\.m2\repository\izpack\standalone-compiler\3.11.0\standalone-compiler-3.11.0.jar" com.izforge.izpack.compiler.Compiler install-definition.xml

.:: IzPack - Version 3.11.0 ::.

< compiler specifications version: 1.0 >

  • Copyright (c) 2001-2008 Julien Ponge
  • Visit http://izpack.org/ for the latest releases
  • Released under the terms of the Apache Software License version 2.0.

-> Fatal error :
No valid IzPack home directory found
java.lang.IllegalArgumentException: No valid IzPack home directory found
at com.izforge.izpack.compiler.CompilerConfig.resolveIzPackHome(Compiler
Config.java:2283)
at com.izforge.izpack.compiler.CompilerConfig.main(CompilerConfig.java:2
210)
at com.izforge.izpack.compiler.Compiler.main(Compiler.java:709)

(tip : use -? to get the commmand line parameters)

Activity

Hide
Tomas Carlsson added a comment -

I did some more testing with this and it turns out that the problem is not related to spaces at all (so if someone knows how, change the title of this issue).

The problem is that the jar-file has a version number at the end of the name. The code checks for exact match on "standalone-compiler.jar", which doesnt work with maven style version numbers.

It was a bit confusing to debug since the code loops and checks parentFile(); so if the jar file resides somewhere inside a valid IZPACK_HOME a home-dir will eventually be found (although not the expected one).

BTW, the problem exist on trunk as well.

Show
Tomas Carlsson added a comment - I did some more testing with this and it turns out that the problem is not related to spaces at all (so if someone knows how, change the title of this issue). The problem is that the jar-file has a version number at the end of the name. The code checks for exact match on "standalone-compiler.jar", which doesnt work with maven style version numbers. It was a bit confusing to debug since the code loops and checks parentFile(); so if the jar file resides somewhere inside a valid IZPACK_HOME a home-dir will eventually be found (although not the expected one). BTW, the problem exist on trunk as well.
Hide
Tomas Carlsson added a comment -

The attached patch highligts and fixes my particular problem. However the patch is not a complete fix, I guess that other filenaming schemes can break it again. The method should probably be rewritten to not depend on the jar file-name at all.

Show
Tomas Carlsson added a comment - The attached patch highligts and fixes my particular problem. However the patch is not a complete fix, I guess that other filenaming schemes can break it again. The method should probably be rewritten to not depend on the jar file-name at all.
Hide
Tomas Carlsson added a comment -

The patch is against "tags/3.11.0".

BTW, there are some similar code in the Ant project that might be of use:

http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/launch/Locator.java?view=markup

Show
Tomas Carlsson added a comment - The patch is against "tags/3.11.0". BTW, there are some similar code in the Ant project that might be of use: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/launch/Locator.java?view=markup
Hide
Julien Ponge added a comment -

The issue is confirmed to be closed.

Show
Julien Ponge added a comment - The issue is confirmed to be closed.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: