Browse Source

Polishing

pull/1270/merge
Juergen Hoeller 8 years ago
parent
commit
8a7467020f
  1. 38
      spring-core/src/test/java/org/springframework/util/xml/AbstractStaxHandlerTestCase.java
  2. 5
      spring-core/src/test/java/org/springframework/util/xml/StaxEventHandlerTests.java
  3. 5
      spring-core/src/test/java/org/springframework/util/xml/StaxStreamHandlerTests.java
  4. 3
      spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/AbstractHandlerMethodMapping.java
  5. 6
      spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMethodMapping.java

38
spring-core/src/test/java/org/springframework/util/xml/AbstractStaxHandlerTestCase.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -16,6 +16,16 @@ @@ -16,6 +16,16 @@
package org.springframework.util.xml;
import java.io.StringReader;
import java.io.StringWriter;
import java.net.Socket;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.transform.Result;
import javax.xml.transform.dom.DOMResult;
import javax.xml.transform.stream.StreamResult;
import org.junit.Assume;
import org.junit.Before;
import org.junit.Test;
@ -26,19 +36,8 @@ import org.xml.sax.XMLReader; @@ -26,19 +36,8 @@ import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory;
import org.xmlunit.util.Predicate;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.transform.Result;
import javax.xml.transform.dom.DOMResult;
import javax.xml.transform.stream.StreamResult;
import java.io.StringReader;
import java.io.StringWriter;
import java.net.Socket;
import static org.junit.Assert.assertThat;
import static org.xmlunit.matchers.CompareMatcher.isSimilarTo;
import static org.junit.Assert.*;
import static org.xmlunit.matchers.CompareMatcher.*;
/**
* @author Arjen Poutsma
@ -57,17 +56,18 @@ public abstract class AbstractStaxHandlerTestCase { @@ -57,17 +56,18 @@ public abstract class AbstractStaxHandlerTestCase {
"<?pi content?><root xmlns='namespace'><prefix:child xmlns:prefix='namespace2' prefix:attr='value'>content</prefix:child>" +
"</root>";
private static final Predicate<Node> nodeFilter = (n -> n.getNodeType() != Node.COMMENT_NODE &&
n.getNodeType() != Node.DOCUMENT_TYPE_NODE && n.getNodeType() != Node.PROCESSING_INSTRUCTION_NODE);
private XMLReader xmlReader;
private Predicate<Node> nodeFilter = n -> n.getNodeType() != Node.COMMENT_NODE
&& n.getNodeType() != Node.DOCUMENT_TYPE_NODE && n.getNodeType() != Node.PROCESSING_INSTRUCTION_NODE;
@Before
public void createXMLReader() throws Exception {
xmlReader = XMLReaderFactory.createXMLReader();
}
@Test
public void noNamespacePrefixes() throws Exception {
Assume.assumeTrue(wwwSpringframeworkOrgIsAccessible());
@ -114,8 +114,7 @@ public abstract class AbstractStaxHandlerTestCase { @@ -114,8 +114,7 @@ public abstract class AbstractStaxHandlerTestCase {
@Test
public void noNamespacePrefixesDom() throws Exception {
DocumentBuilderFactory documentBuilderFactory =
DocumentBuilderFactory.newInstance();
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setNamespaceAware(true);
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
@ -136,8 +135,7 @@ public abstract class AbstractStaxHandlerTestCase { @@ -136,8 +135,7 @@ public abstract class AbstractStaxHandlerTestCase {
@Test
public void namespacePrefixesDom() throws Exception {
DocumentBuilderFactory documentBuilderFactory =
DocumentBuilderFactory.newInstance();
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setNamespaceAware(true);
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();

5
spring-core/src/test/java/org/springframework/util/xml/StaxEventHandlerTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -27,8 +27,7 @@ import javax.xml.transform.Result; @@ -27,8 +27,7 @@ import javax.xml.transform.Result;
public class StaxEventHandlerTests extends AbstractStaxHandlerTestCase {
@Override
protected AbstractStaxHandler createStaxHandler(Result result)
throws XMLStreamException {
protected AbstractStaxHandler createStaxHandler(Result result) throws XMLStreamException {
XMLOutputFactory outputFactory = XMLOutputFactory.newFactory();
XMLEventWriter eventWriter = outputFactory.createXMLEventWriter(result);
return new StaxEventHandler(eventWriter);

5
spring-core/src/test/java/org/springframework/util/xml/StaxStreamHandlerTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -27,8 +27,7 @@ import javax.xml.transform.Result; @@ -27,8 +27,7 @@ import javax.xml.transform.Result;
public class StaxStreamHandlerTests extends AbstractStaxHandlerTestCase {
@Override
protected AbstractStaxHandler createStaxHandler(Result result)
throws XMLStreamException {
protected AbstractStaxHandler createStaxHandler(Result result) throws XMLStreamException {
XMLOutputFactory outputFactory = XMLOutputFactory.newFactory();
XMLStreamWriter streamWriter = outputFactory.createXMLStreamWriter(result);
return new StaxStreamHandler(streamWriter);

3
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/AbstractHandlerMethodMapping.java

@ -439,8 +439,7 @@ public abstract class AbstractHandlerMethodMapping<T> extends AbstractHandlerMap @@ -439,8 +439,7 @@ public abstract class AbstractHandlerMethodMapping<T> extends AbstractHandlerMap
private final MultiValueMap<String, T> urlLookup = new LinkedMultiValueMap<>();
private final Map<HandlerMethod, CorsConfiguration> corsLookup =
new ConcurrentHashMap<>();
private final Map<HandlerMethod, CorsConfiguration> corsLookup = new ConcurrentHashMap<>();
private final ReentrantReadWriteLock readWriteLock = new ReentrantReadWriteLock();

6
spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMethodMapping.java

@ -480,11 +480,9 @@ public abstract class AbstractHandlerMethodMapping<T> extends AbstractHandlerMap @@ -480,11 +480,9 @@ public abstract class AbstractHandlerMethodMapping<T> extends AbstractHandlerMap
private final MultiValueMap<String, T> urlLookup = new LinkedMultiValueMap<>();
private final Map<String, List<HandlerMethod>> nameLookup =
new ConcurrentHashMap<>();
private final Map<String, List<HandlerMethod>> nameLookup = new ConcurrentHashMap<>();
private final Map<HandlerMethod, CorsConfiguration> corsLookup =
new ConcurrentHashMap<>();
private final Map<HandlerMethod, CorsConfiguration> corsLookup = new ConcurrentHashMap<>();
private final ReentrantReadWriteLock readWriteLock = new ReentrantReadWriteLock();

Loading…
Cancel
Save