[forge-issues] [JBoss JIRA] (FORGE-2245) ResourceFactory : creating a resource from a file

George Gastaldi (JIRA) issues at jboss.org
Thu Feb 19 00:24:49 EST 2015


     [ https://issues.jboss.org/browse/FORGE-2245?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

George Gastaldi updated FORGE-2245:
-----------------------------------
    Fix Version/s: 2.x Future


> ResourceFactory : creating a resource from a file
> -------------------------------------------------
>
>                 Key: FORGE-2245
>                 URL: https://issues.jboss.org/browse/FORGE-2245
>             Project: Forge
>          Issue Type: Bug
>          Components: Resources
>    Affects Versions: 2.13.1.Final
>         Environment: w764, java 7
>            Reporter: Jerome B
>             Fix For: 2.x Future
>
>
> As I was trying to use a file contained in the JAR of my addon, I used this (intuitive) code
> URL voilaURL = getClass().getClassLoader().getResource("voila.txt");
> File f = new File(voilaURL.toExternalForm());
> Resource<?> resource = rfactory.create(f); // KO
> FileResource fresource = rfactory.create(FileResource.class, f); // KO
> both last two line lead to a FileResource which, in debug is displayed as this form  
> [PROJECT_ROOT][Correct full path of file in jar]
> D:\workspace_addons\ADDONS\jar:file:\C:\Users\me\.forge\addons\fr-company-addons-ADDONS213b-1-0-1-SNAPSHOT\ADDONS213b-1.0.1-SNAPSHOT-forge-addon.jar!\voila.txt
> Then, those FileResources when used with the templateFactory 
> Template template = tfactory.create(resource,FreemarkerTemplate.class);
> lead to an error like "template does not exist"
> Hint?: The toString value is wrong but the path of the file within FileResource is ok
> See https://developer.jboss.org/thread/252367 for more data



--
This message was sent by Atlassian JIRA
(v6.3.11#6341)


More information about the forge-issues mailing list