Browse Source

Declare ClassLoader for DeserializingConverter constructor as nullable

Closes gh-30670
pull/30724/head
Juergen Hoeller 1 year ago
parent
commit
b9221656cc
  1. 3
      spring-core/src/main/java/org/springframework/core/serializer/DefaultDeserializer.java
  2. 6
      spring-core/src/main/java/org/springframework/core/serializer/support/DeserializingConverter.java

3
spring-core/src/main/java/org/springframework/core/serializer/DefaultDeserializer.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 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.
@ -50,6 +50,7 @@ public class DefaultDeserializer implements Deserializer<Object> { @@ -50,6 +50,7 @@ public class DefaultDeserializer implements Deserializer<Object> {
/**
* Create a {@code DefaultDeserializer} for using an {@link ObjectInputStream}
* with the given {@code ClassLoader}.
* @param classLoader the ClassLoader to use
* @since 4.2.1
* @see ConfigurableObjectInputStream#ConfigurableObjectInputStream(InputStream, ClassLoader)
*/

6
spring-core/src/main/java/org/springframework/core/serializer/support/DeserializingConverter.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2023 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.
@ -21,6 +21,7 @@ import java.io.ByteArrayInputStream; @@ -21,6 +21,7 @@ import java.io.ByteArrayInputStream;
import org.springframework.core.convert.converter.Converter;
import org.springframework.core.serializer.DefaultDeserializer;
import org.springframework.core.serializer.Deserializer;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
/**
@ -50,10 +51,11 @@ public class DeserializingConverter implements Converter<byte[], Object> { @@ -50,10 +51,11 @@ public class DeserializingConverter implements Converter<byte[], Object> {
/**
* Create a {@code DeserializingConverter} for using an {@link java.io.ObjectInputStream}
* with the given {@code ClassLoader}.
* @param classLoader the ClassLoader to use
* @since 4.2.1
* @see DefaultDeserializer#DefaultDeserializer(ClassLoader)
*/
public DeserializingConverter(ClassLoader classLoader) {
public DeserializingConverter(@Nullable ClassLoader classLoader) {
this.deserializer = new DefaultDeserializer(classLoader);
}

Loading…
Cancel
Save