You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2020/10/25 14:46:23 UTC
[commons-lang] 03/06: Suppress warning and add comment;
use a simpler error messgae.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git
commit 4d066361c022b5d3339548b1c423a049e83b4252
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Oct 25 10:31:35 2020 -0400
Suppress warning and add comment; use a simpler error messgae.
---
src/main/java/org/apache/commons/lang3/SerializationUtils.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/SerializationUtils.java b/src/main/java/org/apache/commons/lang3/SerializationUtils.java
index 8e8ead5..3b316a1 100644
--- a/src/main/java/org/apache/commons/lang3/SerializationUtils.java
+++ b/src/main/java/org/apache/commons/lang3/SerializationUtils.java
@@ -207,8 +207,9 @@ public class SerializationUtils {
* @throws NullPointerException if {@code inputStream} is {@code null}
* @throws SerializationException (runtime) if the serialization fails
*/
+ @SuppressWarnings("resource") // inputStream is managed by the caller
public static <T> T deserialize(final InputStream inputStream) {
- Validate.notNull(inputStream, "The InputStream must not be null");
+ Validate.notNull(inputStream, "inputStream");
try (ObjectInputStream in = new ObjectInputStream(inputStream)) {
@SuppressWarnings("unchecked")
final T obj = (T) in.readObject();
@@ -263,8 +264,9 @@ public class SerializationUtils {
* @throws NullPointerException if {@code outputStream} is {@code null}
* @throws SerializationException (runtime) if the serialization fails
*/
+ @SuppressWarnings("resource") // outputStream is managed by the caller
public static void serialize(final Serializable obj, final OutputStream outputStream) {
- Validate.notNull(outputStream, "The OutputStream must not be null");
+ Validate.notNull(outputStream, "outputStream");
try (ObjectOutputStream out = new ObjectOutputStream(outputStream)) {
out.writeObject(obj);
} catch (final IOException ex) {