[
https://issues.jboss.org/browse/SHRINKDESC-120?page=com.atlassian.jira.pl...
]
Andrew Rubinger reassigned SHRINKDESC-120:
------------------------------------------
Assignee: Andrew Rubinger
Confusing exception when filename string passed to
DescriptorImporter.from(...)
-------------------------------------------------------------------------------
Key: SHRINKDESC-120
URL:
https://issues.jboss.org/browse/SHRINKDESC-120
Project: ShrinkWrap Descriptors
Issue Type: Patch
Components: api
Reporter: Craig Ringer
Assignee: Andrew Rubinger
Descriptors 2.0.0.alpha2
It's too easy to write:
{code}
BeansDescriptor beansXml = Descriptors.importAs(BeansDescriptor.class)
.from("src/main/webapp/WEB-INF/beans.xml");
{code}
when you really meant:
{code}
BeansDescriptor beansXml = Descriptors.importAs(BeansDescriptor.class)
.from(new File("src/main/webapp/WEB-INF/beans.xml"));
{code}
The incorrect code reads fine, and the exception thrown doesn't make it at all
obvious what's happening:
{code}
java.lang.RuntimeException: Could not invoke deployment method: public static
org.jboss.shrinkwrap.api.spec.JavaArchive com.example.shrinkwraptestsk
eleton.DemoTest.createDeployment()
....
Caused by: java.lang.reflect.InvocationTargetException
....
Caused by: org.jboss.shrinkwrap.descriptor.api.DescriptorImportException: Could not
import XML from stream
....
Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not
allowed in prolog.
....
{code}
I'd like to replace ".from(String)" with ".fromString(...)" . The
unqualified .from() could continue to accept an InputStream or Reader, just not String.
Adding ".fromFile(String)" is probably pointless given it'd be a pointless
wrapper around "new File(..)".
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see:
http://www.atlassian.com/software/jira