[ 
https://issues.apache.org/jira/browse/FELIX-6326?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17191585#comment-17191585
 ] 

Jean-Baptiste Onofré commented on FELIX-6326:
---------------------------------------------

[~karlpauls] no rush for the release. And if it's easy to cherry pick, it would 
be great to have this backported on 5.6.x (anyway, Karaf 4.3.0 is on the way 
with Felix Framework 6.0.x use).

Let me test the fix on Karaf 4.3.0-SNAPSHOT. Thanks !

> Cannot read bundled resources with hash in the filename
> -------------------------------------------------------
>
>                 Key: FELIX-6326
>                 URL: https://issues.apache.org/jira/browse/FELIX-6326
>             Project: Felix
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: framework-6.0.3
>            Reporter: Oskar
>            Assignee: Karl Pauls
>            Priority: Major
>             Fix For: framework-6.0.4
>
>
> Trying to access a resource via class.getResourceAsStream() fails with NPE if 
> the file name contains hash (#). 
> Example bundle code to verify the fault:
> @Component(immediate = true)
> public class ResourceReader
>  {
>   private static final Logger LOG = LogManager.getLogger();
>   @Activate
>   public void activate()
>  
> {     String fileNameWithoutHashes = "file_without_hash.txt";     
> logFileContent(fileNameWithoutHashes);String fileNameWithHashes = 
> "file#with#hash.txt";     logFileContent(fileNameWithHashes);    }
>   private void logFileContent(String resourceFileName)}}
>   {
>     InputStream stream = ResourceReader.class.getResourceAsStream("/" + 
> resourceFileName);
>     try (BufferedReader bufferedReader = new BufferedReader(new 
> InputStreamReader(stream)))
>    
> {       LOG.info(bufferedReader.readLine());     }
>     catch (Exception e)
>    
> {       LOG.error("FAILURE: Could not read " + resourceFileName);     }
>   }
> }
> Resource files located in bundle root:
> /file_without_hash.txt - content irrelevant
> /file#with#hash.txt - content irrelevant
> Problem is seen in Karaf using Felix framework. Switching to Equinox made the 
> problem disappear.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to