Polish URL Cleanup
This commit is contained in:
@@ -45,11 +45,11 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
abstract class AbstractStaxXMLReader extends AbstractXMLReader {
|
||||
|
||||
private static final String NAMESPACES_FEATURE_NAME = "http://www.xml.org/sax/features/namespaces";
|
||||
private static final String NAMESPACES_FEATURE_NAME = "http://xml.org/sax/features/namespaces";
|
||||
|
||||
private static final String NAMESPACE_PREFIXES_FEATURE_NAME = "http://www.xml.org/sax/features/namespace-prefixes";
|
||||
private static final String NAMESPACE_PREFIXES_FEATURE_NAME = "http://xml.org/sax/features/namespace-prefixes";
|
||||
|
||||
private static final String IS_STANDALONE_FEATURE_NAME = "http://www.xml.org/sax/features/is-standalone";
|
||||
private static final String IS_STANDALONE_FEATURE_NAME = "http://xml.org/sax/features/is-standalone";
|
||||
|
||||
|
||||
private boolean namespacesFeature = true;
|
||||
@@ -101,14 +101,14 @@ abstract class AbstractStaxXMLReader extends AbstractXMLReader {
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the SAX feature {@code http://www.xml.org/sax/features/namespaces} is turned on.
|
||||
* Indicates whether the SAX feature {@code http://xml.org/sax/features/namespaces} is turned on.
|
||||
*/
|
||||
protected boolean hasNamespacesFeature() {
|
||||
return this.namespacesFeature;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the SAX feature {@code http://www.xml.org/sax/features/namespaces-prefixes} is turned on.
|
||||
* Indicates whether the SAX feature {@code http://xml.org/sax/features/namespaces-prefixes} is turned on.
|
||||
*/
|
||||
protected boolean hasNamespacePrefixesFeature() {
|
||||
return this.namespacePrefixesFeature;
|
||||
|
||||
@@ -109,12 +109,12 @@ abstract class AbstractXMLReader implements XMLReader {
|
||||
|
||||
/**
|
||||
* This implementation throws a {@code SAXNotRecognizedException} exception
|
||||
* for any feature outside of the "http://www.xml.org/sax/features/" namespace
|
||||
* for any feature outside of the "http://xml.org/sax/features/" namespace
|
||||
* and returns {@code false} for any feature within.
|
||||
*/
|
||||
@Override
|
||||
public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException {
|
||||
if (name.startsWith("http://www.xml.org/sax/features/")) {
|
||||
if (name.startsWith("http://xml.org/sax/features/")) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
@@ -124,12 +124,12 @@ abstract class AbstractXMLReader implements XMLReader {
|
||||
|
||||
/**
|
||||
* This implementation throws a {@code SAXNotRecognizedException} exception
|
||||
* for any feature outside of the "http://www.xml.org/sax/features/" namespace
|
||||
* for any feature outside of the "http://xml.org/sax/features/" namespace
|
||||
* and accepts a {@code false} value for any feature within.
|
||||
*/
|
||||
@Override
|
||||
public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException {
|
||||
if (name.startsWith("http://www.xml.org/sax/features/")) {
|
||||
if (name.startsWith("http://xml.org/sax/features/")) {
|
||||
if (value) {
|
||||
throw new SAXNotSupportedException(name);
|
||||
}
|
||||
@@ -141,12 +141,12 @@ abstract class AbstractXMLReader implements XMLReader {
|
||||
|
||||
/**
|
||||
* Throws a {@code SAXNotRecognizedException} exception when the given property does not signify a lexical
|
||||
* handler. The property name for a lexical handler is {@code http://www.xml.org/sax/properties/lexical-handler}.
|
||||
* handler. The property name for a lexical handler is {@code http://xml.org/sax/properties/lexical-handler}.
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException {
|
||||
if ("http://www.xml.org/sax/properties/lexical-handler".equals(name)) {
|
||||
if ("http://xml.org/sax/properties/lexical-handler".equals(name)) {
|
||||
return this.lexicalHandler;
|
||||
}
|
||||
else {
|
||||
@@ -156,11 +156,11 @@ abstract class AbstractXMLReader implements XMLReader {
|
||||
|
||||
/**
|
||||
* Throws a {@code SAXNotRecognizedException} exception when the given property does not signify a lexical
|
||||
* handler. The property name for a lexical handler is {@code http://www.xml.org/sax/properties/lexical-handler}.
|
||||
* handler. The property name for a lexical handler is {@code http://xml.org/sax/properties/lexical-handler}.
|
||||
*/
|
||||
@Override
|
||||
public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException {
|
||||
if ("http://www.xml.org/sax/properties/lexical-handler".equals(name)) {
|
||||
if ("http://xml.org/sax/properties/lexical-handler".equals(name)) {
|
||||
this.lexicalHandler = (LexicalHandler) value;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -76,10 +76,10 @@ public abstract class AbstractStaxHandlerTestCase {
|
||||
StringWriter stringWriter = new StringWriter();
|
||||
AbstractStaxHandler handler = createStaxHandler(new StreamResult(stringWriter));
|
||||
xmlReader.setContentHandler(handler);
|
||||
xmlReader.setProperty("http://www.xml.org/sax/properties/lexical-handler", handler);
|
||||
xmlReader.setProperty("http://xml.org/sax/properties/lexical-handler", handler);
|
||||
|
||||
xmlReader.setFeature("http://www.xml.org/sax/features/namespaces", true);
|
||||
xmlReader.setFeature("http://www.xml.org/sax/features/namespace-prefixes", false);
|
||||
xmlReader.setFeature("http://xml.org/sax/features/namespaces", true);
|
||||
xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", false);
|
||||
|
||||
xmlReader.parse(new InputSource(new StringReader(COMPLEX_XML)));
|
||||
|
||||
@@ -103,10 +103,10 @@ public abstract class AbstractStaxHandlerTestCase {
|
||||
StringWriter stringWriter = new StringWriter();
|
||||
AbstractStaxHandler handler = createStaxHandler(new StreamResult(stringWriter));
|
||||
xmlReader.setContentHandler(handler);
|
||||
xmlReader.setProperty("http://www.xml.org/sax/properties/lexical-handler", handler);
|
||||
xmlReader.setProperty("http://xml.org/sax/properties/lexical-handler", handler);
|
||||
|
||||
xmlReader.setFeature("http://www.xml.org/sax/features/namespaces", true);
|
||||
xmlReader.setFeature("http://www.xml.org/sax/features/namespace-prefixes", true);
|
||||
xmlReader.setFeature("http://xml.org/sax/features/namespaces", true);
|
||||
xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
|
||||
|
||||
xmlReader.parse(new InputSource(new StringReader(COMPLEX_XML)));
|
||||
|
||||
@@ -124,10 +124,10 @@ public abstract class AbstractStaxHandlerTestCase {
|
||||
Document result = documentBuilder.newDocument();
|
||||
AbstractStaxHandler handler = createStaxHandler(new DOMResult(result));
|
||||
xmlReader.setContentHandler(handler);
|
||||
xmlReader.setProperty("http://www.xml.org/sax/properties/lexical-handler", handler);
|
||||
xmlReader.setProperty("http://xml.org/sax/properties/lexical-handler", handler);
|
||||
|
||||
xmlReader.setFeature("http://www.xml.org/sax/features/namespaces", true);
|
||||
xmlReader.setFeature("http://www.xml.org/sax/features/namespace-prefixes", false);
|
||||
xmlReader.setFeature("http://xml.org/sax/features/namespaces", true);
|
||||
xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", false);
|
||||
|
||||
xmlReader.parse(new InputSource(new StringReader(SIMPLE_XML)));
|
||||
|
||||
@@ -145,10 +145,10 @@ public abstract class AbstractStaxHandlerTestCase {
|
||||
Document result = documentBuilder.newDocument();
|
||||
AbstractStaxHandler handler = createStaxHandler(new DOMResult(result));
|
||||
xmlReader.setContentHandler(handler);
|
||||
xmlReader.setProperty("http://www.xml.org/sax/properties/lexical-handler", handler);
|
||||
xmlReader.setProperty("http://xml.org/sax/properties/lexical-handler", handler);
|
||||
|
||||
xmlReader.setFeature("http://www.xml.org/sax/features/namespaces", true);
|
||||
xmlReader.setFeature("http://www.xml.org/sax/features/namespace-prefixes", true);
|
||||
xmlReader.setFeature("http://xml.org/sax/features/namespaces", true);
|
||||
xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
|
||||
|
||||
xmlReader.parse(new InputSource(new StringReader(SIMPLE_XML)));
|
||||
|
||||
|
||||
@@ -70,14 +70,14 @@ public abstract class AbstractStaxXMLReaderTestCase {
|
||||
|
||||
@Test
|
||||
public void contentHandlerNamespacesNoPrefixes() throws Exception {
|
||||
standardReader.setFeature("http://www.xml.org/sax/features/namespaces", true);
|
||||
standardReader.setFeature("http://www.xml.org/sax/features/namespace-prefixes", false);
|
||||
standardReader.setFeature("http://xml.org/sax/features/namespaces", true);
|
||||
standardReader.setFeature("http://xml.org/sax/features/namespace-prefixes", false);
|
||||
standardReader.parse(new InputSource(createTestInputStream()));
|
||||
|
||||
AbstractStaxXMLReader staxXmlReader = createStaxXmlReader(createTestInputStream());
|
||||
ContentHandler contentHandler = mockContentHandler();
|
||||
staxXmlReader.setFeature("http://www.xml.org/sax/features/namespaces", true);
|
||||
staxXmlReader.setFeature("http://www.xml.org/sax/features/namespace-prefixes", false);
|
||||
staxXmlReader.setFeature("http://xml.org/sax/features/namespaces", true);
|
||||
staxXmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", false);
|
||||
staxXmlReader.setContentHandler(contentHandler);
|
||||
staxXmlReader.parse(new InputSource());
|
||||
|
||||
@@ -86,14 +86,14 @@ public abstract class AbstractStaxXMLReaderTestCase {
|
||||
|
||||
@Test
|
||||
public void contentHandlerNamespacesPrefixes() throws Exception {
|
||||
standardReader.setFeature("http://www.xml.org/sax/features/namespaces", true);
|
||||
standardReader.setFeature("http://www.xml.org/sax/features/namespace-prefixes", true);
|
||||
standardReader.setFeature("http://xml.org/sax/features/namespaces", true);
|
||||
standardReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
|
||||
standardReader.parse(new InputSource(createTestInputStream()));
|
||||
|
||||
AbstractStaxXMLReader staxXmlReader = createStaxXmlReader(createTestInputStream());
|
||||
ContentHandler contentHandler = mockContentHandler();
|
||||
staxXmlReader.setFeature("http://www.xml.org/sax/features/namespaces", true);
|
||||
staxXmlReader.setFeature("http://www.xml.org/sax/features/namespace-prefixes", true);
|
||||
staxXmlReader.setFeature("http://xml.org/sax/features/namespaces", true);
|
||||
staxXmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
|
||||
staxXmlReader.setContentHandler(contentHandler);
|
||||
staxXmlReader.parse(new InputSource());
|
||||
|
||||
@@ -102,14 +102,14 @@ public abstract class AbstractStaxXMLReaderTestCase {
|
||||
|
||||
@Test
|
||||
public void contentHandlerNoNamespacesPrefixes() throws Exception {
|
||||
standardReader.setFeature("http://www.xml.org/sax/features/namespaces", false);
|
||||
standardReader.setFeature("http://www.xml.org/sax/features/namespace-prefixes", true);
|
||||
standardReader.setFeature("http://xml.org/sax/features/namespaces", false);
|
||||
standardReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
|
||||
standardReader.parse(new InputSource(createTestInputStream()));
|
||||
|
||||
AbstractStaxXMLReader staxXmlReader = createStaxXmlReader(createTestInputStream());
|
||||
ContentHandler contentHandler = mockContentHandler();
|
||||
staxXmlReader.setFeature("http://www.xml.org/sax/features/namespaces", false);
|
||||
staxXmlReader.setFeature("http://www.xml.org/sax/features/namespace-prefixes", true);
|
||||
staxXmlReader.setFeature("http://xml.org/sax/features/namespaces", false);
|
||||
staxXmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
|
||||
staxXmlReader.setContentHandler(contentHandler);
|
||||
staxXmlReader.parse(new InputSource());
|
||||
|
||||
@@ -141,10 +141,10 @@ public abstract class AbstractStaxXMLReaderTestCase {
|
||||
|
||||
LexicalHandler expectedLexicalHandler = mockLexicalHandler();
|
||||
standardReader.setContentHandler(null);
|
||||
standardReader.setProperty("http://www.xml.org/sax/properties/lexical-handler", expectedLexicalHandler);
|
||||
standardReader.setProperty("http://xml.org/sax/properties/lexical-handler", expectedLexicalHandler);
|
||||
standardReader.parse(new InputSource(testLexicalHandlerXml.getInputStream()));
|
||||
inputFactory.setProperty("javax.xml.stream.isCoalescing", Boolean.FALSE);
|
||||
inputFactory.setProperty("https://java.sun.com/xml/stream/properties/report-cdata-event", Boolean.TRUE);
|
||||
inputFactory.setProperty("http://java.sun.com/xml/stream/properties/report-cdata-event", Boolean.TRUE);
|
||||
inputFactory.setProperty("javax.xml.stream.isReplacingEntityReferences", Boolean.FALSE);
|
||||
inputFactory.setProperty("javax.xml.stream.isSupportingExternalEntities", Boolean.FALSE);
|
||||
|
||||
@@ -152,7 +152,7 @@ public abstract class AbstractStaxXMLReaderTestCase {
|
||||
willAnswer(invocation -> invocation.getArguments()[0] = "element").
|
||||
given(actualLexicalHandler).startDTD(anyString(), anyString(), anyString());
|
||||
AbstractStaxXMLReader staxXmlReader = createStaxXmlReader(testLexicalHandlerXml.getInputStream());
|
||||
staxXmlReader.setProperty("http://www.xml.org/sax/properties/lexical-handler", actualLexicalHandler);
|
||||
staxXmlReader.setProperty("http://xml.org/sax/properties/lexical-handler", actualLexicalHandler);
|
||||
staxXmlReader.parse(new InputSource());
|
||||
|
||||
// TODO: broken comparison since Mockito 2.2 upgrade
|
||||
|
||||
@@ -72,7 +72,7 @@ public class DomContentHandlerTests {
|
||||
|
||||
@Test
|
||||
public void contentHandlerDocumentNamespacePrefixes() throws Exception {
|
||||
xmlReader.setFeature("http://www.xml.org/sax/features/namespace-prefixes", true);
|
||||
xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
|
||||
handler = new DomContentHandler(result);
|
||||
expected = documentBuilder.parse(new InputSource(new StringReader(XML_1)));
|
||||
xmlReader.setContentHandler(handler);
|
||||
|
||||
Reference in New Issue
Block a user