mergelocation in a path containing spaces
-----------------------------------------

         Key: CORE-141
         URL: http://jira.andromda.org/browse/CORE-141
     Project: AndroMDA Core
        Type: Bug

 Environment: andromda 3.3-SNAPSHOT jsf2 cartridge windows xp
    Reporter: Luca Dall'Olio
 Assigned to: Chad Brandon 


It looks like the mergeLocation property 
(http://team.andromda.org/docs/andromda-cartridges/index.html#mergelocation) is 
not working if pointing to a directory in a path containing spaces. This is 
quite common if a developer working in windows puts sources into his/her home 
directory, something like :

c:\Documents And Settings\johndoe\...

If you do so, a mergeLocation like this (in andromda.xml) will be ignored:

<property name="mergeLocation">${project.basedir}/src/main/cartridge</property>

if you look at cartridge logs you will see the reason :

FileResourceLoader : adding path 'c:\Documents%20And%20Settings\johndoe\...'

In fact, the file path has been urlencoded and will not be found by windows 
(maybe andromda could check if file exists and is a directory before giving it 
to velocity...)

By looking at andromda source code, perhaps I found the explanation in 
org.andromda.core.common.BasePlugin :

this.getTemplateEngine().setMergeLocation(this.getMergeLocation().getFile());

It seems to me that this code is wrong, since the getFile() method in the 
java.net.URL class just removes the protocol and will not return a valid 
filesystem path in every case : 

http://java.sun.com/j2se/1.4.2/docs/api/java/net/URL.html#getFile()

it looks like something like this could be a better solution :

this.getTemplateEngine().setMergeLocation(new File(new 
URI(this.getMergeLocation().toString())).getAbsolutePath());

This issue has also been discussed in this forum thread :
http://galaxy.andromda.org/forum/viewtopic.php?t=5611

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.andromda.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

Reply via email to