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 2009/11/12 23:48:30 UTC
svn commit: r835619 - in /cxf/branches/2.2.x-fixes: ./
common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java
Author: dkulp
Date: Thu Nov 12 22:48:29 2009
New Revision: 835619
URL: http://svn.apache.org/viewvc?rev=835619&view=rev
Log:
Merged revisions 835613,835615,835617 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r835613 | dkulp | 2009-11-12 17:36:27 -0500 (Thu, 12 Nov 2009) | 3 lines
Use a new string to make sure the doc doesn't hold onto things strongly
Don't wrapper the woodstox locator objects to make sure they aren't held
onto strongly
........
r835615 | dkulp | 2009-11-12 17:43:06 -0500 (Thu, 12 Nov 2009) | 1 line
Add some NPE checks
........
r835617 | dkulp | 2009-11-12 17:46:36 -0500 (Thu, 12 Nov 2009) | 1 line
Minor simplification
........
Modified:
cxf/branches/2.2.x-fixes/ (props changed)
cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java
Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
svn:mergeinfo = /cxf/trunk:835613-835617
Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java?rev=835619&r1=835618&r2=835619&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java (original)
+++ cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java Thu Nov 12 22:48:29 2009
@@ -737,13 +737,13 @@
}
public static Document read(XMLStreamReader reader) throws XMLStreamException {
- Document doc = DOMUtils.createDocument();
- readDocElements(doc, reader, true);
- return doc;
+ return read(reader, false);
}
public static Document read(XMLStreamReader reader, boolean recordLoc) throws XMLStreamException {
Document doc = DOMUtils.createDocument();
- doc.setDocumentURI(reader.getLocation().getSystemId());
+ if (reader.getLocation().getSystemId() != null) {
+ doc.setDocumentURI(new String(reader.getLocation().getSystemId()));
+ }
readDocElements(doc, doc, reader, true, recordLoc);
return doc;
}
@@ -751,7 +751,9 @@
public static Document read(DocumentBuilder builder, XMLStreamReader reader, boolean repairing)
throws XMLStreamException {
Document doc = builder.newDocument();
- doc.setDocumentURI(reader.getLocation().getSystemId());
+ if (reader.getLocation().getSystemId() != null) {
+ doc.setDocumentURI(new String(reader.getLocation().getSystemId()));
+ }
readDocElements(doc, reader, repairing);
return doc;
}
@@ -893,34 +895,33 @@
}
}
}
- private static void addLocation(final Document doc, Node node,
- XMLStreamReader reader, boolean recordLoc) {
+ private static void addLocation(Document doc, Node node,
+ XMLStreamReader reader,
+ boolean recordLoc) {
if (recordLoc) {
- final Location loc = reader.getLocation();
+ Location loc = reader.getLocation();
if (loc != null && (loc.getColumnNumber() != 0 || loc.getLineNumber() != 0)) {
+ final int charOffset = loc.getCharacterOffset();
+ final int colNum = loc.getColumnNumber();
+ final int linNum = loc.getLineNumber();
+ final String pubId = loc.getPublicId() == null ? doc.getDocumentURI() : loc.getPublicId();
+ final String sysId = loc.getSystemId() == null ? doc.getDocumentURI() : loc.getSystemId();
Location loc2 = new Location() {
public int getCharacterOffset() {
- return loc.getCharacterOffset();
+ return charOffset;
}
public int getColumnNumber() {
- return loc.getColumnNumber();
+ return colNum;
}
public int getLineNumber() {
- return loc.getLineNumber();
+ return linNum;
}
public String getPublicId() {
- if (loc.getPublicId() == null) {
- return doc.getDocumentURI();
- }
- return loc.getPublicId();
+ return pubId;
}
public String getSystemId() {
- if (loc.getSystemId() == null) {
- return doc.getDocumentURI();
- }
- return loc.getSystemId();
+ return sysId;
}
-
};
node.setUserData("location", loc2, new UserDataHandler() {
public void handle(short operation, String key, Object data, Node src, Node dst) {
@@ -945,16 +946,18 @@
node.setAttributeNodeNS(attr);
}
public static XMLStreamReader createXMLStreamReader(InputSource src) {
+ String sysId = src.getSystemId() == null ? null : new String(src.getSystemId());
+ String pubId = src.getPublicId() == null ? null : new String(src.getPublicId());
if (src.getByteStream() != null) {
if (src.getEncoding() == null) {
- StreamSource ss = new StreamSource(src.getByteStream(), src.getSystemId());
- ss.setPublicId(src.getPublicId());
+ StreamSource ss = new StreamSource(src.getByteStream(), sysId);
+ ss.setPublicId(pubId);
return createXMLStreamReader(ss);
}
return createXMLStreamReader(src.getByteStream(), src.getEncoding());
} else if (src.getCharacterStream() != null) {
- StreamSource ss = new StreamSource(src.getCharacterStream(), src.getSystemId());
- ss.setPublicId(src.getPublicId());
+ StreamSource ss = new StreamSource(src.getCharacterStream(), sysId);
+ ss.setPublicId(pubId);
return createXMLStreamReader(ss);
}
throw new IllegalArgumentException("InputSource must have a ByteStream or CharacterStream");
Modified: cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java?rev=835619&r1=835618&r2=835619&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java (original)
+++ cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java Thu Nov 12 22:48:29 2009
@@ -215,7 +215,9 @@
Document doc;
try {
doc = StaxUtils.read(StaxUtils.createXMLStreamReader(src), true);
- doc.setDocumentURI(src.getSystemId());
+ if (src.getSystemId() != null) {
+ doc.setDocumentURI(new String(src.getSystemId()));
+ }
} catch (Exception e) {
throw new WSDLException(WSDLException.PARSER_ERROR, e.getMessage(), e);
}