Skip to content

Commit 9348cb8

Browse files
authored
Refactor Duplicate literal (#17632)
1 parent 7b61793 commit 9348cb8

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/TElasticFramedTransport.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ public TElasticFramedTransport(
9999
protected AutoScalingBufferWriteTransport writeBuffer;
100100
protected final byte[] i32buf = new byte[4];
101101
private final boolean copyBinary;
102+
private static final String FROM = " from ";
102103

103104
@Override
104105
public boolean isOpen() {
@@ -164,7 +165,7 @@ public int read(byte[] buf, int off, int len) throws TTransportException {
164165
"You may be sending non-SSL requests"
165166
+ "%s to the SSL-enabled Thrift-RPC port, please confirm that you are "
166167
+ "using the right configuration",
167-
remoteAddress == null ? "" : " from " + remoteAddress));
168+
remoteAddress == null ? "" : FROM + remoteAddress));
168169
}
169170
throw e;
170171
}
@@ -209,7 +210,7 @@ protected void validateFrame(int size) throws TTransportException {
209210
if (underlying instanceof TSocket) {
210211
remoteAddress = ((TSocket) underlying).getSocket().getRemoteSocketAddress();
211212
}
212-
String remoteInfo = (remoteAddress == null) ? "" : " from " + remoteAddress;
213+
String remoteInfo = (remoteAddress == null) ? "" : FROM + remoteAddress;
213214
close();
214215

215216
error.throwException(size, remoteInfo, thriftMaxFrameSize);
@@ -289,7 +290,7 @@ public void checkReadBytesAvailable(long numBytes) throws TTransportException {
289290
if (underlying instanceof TSocket) {
290291
remoteAddress = ((TSocket) underlying).getSocket().getRemoteSocketAddress();
291292
}
292-
String remoteInfo = (remoteAddress == null) ? "" : " from " + remoteAddress;
293+
String remoteInfo = (remoteAddress == null) ? "" : FROM + remoteAddress;
293294
close();
294295
FrameError.STRING_LENGTH_EXCEEDED.throwException(numBytes, remoteInfo, thriftMaxFrameSize);
295296
}

0 commit comments

Comments
 (0)