Skip to content

Commit

Permalink
Fix #194: remove QNameCreator helper class (#195)
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Feb 5, 2024
1 parent 5a03810 commit 4a6d227
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 92 deletions.
1 change: 1 addition & 0 deletions release-notes/VERSION
Expand Up @@ -7,6 +7,7 @@ Project: woodstox
7.0.0 (not yet released)

#134: Increase JDK baseline to Java 8
#194: Remove `QNameCreator` compatibility class

6.6.0 (15-Jan-2024)

Expand Down
70 changes: 0 additions & 70 deletions src/main/java/com/ctc/wstx/compat/QNameCreator.java

This file was deleted.

7 changes: 0 additions & 7 deletions src/main/java/com/ctc/wstx/compat/package.html

This file was deleted.

5 changes: 1 addition & 4 deletions src/main/java/com/ctc/wstx/sr/Attribute.java
Expand Up @@ -17,8 +17,6 @@

import javax.xml.namespace.QName;

import com.ctc.wstx.compat.QNameCreator;

/**
* Container for information collected regarding a single element
* attribute instance. Used for both regular explicit attributes
Expand Down Expand Up @@ -133,8 +131,7 @@ public QName getQName()
if (uri == null) { // Some QName impls (older JDKs) don't like nulls
uri = "";
}
// For [WSTX-174] need to use indirection:
return QNameCreator.create(uri, mLocalName, mPrefix);
return new QName(uri, mLocalName, mPrefix);
}

/**
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/ctc/wstx/sr/InputElementStack.java
Expand Up @@ -34,7 +34,6 @@
import com.ctc.wstx.api.WstxInputProperties;
import com.ctc.wstx.cfg.ErrorConsts;
import com.ctc.wstx.cfg.XmlConsts;
import com.ctc.wstx.compat.QNameCreator;
import com.ctc.wstx.dtd.DTDValidatorBase; // unfortunate dependency
import com.ctc.wstx.util.*;

Expand Down Expand Up @@ -829,7 +828,7 @@ public final QName getCurrentElementName()
} else {
return mLastName;
}
QName n = QNameCreator.create(nsURI, ln, prefix);
QName n = new QName(nsURI, ln, prefix);
mLastName = n;
return n;
}
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/com/ctc/wstx/stax/WstxEventFactory.java
Expand Up @@ -25,7 +25,6 @@
import aQute.bnd.annotation.spi.ServiceProvider;
import org.codehaus.stax2.ri.Stax2EventFactoryImpl;

import com.ctc.wstx.compat.QNameCreator;
import com.ctc.wstx.evt.*;

/**
Expand Down Expand Up @@ -106,8 +105,7 @@ protected QName createQName(String nsURI, String localName) {

@Override
protected QName createQName(String nsURI, String localName, String prefix) {
// [WSTX-174]: some old app servers missing 3-arg QName ctor
return QNameCreator.create(nsURI, localName, prefix);
return new QName(nsURI, localName, prefix);
}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/ctc/wstx/sw/RepairingNsStreamWriter.java
Expand Up @@ -236,7 +236,8 @@ public void writeStartElement(StartElement elem)
QName name = elem.getName();
writeStartElement(name.getPrefix(), name.getLocalPart(),
name.getNamespaceURI());
Iterator<Attribute> it = elem.getAttributes();
@SuppressWarnings("unchecked")
Iterator<Attribute> it = (Iterator<Attribute>) elem.getAttributes();
while (it.hasNext()) {
Attribute attr = it.next();
name = attr.getName();
Expand Down
9 changes: 6 additions & 3 deletions src/main/java/com/ctc/wstx/sw/SimpleNsStreamWriter.java
Expand Up @@ -163,7 +163,8 @@ public void doSetPrefix(String prefix, String uri) throws XMLStreamException
public void writeStartElement(StartElement elem) throws XMLStreamException
{
QName name = elem.getName();
Iterator<Namespace> it = elem.getNamespaces();
@SuppressWarnings("unchecked")
Iterator<Namespace> it = (Iterator<Namespace>) elem.getNamespaces();

while (it.hasNext()) {
Namespace ns = it.next();
Expand Down Expand Up @@ -195,7 +196,8 @@ public void writeStartElement(StartElement elem) throws XMLStreamException
}

// And now we need to output namespaces (including default), if any:
Iterator<Namespace> it2 = elem.getNamespaces();
@SuppressWarnings("unchecked")
Iterator<Namespace> it2 = (Iterator<Namespace>) elem.getNamespaces();
while (it2.hasNext()) {
Namespace ns = it2.next();
String prefix = ns.getPrefix();
Expand All @@ -208,7 +210,8 @@ public void writeStartElement(StartElement elem) throws XMLStreamException


// And finally, need to output attributes as well:
Iterator<Attribute> ait = elem.getAttributes();
@SuppressWarnings("unchecked")
Iterator<Attribute> ait = (Iterator<Attribute>)elem.getAttributes();
while (ait.hasNext()) {
Attribute attr = ait.next();
name = attr.getName();
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/ctc/wstx/sw/SimpleOutputElement.java
Expand Up @@ -21,7 +21,6 @@
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamException;

import com.ctc.wstx.compat.QNameCreator;
import com.ctc.wstx.util.BijectiveNsMap;

/**
Expand Down Expand Up @@ -249,7 +248,7 @@ public QName getName() {
if (mPrefix == null) {
return new QName(mURI, mLocalName);
}
return QNameCreator.create(mURI, mLocalName, mPrefix);
return new QName(mURI, mLocalName, mPrefix);
}

/*
Expand Down

0 comments on commit 4a6d227

Please sign in to comment.