[
https://issues.jboss.org/browse/SHRINKWRAP-315?page=com.atlassian.jira.pl...
]
David Hosier commented on SHRINKWRAP-315:
-----------------------------------------
I tried the test that Tommy has above and got the same results. But given the line where
the NPE is occurring, Tommy's test would never reach the line in question due to the
IllegalStateException happening in Validate.notNull(). So I think for the AS7 testsuite,
there must be additional context that the single line in the initial description does not
convey. The line where the NPE occurs is:
if (resource.listFiles().length == 0)
Due to validation, we know that resource is not null, so it must be the return of
listFiles() that is null. The javadoc for File says that listFiles() will only return null
if resource is not a directory. However, a couple lines prior, there is a test for
resource.isFile() that must be failing. That means resource is either a directory or some
other type of thing. As far as I can tell, File can only represent real files or
directories, but I could be wrong. So I went in search of answers to how else listFiles()
could return null, and I came up with the following link.
http://programmatica.blogspot.com/2006/09/java-filelistfiles-returns-null...
This link basically says that listFiles() returns null for temporary directories like
files from inside a war exploded by an application server. I am wondering if that is the
situation here in this AS7 test, because simply referencing something that doesn't
exist shouldn't make it as far as where the NPE is.
NPE in ContainerBase.addAsLibrary
---------------------------------
Key: SHRINKWRAP-315
URL:
https://issues.jboss.org/browse/SHRINKWRAP-315
Project: ShrinkWrap
Issue Type: Bug
Affects Versions: 1.0.0-beta-2
Reporter: Andrew Rubinger
Using code:
{code}war.addAsLibrary("xerces/xercesImpl.jar",
"xercesImpl.jar");{code}
..if the resourceName doesn't exist, results in:
{code}Caused by: java.lang.NullPointerException
at
org.jboss.shrinkwrap.impl.base.container.ContainerBase.addAsLibrary(ContainerBase.java:1353)
at
org.jboss.shrinkwrap.impl.base.container.ContainerBase.addAsLibrary(ContainerBase.java:1338)
at
org.jboss.shrinkwrap.impl.base.container.ContainerBase.addAsLibrary(ContainerBase.java:1289)
at
org.jboss.as.test.spec.xerces.ws.XercesUsageInWebServiceTestCase.createWebServiceDeployment(XercesUsageInWebServiceTestCase.java:74)
... 59 more{code}
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira