Skip to content

Commit 4a6d227

Browse files
authored
Fix #194: remove QNameCreator helper class (#195)
1 parent 5a03810 commit 4a6d227

File tree

9 files changed

+13
-92
lines changed

9 files changed

+13
-92
lines changed

release-notes/VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Project: woodstox
77
7.0.0 (not yet released)
88

99
#134: Increase JDK baseline to Java 8
10+
#194: Remove `QNameCreator` compatibility class
1011

1112
6.6.0 (15-Jan-2024)
1213

src/main/java/com/ctc/wstx/compat/QNameCreator.java

Lines changed: 0 additions & 70 deletions
This file was deleted.

src/main/java/com/ctc/wstx/compat/package.html

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/main/java/com/ctc/wstx/sr/Attribute.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717

1818
import javax.xml.namespace.QName;
1919

20-
import com.ctc.wstx.compat.QNameCreator;
21-
2220
/**
2321
* Container for information collected regarding a single element
2422
* attribute instance. Used for both regular explicit attributes
@@ -133,8 +131,7 @@ public QName getQName()
133131
if (uri == null) { // Some QName impls (older JDKs) don't like nulls
134132
uri = "";
135133
}
136-
// For [WSTX-174] need to use indirection:
137-
return QNameCreator.create(uri, mLocalName, mPrefix);
134+
return new QName(uri, mLocalName, mPrefix);
138135
}
139136

140137
/**

src/main/java/com/ctc/wstx/sr/InputElementStack.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
import com.ctc.wstx.api.WstxInputProperties;
3535
import com.ctc.wstx.cfg.ErrorConsts;
3636
import com.ctc.wstx.cfg.XmlConsts;
37-
import com.ctc.wstx.compat.QNameCreator;
3837
import com.ctc.wstx.dtd.DTDValidatorBase; // unfortunate dependency
3938
import com.ctc.wstx.util.*;
4039

@@ -829,7 +828,7 @@ public final QName getCurrentElementName()
829828
} else {
830829
return mLastName;
831830
}
832-
QName n = QNameCreator.create(nsURI, ln, prefix);
831+
QName n = new QName(nsURI, ln, prefix);
833832
mLastName = n;
834833
return n;
835834
}

src/main/java/com/ctc/wstx/stax/WstxEventFactory.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import aQute.bnd.annotation.spi.ServiceProvider;
2626
import org.codehaus.stax2.ri.Stax2EventFactoryImpl;
2727

28-
import com.ctc.wstx.compat.QNameCreator;
2928
import com.ctc.wstx.evt.*;
3029

3130
/**
@@ -106,8 +105,7 @@ protected QName createQName(String nsURI, String localName) {
106105

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

113111
/**

src/main/java/com/ctc/wstx/sw/RepairingNsStreamWriter.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,8 @@ public void writeStartElement(StartElement elem)
236236
QName name = elem.getName();
237237
writeStartElement(name.getPrefix(), name.getLocalPart(),
238238
name.getNamespaceURI());
239-
Iterator<Attribute> it = elem.getAttributes();
239+
@SuppressWarnings("unchecked")
240+
Iterator<Attribute> it = (Iterator<Attribute>) elem.getAttributes();
240241
while (it.hasNext()) {
241242
Attribute attr = it.next();
242243
name = attr.getName();

src/main/java/com/ctc/wstx/sw/SimpleNsStreamWriter.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@ public void doSetPrefix(String prefix, String uri) throws XMLStreamException
163163
public void writeStartElement(StartElement elem) throws XMLStreamException
164164
{
165165
QName name = elem.getName();
166-
Iterator<Namespace> it = elem.getNamespaces();
166+
@SuppressWarnings("unchecked")
167+
Iterator<Namespace> it = (Iterator<Namespace>) elem.getNamespaces();
167168

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

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

209211

210212
// And finally, need to output attributes as well:
211-
Iterator<Attribute> ait = elem.getAttributes();
213+
@SuppressWarnings("unchecked")
214+
Iterator<Attribute> ait = (Iterator<Attribute>)elem.getAttributes();
212215
while (ait.hasNext()) {
213216
Attribute attr = ait.next();
214217
name = attr.getName();

src/main/java/com/ctc/wstx/sw/SimpleOutputElement.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import javax.xml.namespace.QName;
2222
import javax.xml.stream.XMLStreamException;
2323

24-
import com.ctc.wstx.compat.QNameCreator;
2524
import com.ctc.wstx.util.BijectiveNsMap;
2625

2726
/**
@@ -249,7 +248,7 @@ public QName getName() {
249248
if (mPrefix == null) {
250249
return new QName(mURI, mLocalName);
251250
}
252-
return QNameCreator.create(mURI, mLocalName, mPrefix);
251+
return new QName(mURI, mLocalName, mPrefix);
253252
}
254253

255254
/*

0 commit comments

Comments
 (0)