[shrinkwrap-issues] [JBoss JIRA] (SHRINKWRAP-400) Confusing exception when filename string passed to DescriptorImporter.from(...)
Craig Ringer (JIRA)
jira-events at lists.jboss.org
Fri Apr 13 07:35:47 EDT 2012
[ https://issues.jboss.org/browse/SHRINKWRAP-400?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Craig Ringer updated SHRINKWRAP-400:
------------------------------------
Git Pull Request: https://github.com/shrinkwrap/descriptors/pull/60
Add pull request
> Confusing exception when filename string passed to DescriptorImporter.from(...)
> -------------------------------------------------------------------------------
>
> Key: SHRINKWRAP-400
> URL: https://issues.jboss.org/browse/SHRINKWRAP-400
> Project: ShrinkWrap
> Issue Type: Feature Request
> Components: api, ext-descriptors
> Affects Versions: 1.0.0
> 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(...)" and ".fromFile(...)". The unqualified .from() could continue to accept an InputStream or Reader, just not String.
--
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