diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/compiler/support/ClassUtils.java b/dubbo-common/src/main/java/org/apache/dubbo/common/compiler/support/ClassUtils.java index 40c050f79e5..b76eaea5ffb 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/compiler/support/ClassUtils.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/compiler/support/ClassUtils.java @@ -79,7 +79,7 @@ public static Class forName(String className) { } public static Class _forName(String className) throws ClassNotFoundException { - switch(className){ + switch (className) { case "boolean": return boolean.class; case "byte": @@ -112,6 +112,7 @@ public static Class _forName(String className) throws ClassNotFoundException return float[].class; case "double[]": return double[].class; + default: } try { return arrayForName(className); diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/json/JSON.java b/dubbo-common/src/main/java/org/apache/dubbo/common/json/JSON.java index 1d3aa8891d2..0903cfbc869 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/json/JSON.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/json/JSON.java @@ -579,6 +579,7 @@ private static Object parse(Reader reader, JSONVisitor handler, int expect) thro handler.objectItemValue(value, false); break; } + default: } } break; @@ -629,6 +630,7 @@ private static Object parse(Reader reader, JSONVisitor handler, int expect) thro handler.objectItemValue(value, false); break; } + default: } } break; diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/json/JSONWriter.java b/dubbo-common/src/main/java/org/apache/dubbo/common/json/JSONWriter.java index 094832134c0..6c6bf09c0fe 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/json/JSONWriter.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/json/JSONWriter.java @@ -275,6 +275,7 @@ private void beforeValue() throws IOException { case OBJECT_VALUE: mState.type = OBJECT; return; + default: } } diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/json/Yylex.java b/dubbo-common/src/main/java/org/apache/dubbo/common/json/Yylex.java index 8abb42d1ab2..822175e6031 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/json/Yylex.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/json/Yylex.java @@ -837,6 +837,7 @@ public JSONToken yylex() throws java.io.IOException, ParseException { return null; } else { zzScanError(ZZ_NO_MATCH); + break; } } } diff --git a/dubbo-rpc/dubbo-rpc-thrift/src/main/java/org/apache/dubbo/rpc/protocol/thrift/ThriftCodec.java b/dubbo-rpc/dubbo-rpc-thrift/src/main/java/org/apache/dubbo/rpc/protocol/thrift/ThriftCodec.java index 02c0699af2c..d171ce12435 100644 --- a/dubbo-rpc/dubbo-rpc-thrift/src/main/java/org/apache/dubbo/rpc/protocol/thrift/ThriftCodec.java +++ b/dubbo-rpc/dubbo-rpc-thrift/src/main/java/org/apache/dubbo/rpc/protocol/thrift/ThriftCodec.java @@ -66,11 +66,12 @@ *

* header fields in version 1 *

    - *
  1. string - service name
  2. - *
  3. long - dubbo request id
  4. + *
  5. string - service name
  6. + *
  7. long - dubbo request id
  8. *
*

*/ + /** * @since 2.7.0, use https://github.com/dubbo/dubbo-rpc-native-thrift instead */ @@ -108,7 +109,7 @@ public void encode(Channel channel, ChannelBuffer buffer, Object message) } else if (message instanceof Response) { encodeResponse(channel, buffer, (Response) message); } else { - throw new UnsupportedOperationException("Thrift codec only support encode " + throw new UnsupportedOperationException("Thrift codec only support encode " + Request.class.getName() + " and " + Response.class.getName()); } @@ -299,7 +300,7 @@ private Object decode(TProtocol protocol) .getExtension(ThriftClassNameGenerator.NAME).generateResultClassName(serviceName, message.name); if (StringUtils.isEmpty(resultClassName)) { - throw new IllegalArgumentException("Could not infer service result class name from service name " + throw new IllegalArgumentException("Could not infer service result class name from service name " + serviceName + ", the service name you specified may not generated by thrift idl compiler"); } @@ -401,7 +402,7 @@ private void encodeRequest(Channel channel, ChannelBuffer buffer, Request reques String serviceName = inv.getAttachment(Constants.INTERFACE_KEY); if (StringUtils.isEmpty(serviceName)) { - throw new IllegalArgumentException("Could not find service name in attachment with key " + throw new IllegalArgumentException("Could not find service name in attachment with key " + Constants.INTERFACE_KEY); } @@ -667,6 +668,7 @@ private void encodeResponse(Channel channel, ChannelBuffer buffer, Response resp case TMessageType.REPLY: resultObj.write(protocol); break; + default: } protocol.writeMessageEnd(); protocol.getTransport().flush();