[
https://issues.jboss.org/browse/SHRINKWRAP-400?page=com.atlassian.jira.pl...
]
Craig Ringer updated SHRINKWRAP-400:
------------------------------------
Git Pull Request:
https://github.com/shrinkwrap/descriptors/pull/60 (was:
https://github.com/shrinkwrap/descriptors/pull/60)
Description:
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(..)".
was:
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.
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(...)" . 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