You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2008/09/02 18:34:57 UTC
svn commit: r691311 - in /cxf/branches/2.1.x-fixes: ./
api/src/main/java/org/apache/cxf/databinding/AbstractDataBinding.java
rt/testsupport/pom.xml tools/javato/ws/pom.xml
Author: dkulp
Date: Tue Sep 2 09:34:56 2008
New Revision: 691311
URL: http://svn.apache.org/viewvc?rev=691311&view=rev
Log:
Merged revisions 690289 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r690289 | dkulp | 2008-08-29 11:14:21 -0400 (Fri, 29 Aug 2008) | 3 lines
[CXF-1769] Hack a workaround for a bug in JAXB
Fix a couple poms
........
Modified:
cxf/branches/2.1.x-fixes/ (props changed)
cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/databinding/AbstractDataBinding.java
cxf/branches/2.1.x-fixes/rt/testsupport/pom.xml
cxf/branches/2.1.x-fixes/tools/javato/ws/pom.xml
Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Sep 2 09:34:56 2008
@@ -1 +1 @@
-/cxf/trunk:686333-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891,687910,687914,688086,688102,688133,688596,688735,688870,689572,689596,689855,689924,690067
+/cxf/trunk:686333-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891,687910,687914,688086,688102,688133,688596,688735,688870,689572,689596,689855,689924,690067,690289
Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Sep 2 09:34:56 2008
@@ -1 +1 @@
-/cxf/trunk:1-686342,686344-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891,687910,687914,688086,688102,688133,688596,688735,688870,689572,689596,689855,689924,690067,690638
+/cxf/trunk:1-686342,686344-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891,687910,687914,688086,688102,688133,688596,688735,688870,689572,689596,689855,689924,690067,690289,690638
Modified: cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/databinding/AbstractDataBinding.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/databinding/AbstractDataBinding.java?rev=691311&r1=691310&r2=691311&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/databinding/AbstractDataBinding.java (original)
+++ cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/databinding/AbstractDataBinding.java Tue Sep 2 09:34:56 2008
@@ -35,6 +35,7 @@
import org.apache.cxf.common.util.StringUtils;
import org.apache.cxf.common.xmlschema.SchemaCollection;
+import org.apache.cxf.helpers.DOMUtils;
import org.apache.cxf.service.model.SchemaInfo;
import org.apache.cxf.service.model.ServiceInfo;
import org.apache.cxf.staxutils.StaxUtils;
@@ -55,6 +56,7 @@
private Collection<DOMSource> schemas;
private Map<String, String> namespaceMap;
+ private boolean hackAroundEmptyNamespaceIssue;
public Collection<DOMSource> getSchemas() {
return schemas;
@@ -68,12 +70,19 @@
String systemId) {
String ns = d.getDocumentElement().getAttribute("targetNamespace");
if (StringUtils.isEmpty(ns)) {
+ if (DOMUtils.getFirstElement(d.getDocumentElement()) == null) {
+ hackAroundEmptyNamespaceIssue = true;
+ return null;
+ }
//create a copy of the dom so we
//can modify it.
d = copy(d);
ns = serviceInfo.getInterface().getName().getNamespaceURI();
d.getDocumentElement().setAttribute("targetNamespace", ns);
}
+ if (hackAroundEmptyNamespaceIssue) {
+ d = doEmptyNamespaceHack(d);
+ }
Node n = d.getDocumentElement().getFirstChild();
while (n != null) {
@@ -96,6 +105,36 @@
serviceInfo.addSchema(schema);
return xmlSchema;
}
+ private Document doEmptyNamespaceHack(Document d) {
+ boolean hasStuffToRemove = false;
+ Element el = DOMUtils.getFirstElement(d.getDocumentElement());
+ while (el != null) {
+ if ("import".equals(el.getLocalName())
+ && StringUtils.isEmpty(el.getAttribute("targetNamespace"))) {
+ hasStuffToRemove = true;
+ break;
+ }
+ el = DOMUtils.getNextElement(el);
+ }
+ if (hasStuffToRemove) {
+ //create a copy of the dom so we
+ //can modify it.
+ d = copy(d);
+ el = DOMUtils.getFirstElement(d.getDocumentElement());
+ while (el != null) {
+ if ("import".equals(el.getLocalName())
+ && StringUtils.isEmpty(el.getAttribute("targetNamespace"))) {
+ d.getDocumentElement().removeChild(el);
+ el = DOMUtils.getFirstElement(d.getDocumentElement());
+ } else {
+ el = DOMUtils.getNextElement(el);
+ }
+ }
+ }
+
+ return d;
+ }
+
private Document copy(Document doc) {
try {
return StaxUtils.copy(doc);
Modified: cxf/branches/2.1.x-fixes/rt/testsupport/pom.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/testsupport/pom.xml?rev=691311&r1=691310&r2=691311&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/testsupport/pom.xml (original)
+++ cxf/branches/2.1.x-fixes/rt/testsupport/pom.xml Tue Sep 2 09:34:56 2008
@@ -11,7 +11,7 @@
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-parent</artifactId>
<version>2.1.3-SNAPSHOT</version>
- <relativePath>../parent/pom.xml</relativePath>
+ <relativePath>../../parent/pom.xml</relativePath>
</parent>
<dependencies>
Modified: cxf/branches/2.1.x-fixes/tools/javato/ws/pom.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/tools/javato/ws/pom.xml?rev=691311&r1=691310&r2=691311&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/tools/javato/ws/pom.xml (original)
+++ cxf/branches/2.1.x-fixes/tools/javato/ws/pom.xml Tue Sep 2 09:34:56 2008
@@ -29,7 +29,7 @@
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-parent</artifactId>
<version>2.1.3-SNAPSHOT</version>
- <relativePath>../../parent/pom.xml</relativePath>
+ <relativePath>../../../parent/pom.xml</relativePath>
</parent>
<dependencies>