[
https://issues.jboss.org/browse/SHRINKDESC-164?page=com.atlassian.jira.pl...
]
Falko M. commented on SHRINKDESC-164:
-------------------------------------
What's the status of this ticket? Is there anything I can do to help speed things up?
This problem somehow got worse after I upgraded to {{shrinkwrap-resolver}} 2.2.2.
Now not only the {{alternatives}}-element needs to be corrected by the workaround but also
child elements like {{stereotype}}:
{code:xml|title=Problem in sub-element with "old" workaround}
<alternatives>
<stereotype
xmlns="">com.t_systems_mms.module.test.arquillian.mock.MockedAlternative</stereotype>
</alternatives>
{code}
The workaround needs to be extended to:
{code:java|title="New" extended workaround}
/**
* Workaround for
https://issues.jboss.org/browse/SHRINKDESC-164.
*
* @param modifiedAlternatives the modified Alternatives
*/
private static void workAroundSHRINKDESC164(final Alternatives<BeansDescriptor>
modifiedAlternatives) {
final org.jboss.shrinkwrap.descriptor.spi.node.Node altNode;
try {
altNode = (org.jboss.shrinkwrap.descriptor.spi.node.Node)
FieldUtils.readDeclaredField(modifiedAlternatives, "childNode", true);
} catch (IllegalAccessException e) {
LOG.warn("Error applying workaround for SHRINKDESC-164", e);
return;
}
final List<org.jboss.shrinkwrap.descriptor.spi.node.Node> nodesToFix = new
ArrayList<>(altNode.getChildren());
nodesToFix.add(altNode);
for (final org.jboss.shrinkwrap.descriptor.spi.node.Node node : nodesToFix) {
node.attribute("xmlns",
"http://java.sun.com/xml/ns/javaee");
}
}
{code}
FYI, dependency-setup before was:
{code:xml}
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>1.1.8.Final</version>
<type>pom</type>
<scope>import</scope>
</dependency>
{code}
Now it is:
{code:xml}
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-bom</artifactId>
<version>2.2.2</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>1.1.8.Final</version>
<type>pom</type>
<scope>import</scope>
</dependency>
{code}
This did *not* result in an update of {{shrinkwrap-descriptors-*}}, everything stayed at
{{2.0.0-alpha-7}}. Weird!
BeansDescriptor.exportAsString() yields empty xmlns attributes in
child elements when Saxon is present on classpath
-------------------------------------------------------------------------------------------------------------------
Key: SHRINKDESC-164
URL:
https://issues.jboss.org/browse/SHRINKDESC-164
Project: ShrinkWrap Descriptors
Issue Type: Bug
Affects Versions: 2.0.0-alpha-7, 2.0.0-alpha-8
Environment: Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1;
2014-12-14T18:29:23+01:00)
Maven home: C:\Program Files\apache-maven-3.2.5
Java version: 1.7.0_80, vendor: Oracle Corporation
Java home: C:\Develop\CCS\jdk1.7.0_80\jre
Default locale: de_DE, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64",
family: "windows"
Reporter: Falko M.
Attachments: SHRINKDESC-164-screenshot1.PNG, SHRINKDESC-164-screenshot2.PNG,
SHRINKDESC-164-testproject.zip
When an existing {{beans.xml}} with child elements like {{alternatives}} is loaded via
{{Descriptors.importAs(BeansDescriptor.class).fromStream(...)}} *and
[
SAXON|http://saxon.sourceforge.net/] is on the classpath*, {{.exportAsString()}} yields
child elements like the following :
{noformat}<alternatives xmlns="">{noformat}
This causes deployment warning in JBoss7 like (truncated):
{noformat}
WARN [org.jboss.weld.deployer] JBAS016011: .../META-INF/beans.xml:5
cvc-complex-type.2.4.a: Invalid content was found starting with element
'alternatives'. One of
'{"http://java.sun.com/xml/ns/javaee":interceptors,
"http://java.sun.com/xml/ns/javaee":decorators,
"http://java.sun.com/xml/ns/javaee":alternatives,
WC[##other:"http://java.sun.com/xml/ns/javaee"]}' is expected.
{noformat}
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)