diff --git a/spring-core/src/main/java/org/springframework/util/xml/TransformerUtils.java b/spring-core/src/main/java/org/springframework/util/xml/TransformerUtils.java index 5e65536847..42d881490b 100644 --- a/spring-core/src/main/java/org/springframework/util/xml/TransformerUtils.java +++ b/spring-core/src/main/java/org/springframework/util/xml/TransformerUtils.java @@ -54,15 +54,15 @@ public abstract class TransformerUtils { * Enable indenting for the supplied {@link javax.xml.transform.Transformer}. *
If the underlying XSLT engine is Xalan, then the special output key {@code indent-amount} * will be also be set to a value of {@link #DEFAULT_INDENT_AMOUNT} characters. - * @param transformer the target transformer - * @param indentAmount the size of the indent (2 characters, 3 characters, etc.) + * @param transformer the target transformer + * @param indentAmount the size of the indent (2 characters, 3 characters, etc) * @see javax.xml.transform.Transformer#setOutputProperty(String, String) * @see javax.xml.transform.OutputKeys#INDENT */ public static void enableIndenting(Transformer transformer, int indentAmount) { Assert.notNull(transformer, "Transformer must not be null"); if (indentAmount < 0) { - throw new IllegalArgumentException("The indent amount cannot be less than zero : got " + indentAmount); + throw new IllegalArgumentException("Invalid indent amount (must not be less than zero): " + indentAmount); } transformer.setOutputProperty(OutputKeys.INDENT, "yes"); try { diff --git a/spring-oxm/src/main/java/org/springframework/oxm/jaxb/Jaxb2Marshaller.java b/spring-oxm/src/main/java/org/springframework/oxm/jaxb/Jaxb2Marshaller.java index f17eee0a34..88f65e0bd5 100644 --- a/spring-oxm/src/main/java/org/springframework/oxm/jaxb/Jaxb2Marshaller.java +++ b/spring-oxm/src/main/java/org/springframework/oxm/jaxb/Jaxb2Marshaller.java @@ -555,9 +555,8 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, Generi xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true); for (int i = 0; i < resources.length; i++) { Resource resource = resources[i]; - Assert.notNull(resource, "Resource is null"); - if (!resource.exists()) { - throw new IllegalArgumentException("Resource " + resource + " does not exist"); + if (resource == null || !resource.exists()) { + throw new IllegalArgumentException("Resource does not exist: " + resource); } InputSource inputSource = SaxResourceUtils.createInputSource(resource); schemaSources[i] = new SAXSource(xmlReader, inputSource); @@ -572,8 +571,8 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, Generi @Override public boolean supports(Class> clazz) { - return ((this.supportJaxbElementClass && JAXBElement.class.isAssignableFrom(clazz)) || - supportsInternal(clazz, this.checkForXmlRootElement)); + return (this.supportJaxbElementClass && JAXBElement.class.isAssignableFrom(clazz)) || + supportsInternal(clazz, this.checkForXmlRootElement); } @Override