[shrinkwrap-issues] [JBoss JIRA] (SHRINKDESC-120) Confusing exception when filename string passed to DescriptorImporter.from(...)
Andrew Rubinger (JIRA)
jira-events at lists.jboss.org
Wed Apr 25 10:15:18 EDT 2012
[ https://issues.jboss.org/browse/SHRINKDESC-120?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andrew Rubinger resolved SHRINKDESC-120.
----------------------------------------
Fix Version/s: 2.0.0-alpha-3
Resolution: Done
Upstream:
https://github.com/shrinkwrap/descriptors/commit/6524d96bdd7bbe0894946a398eb4635d8d538d25
and
https://github.com/shrinkwrap/descriptors/commit/c4a44a2c8622ce092994eaa8a9eaef3586838200
> 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: Task
> Components: api
> Reporter: Craig Ringer
> Assignee: Andrew Rubinger
> Fix For: 2.0.0-alpha-3
>
>
> 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