Clean up warnings across code base

This commit is contained in:
Sam Brannen
2017-01-07 01:44:55 +01:00
parent 055da43e30
commit 9ed66bf2eb
51 changed files with 167 additions and 214 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@@ -544,7 +544,6 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, Generi
}
}
@SuppressWarnings("deprecation")
private Schema loadSchema(Resource[] resources, String schemaLanguage) throws IOException, SAXException {
if (logger.isDebugEnabled()) {
logger.debug("Setting validation schema to " +
@@ -805,7 +804,6 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, Generi
}
}
@SuppressWarnings("deprecation")
private Source processSource(Source source) {
if (StaxUtils.isStaxSource(source) || source instanceof DOMSource) {
return source;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@@ -183,7 +183,6 @@ public abstract class AbstractMarshaller implements Marshaller, Unmarshaller {
* @return the XMLReader
* @throws SAXException if thrown by JAXP methods
*/
@SuppressWarnings("deprecation")
protected XMLReader createXmlReader() throws SAXException {
XMLReader xmlReader = org.xml.sax.helpers.XMLReaderFactory.createXMLReader();
xmlReader.setFeature("http://apache.org/xml/features/disallow-doctype-decl", !isSupportDtd());

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@@ -32,7 +32,6 @@ import static org.junit.Assert.*;
* @author Jakub Narloch
* @author Sam Brannen
*/
@SuppressWarnings("deprecation")
public class OxmNamespaceHandlerTests {
private final ApplicationContext applicationContext =

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@@ -34,9 +34,6 @@ import org.xml.sax.Attributes;
import org.xml.sax.ContentHandler;
import org.xml.sax.InputSource;
import org.xml.sax.Locator;
import org.xmlunit.diff.Comparison;
import org.xmlunit.diff.ComparisonResult;
import org.xmlunit.diff.ComparisonType;
import org.xmlunit.diff.DifferenceEvaluator;
import javax.activation.DataHandler;
@@ -55,9 +52,7 @@ import java.io.StringWriter;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.util.Arrays;
import java.util.Collections;
import java.util.EnumSet;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@@ -56,6 +56,7 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -69,6 +70,7 @@ import static org.xmlunit.matchers.CompareMatcher.isSimilarTo;
/**
* @author Arjen Poutsma
* @author Sam Brannen
*/
public class XStreamMarshallerTests {
@@ -350,25 +352,20 @@ public class XStreamMarshallerTests {
private static void assertXpathExists(String xPathExpression, String inXMLString){
Source source = Input.fromString(inXMLString).build();
Iterable<Node> nodes = new JAXPXPathEngine().selectNodes(xPathExpression, source);
assertNotNull(nodes);
int count = 0;
for (Node node : nodes){
count++;
}
assertTrue("Expecting to find matches for Xpath " + xPathExpression, count > 0);
assertTrue("Expecting to find matches for Xpath " + xPathExpression, count(nodes) > 0);
}
private static void assertXpathNotExists(String xPathExpression, String inXMLString){
Source source = Input.fromString(inXMLString).build();
Iterable<Node> nodes = new JAXPXPathEngine().selectNodes(xPathExpression, source);
assertNotNull(nodes);
int count = 0;
for (Node node : nodes){
count++;
}
assertEquals("Should be zero matches for Xpath " + xPathExpression, 0, count);
assertEquals("Should be zero matches for Xpath " + xPathExpression, 0, count(nodes));
}
private static int count(Iterable<Node> nodes) {
assertNotNull(nodes);
AtomicInteger count = new AtomicInteger();
nodes.forEach(n -> count.incrementAndGet());
return count.get();
}
}