Skip to content

Commit 613613b

Browse files
committed
Try another exception instead of EOF
1 parent 492c4ae commit 613613b

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryIoSession.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ public class TcpDiscoveryIoSession {
6767
/** */
6868
private final TcpDiscoverySpi spi;
6969

70+
/** Loads discovery messages classes during java deserialization. */
71+
private final ClassLoader clsLdr;
72+
7073
/** */
7174
private final Socket sock;
7275

@@ -96,6 +99,8 @@ public class TcpDiscoveryIoSession {
9699
this.sock = sock;
97100
this.spi = spi;
98101

102+
clsLdr = U.resolveClassLoader(spi.ignite().configuration());
103+
99104
msgBuf = ByteBuffer.allocate(MSG_BUFFER_SIZE);
100105

101106
msgWriter = new DirectMessageWriter(spi.messageFactory());
@@ -155,13 +160,13 @@ <T> T readMessage() throws IgniteCheckedException, IOException {
155160
byte serMode = (byte)in.read();
156161

157162
if (JAVA_SERIALIZATION == serMode)
158-
return U.unmarshal(spi.marshaller(), in, spi.classLoader());
163+
return U.unmarshal(spi.marshaller(), in, clsLdr);
159164

160165
try {
161166
if (MESSAGE_SERIALIZATION != serMode) {
162167
detectSslAlert(serMode, in);
163168

164-
throw new EOFException();
169+
throw new IgniteCheckedException("Received unexpected byte while reading discovery message: " + serMode);
165170
}
166171

167172
byte b0 = (byte)in.read();

modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2425,13 +2425,6 @@ protected Marshaller marshaller() {
24252425
return marsh;
24262426
}
24272427

2428-
/**
2429-
* @return Ignite class loader.
2430-
*/
2431-
ClassLoader classLoader() {
2432-
return U.resolveClassLoader(ignite.configuration());
2433-
}
2434-
24352428
/** {@inheritDoc} */
24362429
@Override public TcpDiscoverySpi setName(String name) {
24372430
super.setName(name);

0 commit comments

Comments
 (0)