Refined exception messages
This commit is contained in:
@@ -54,15 +54,15 @@ public abstract class TransformerUtils {
|
||||
* Enable indenting for the supplied {@link javax.xml.transform.Transformer}.
|
||||
* <p>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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user