When input is already utf8, you should take advantage of it to avoid string split and string decoding.
@@ -57,21 +57,21 @@ public class RPCSendV2 extends RPCSend {
.returnDesc(5, "body_payload", "Slime encoded body payload.");
return method;
}
- private static final String VERSION_F = new String("version");
- private static final String ROUTE_F = new String("route");
- private static final String SESSION_F = new String("session");
- private static final String PROTOCOL_F = new String("prot");
- private static final String TRACELEVEL_F = new String("tracelevel");
- private static final String TRACE_F = new String("trace");
- private static final String USERETRY_F = new String("useretry");
- private static final String RETRY_F = new String("retry");
- private static final String RETRYDELAY_F = new String("retrydelay");
- private static final String TIMEREMAINING_F = new String("timeleft");
- private static final String ERRORS_F = new String("errors");
- private static final String SERVICE_F = new String("service");
- private static final String CODE_F = new String("code");
- private static final String BLOB_F = new String("msg");
- private static final String MSG_F = new String("msg");
+ private static final String VERSION_F = "version";
+ private static final String ROUTE_F = "route";
+ private static final String SESSION_F = "session";
+ private static final String PROTOCOL_F = "prot";
+ private static final String TRACELEVEL_F = "tracelevel";
+ private static final String TRACE_F = "trace";
+ private static final String USERETRY_F = "useretry";
+ private static final String RETRY_F = "retry";
+ private static final String RETRYDELAY_F = "retrydelay";
+ private static final String TIMEREMAINING_F = "timeleft";
+ private static final String ERRORS_F = "errors";
+ private static final String SERVICE_F = "service";
+ private static final String CODE_F = "code";
+ private static final String BLOB_F = "msg";
+ private static final String MSG_F = "msg";
@Override
protected Request encodeRequest(Version version, Route route, RPCServiceAddress address, Message msg,
@@ -115,7 +115,7 @@ public class RPCSendV2 extends RPCSend {
Slime slime = BinaryFormat.decode(slimeBytes);
Inspector root = slime.get();
- Version version = new Version(root.field(VERSION_F).asString());
+ Version version = new Version(new Utf8Array(root.field(VERSION_F).asUtf8()));
byte[] payload = root.field(BLOB_F).asData();
// Make sure that the owner understands the protocol.
@@ -156,7 +156,7 @@ public class RPCSendV2 extends RPCSend {
Slime slime = BinaryFormat.decode(slimeBytes);
Inspector root = slime.get();
Params p = new Params();
- p.version = new Version(root.field(VERSION_F).asString());
+ p.version = new Version(new Utf8Array(root.field(VERSION_F).asUtf8()));
p.route = root.field(ROUTE_F).asString();
p.session = root.field(SESSION_F).asString();
p.retryEnabled = root.field(USERETRY_F).asBool();
