From eaf8712b2a4fc65c4b974c7e6d0769914af7e073 Mon Sep 17 00:00:00 2001 From: retgal Date: Thu, 22 Feb 2024 16:41:19 +0100 Subject: [PATCH] Fix code smells --- src/main/java/mpo/dayon/common/network/NetworkEngine.java | 2 +- .../java/mpo/dayon/common/network/TransferableImage.java | 1 - .../network/message/NetworkClipboardGraphicMessage.java | 5 +---- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/main/java/mpo/dayon/common/network/NetworkEngine.java b/src/main/java/mpo/dayon/common/network/NetworkEngine.java index 6f397928..1b047fec 100644 --- a/src/main/java/mpo/dayon/common/network/NetworkEngine.java +++ b/src/main/java/mpo/dayon/common/network/NetworkEngine.java @@ -27,7 +27,7 @@ public abstract class NetworkEngine { protected static final String UNSUPPORTED_TYPE = "Unsupported message type [%s]!"; - private final static String CLIPBOARD_DEBUG = "setClipboardContents %s"; + private static final String CLIPBOARD_DEBUG = "setClipboardContents %s"; protected NetworkSender sender; // out diff --git a/src/main/java/mpo/dayon/common/network/TransferableImage.java b/src/main/java/mpo/dayon/common/network/TransferableImage.java index 3aa39d19..3bce6267 100644 --- a/src/main/java/mpo/dayon/common/network/TransferableImage.java +++ b/src/main/java/mpo/dayon/common/network/TransferableImage.java @@ -27,7 +27,6 @@ private void writeObject(ObjectOutputStream out) throws IOException { private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); - Log.info(String.valueOf(in)); image = ImageIO.read(in); } diff --git a/src/main/java/mpo/dayon/common/network/message/NetworkClipboardGraphicMessage.java b/src/main/java/mpo/dayon/common/network/message/NetworkClipboardGraphicMessage.java index 4205921a..9cbf4e00 100644 --- a/src/main/java/mpo/dayon/common/network/message/NetworkClipboardGraphicMessage.java +++ b/src/main/java/mpo/dayon/common/network/message/NetworkClipboardGraphicMessage.java @@ -1,6 +1,5 @@ package mpo.dayon.common.network.message; -import mpo.dayon.common.log.Log; import mpo.dayon.common.network.TransferableImage; import java.awt.datatransfer.DataFlavor; @@ -20,9 +19,7 @@ public NetworkClipboardGraphicMessage(TransferableImage payload) { } public static NetworkClipboardGraphicMessage unmarshall(ObjectInputStream in) throws IOException, ClassNotFoundException { - Log.info("unmarshall " +in); - TransferableImage graphic = (TransferableImage) in.readObject(); - Log.info("unmarshall " +graphic); + TransferableImage graphic = (TransferableImage) in.readUnshared(); return new NetworkClipboardGraphicMessage(graphic); }