This is an automated email from the ASF dual-hosted git repository.
huxing pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git
The following commit(s) were added to refs/heads/master by this push:
new ddb518d Code rule (#3016)
ddb518d is described below
commit ddb518de3ab3b54ec4b6a8a52db6cde1b3f58262
Author: Wang jie <[email protected]>
AuthorDate: Fri Jan 4 23:42:01 2019 +0800
Code rule (#3016)
---
.../org/apache/dubbo/common/compiler/support/ClassUtils.java | 3 ++-
.../src/main/java/org/apache/dubbo/common/json/JSON.java | 2 ++
.../main/java/org/apache/dubbo/common/json/JSONWriter.java | 1 +
.../src/main/java/org/apache/dubbo/common/json/Yylex.java | 1 +
.../org/apache/dubbo/rpc/protocol/thrift/ThriftCodec.java | 12 +++++++-----
5 files changed, 13 insertions(+), 6 deletions(-)
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 e4db9a8..1c55208 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 class ClassUtils {
}
public static Class<?> _forName(String className) throws
ClassNotFoundException {
- switch(className){
+ switch (className) {
case "boolean":
return boolean.class;
case "byte":
@@ -112,6 +112,7 @@ public class ClassUtils {
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 1d3aa88..0903cfb 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 @@ public class JSON {
handler.objectItemValue(value, false);
break;
}
+ default:
}
}
break;
@@ -629,6 +630,7 @@ public class JSON {
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 0948321..6c6bf09 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 @@ public class JSONWriter {
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 8abb42d..822175e 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 class Yylex {
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 02c0699..d171ce1 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 @@ import java.util.concurrent.atomic.AtomicInteger;
* <p>
* <b>header fields in version 1</b>
* <ol>
- * <li>string - service name</li>
- * <li>long - dubbo request id</li>
+ * <li>string - service name</li>
+ * <li>long - dubbo request id</li>
* </ol>
* </p>
*/
+
/**
* @since 2.7.0, use https://github.com/dubbo/dubbo-rpc-native-thrift instead
*/
@@ -108,7 +109,7 @@ public class ThriftCodec implements Codec2 {
} 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 @@ public class ThriftCodec implements Codec2 {
.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 @@ public class ThriftCodec implements Codec2 {
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 @@ public class ThriftCodec implements Codec2 {
case TMessageType.REPLY:
resultObj.write(protocol);
break;
+ default:
}
protocol.writeMessageEnd();
protocol.getTransport().flush();