[shrinkwrap-issues] [JBoss JIRA] (SHRINKWRAP-442) NPE when calling WebArchive.addAsResource(String, String) with a directory name

Simon Lindgren (JIRA) jira-events at lists.jboss.org
Fri Feb 15 07:46:56 EST 2013


    [ https://issues.jboss.org/browse/SHRINKWRAP-442?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12754401#comment-12754401 ] 

Simon Lindgren commented on SHRINKWRAP-442:
-------------------------------------------

I forgot to mention, aslak asked me in #jbosstesting to submit this as a bug. As for the version, I haven't used a specific one, just what arquillian pulls in.

Aslak thought this was due to assuming the path points to a single Asset when looking in jars.

I probably should have included this relevant piece of the conversation:

-- snip --

[11:40] <      simonl> | might be worth mentioning that the directory in question is in one of the dependency jars (but it is our jar)
[11:41] <      aslak> | simonl what are you trying to add ? addAsResource(?)
[11:42] <      simonl> | aslak: it's a directory containing a bunch of flyway migrations
[11:42] <      simonl> | war.addAsResource(MIGRATION_PATH, MIGRATION_PATH);
[11:42] <      simonl> | private static final String MIGRATION_PATH = "db/migration";
[11:43] <      aslak> | simonl so it's a directory inside a jar ? 
[11:43] <      simonl> | yes
[11:44] <       aslak> | it seems to try to read it as a single Asset
[11:44] <      simonl> | similar code works fine when run inside the jar containing the directory, but then it's not a jar but just a directory on the file 
          system (AFAIK
[11:44] <      simonl> | )
[11:44] <      simonl> | ah
[11:44] <      aslak> | simonl could you file a issue at http://jira.jboss.org/jira/browse/SHRINKWRAP and provide a little test case? :)
[11:45] <      simonl> | perhaps... I'll have a look :)
[11:46] <      aslak> | simonl yea, that was the next question :)

-- snip --

                
> NPE when calling WebArchive.addAsResource(String, String) with a directory name
> -------------------------------------------------------------------------------
>
>                 Key: SHRINKWRAP-442
>                 URL: https://issues.jboss.org/browse/SHRINKWRAP-442
>             Project: ShrinkWrap
>          Issue Type: Bug
>    Affects Versions: 1.0.1
>            Reporter: Simon Lindgren
>         Attachments: SHRINKWRAP-442-example-project.zip
>
>
> When calling WebArchive.addAsResource(String, String) with a path that is a directory, and that directory is on the classpath, but inside another jar, a NPE is thrown.
> The same kind of code works fine when run from inside the jar.
> I'll attach an example maven project that reproduces the issue.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the shrinkwrap-issues mailing list