Polishing

This commit is contained in:
Juergen Hoeller
2018-02-13 14:20:07 +01:00
parent f93ca28884
commit 0030ff8711
12 changed files with 83 additions and 62 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 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.
@@ -554,9 +554,12 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, Generi
XMLReader xmlReader = XMLReaderFactory.createXMLReader();
xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
for (int i = 0; i < resources.length; i++) {
Assert.notNull(resources[i], "Resource is null");
Assert.isTrue(resources[i].exists(), "Resource " + resources[i] + " does not exist");
InputSource inputSource = SaxResourceUtils.createInputSource(resources[i]);
Resource resource = resources[i];
Assert.notNull(resource, "Resource is null");
if (!resource.exists()) {
throw new IllegalArgumentException("Resource " + resource + " does not exist");
}
InputSource inputSource = SaxResourceUtils.createInputSource(resource);
schemaSources[i] = new SAXSource(xmlReader, inputSource);
}
SchemaFactory schemaFactory = SchemaFactory.newInstance(schemaLanguage);
@@ -1031,12 +1034,12 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, Generi
}
@Override
public InputStream getInputStream() throws IOException {
public InputStream getInputStream() {
return new ByteArrayInputStream(this.data, this.offset, this.length);
}
@Override
public OutputStream getOutputStream() throws IOException {
public OutputStream getOutputStream() {
throw new UnsupportedOperationException();
}