[shrinkwrap-issues] [JBoss JIRA] (SHRINKDESC-120) Confusing exception when filename string passed to DescriptorImporter.from(...)
Andrew Rubinger (JIRA)
jira-events at lists.jboss.org
Mon Apr 23 17:12:18 EDT 2012
[ https://issues.jboss.org/browse/SHRINKDESC-120?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andrew Rubinger moved SHRINKWRAP-400 to SHRINKDESC-120:
-------------------------------------------------------
Project: ShrinkWrap Descriptors (was: ShrinkWrap)
Key: SHRINKDESC-120 (was: SHRINKWRAP-400)
Affects Version/s: (was: 1.0.0)
Component/s: api
(was: api)
(was: ext-descriptors)
> 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
>
> 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
More information about the shrinkwrap-issues
mailing list