Add more @Nullable parameters based on null usage

Issue: SPR-15540
This commit is contained in:
Sebastien Deleuze
2017-05-31 21:35:52 +02:00
parent f9b319d3ba
commit 1f28825f9d
219 changed files with 441 additions and 355 deletions

View File

@@ -666,7 +666,7 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, Generi
}
@Override
public void marshal(Object graph, Result result, MimeContainer mimeContainer) throws XmlMappingException {
public void marshal(Object graph, Result result, @Nullable MimeContainer mimeContainer) throws XmlMappingException {
try {
Marshaller marshaller = createMarshaller();
if (this.mtomEnabled && mimeContainer != null) {
@@ -753,7 +753,7 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, Generi
}
@Override
public Object unmarshal(Source source, MimeContainer mimeContainer) throws XmlMappingException {
public Object unmarshal(Source source, @Nullable MimeContainer mimeContainer) throws XmlMappingException {
source = processSource(source);
try {

View File

@@ -19,6 +19,7 @@ package org.springframework.oxm.mime;
import java.io.IOException;
import javax.xml.transform.Result;
import org.springframework.lang.Nullable;
import org.springframework.oxm.Marshaller;
import org.springframework.oxm.XmlMappingException;
@@ -42,6 +43,6 @@ public interface MimeMarshaller extends Marshaller {
* @throws XmlMappingException if the given object cannot be marshalled to the result
* @throws IOException if an I/O exception occurs
*/
void marshal(Object graph, Result result, MimeContainer mimeContainer) throws XmlMappingException, IOException;
void marshal(Object graph, Result result, @Nullable MimeContainer mimeContainer) throws XmlMappingException, IOException;
}

View File

@@ -19,6 +19,7 @@ package org.springframework.oxm.mime;
import java.io.IOException;
import javax.xml.transform.Source;
import org.springframework.lang.Nullable;
import org.springframework.oxm.Unmarshaller;
import org.springframework.oxm.XmlMappingException;
@@ -42,6 +43,6 @@ public interface MimeUnmarshaller extends Unmarshaller {
* @throws XmlMappingException if the given source cannot be mapped to an object
* @throws IOException if an I/O Exception occurs
*/
Object unmarshal(Source source, MimeContainer mimeContainer) throws XmlMappingException, IOException;
Object unmarshal(Source source, @Nullable MimeContainer mimeContainer) throws XmlMappingException, IOException;
}

View File

@@ -677,7 +677,7 @@ public class XStreamMarshaller extends AbstractMarshaller implements BeanClassLo
marshalOutputStream(graph, outputStream, null);
}
public void marshalOutputStream(Object graph, OutputStream outputStream, DataHolder dataHolder)
public void marshalOutputStream(Object graph, OutputStream outputStream, @Nullable DataHolder dataHolder)
throws XmlMappingException, IOException {
if (this.streamDriver != null) {
@@ -693,7 +693,7 @@ public class XStreamMarshaller extends AbstractMarshaller implements BeanClassLo
marshalWriter(graph, writer, null);
}
public void marshalWriter(Object graph, Writer writer, DataHolder dataHolder)
public void marshalWriter(Object graph, Writer writer, @Nullable DataHolder dataHolder)
throws XmlMappingException, IOException {
if (this.streamDriver != null) {
@@ -708,7 +708,7 @@ public class XStreamMarshaller extends AbstractMarshaller implements BeanClassLo
* Marshals the given graph to the given XStream HierarchicalStreamWriter.
* Converts exceptions using {@link #convertXStreamException}.
*/
private void doMarshal(Object graph, HierarchicalStreamWriter streamWriter, DataHolder dataHolder) {
private void doMarshal(Object graph, HierarchicalStreamWriter streamWriter, @Nullable DataHolder dataHolder) {
try {
getXStream().marshal(graph, streamWriter, dataHolder);
}
@@ -785,7 +785,7 @@ public class XStreamMarshaller extends AbstractMarshaller implements BeanClassLo
return unmarshalInputStream(inputStream, null);
}
public Object unmarshalInputStream(InputStream inputStream, DataHolder dataHolder) throws XmlMappingException, IOException {
public Object unmarshalInputStream(InputStream inputStream, @Nullable DataHolder dataHolder) throws XmlMappingException, IOException {
if (this.streamDriver != null) {
return doUnmarshal(this.streamDriver.createReader(inputStream), dataHolder);
}
@@ -799,7 +799,7 @@ public class XStreamMarshaller extends AbstractMarshaller implements BeanClassLo
return unmarshalReader(reader, null);
}
public Object unmarshalReader(Reader reader, DataHolder dataHolder) throws XmlMappingException, IOException {
public Object unmarshalReader(Reader reader, @Nullable DataHolder dataHolder) throws XmlMappingException, IOException {
return doUnmarshal(getDefaultDriver().createReader(reader), dataHolder);
}
@@ -807,7 +807,7 @@ public class XStreamMarshaller extends AbstractMarshaller implements BeanClassLo
* Unmarshals the given graph to the given XStream HierarchicalStreamWriter.
* Converts exceptions using {@link #convertXStreamException}.
*/
private Object doUnmarshal(HierarchicalStreamReader streamReader, DataHolder dataHolder) {
private Object doUnmarshal(HierarchicalStreamReader streamReader, @Nullable DataHolder dataHolder) {
try {
return getXStream().unmarshal(streamReader, null, dataHolder);
}