Skip to content

Commit ddb518d

Browse files
x-ultimateralf0131
authored andcommitted
Code rule (#3016)
1 parent f36bed9 commit ddb518d

File tree

5 files changed

+13
-6
lines changed

5 files changed

+13
-6
lines changed

dubbo-common/src/main/java/org/apache/dubbo/common/compiler/support/ClassUtils.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public static Class<?> forName(String className) {
7979
}
8080

8181
public static Class<?> _forName(String className) throws ClassNotFoundException {
82-
switch(className){
82+
switch (className) {
8383
case "boolean":
8484
return boolean.class;
8585
case "byte":
@@ -112,6 +112,7 @@ public static Class<?> _forName(String className) throws ClassNotFoundException
112112
return float[].class;
113113
case "double[]":
114114
return double[].class;
115+
default:
115116
}
116117
try {
117118
return arrayForName(className);

dubbo-common/src/main/java/org/apache/dubbo/common/json/JSON.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,7 @@ private static Object parse(Reader reader, JSONVisitor handler, int expect) thro
579579
handler.objectItemValue(value, false);
580580
break;
581581
}
582+
default:
582583
}
583584
}
584585
break;
@@ -629,6 +630,7 @@ private static Object parse(Reader reader, JSONVisitor handler, int expect) thro
629630
handler.objectItemValue(value, false);
630631
break;
631632
}
633+
default:
632634
}
633635
}
634636
break;

dubbo-common/src/main/java/org/apache/dubbo/common/json/JSONWriter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ private void beforeValue() throws IOException {
275275
case OBJECT_VALUE:
276276
mState.type = OBJECT;
277277
return;
278+
default:
278279
}
279280
}
280281

dubbo-common/src/main/java/org/apache/dubbo/common/json/Yylex.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -837,6 +837,7 @@ public JSONToken yylex() throws java.io.IOException, ParseException {
837837
return null;
838838
} else {
839839
zzScanError(ZZ_NO_MATCH);
840+
break;
840841
}
841842
}
842843
}

dubbo-rpc/dubbo-rpc-thrift/src/main/java/org/apache/dubbo/rpc/protocol/thrift/ThriftCodec.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,12 @@
6666
* <p>
6767
* <b>header fields in version 1</b>
6868
* <ol>
69-
* <li>string - service name</li>
70-
* <li>long - dubbo request id</li>
69+
* <li>string - service name</li>
70+
* <li>long - dubbo request id</li>
7171
* </ol>
7272
* </p>
7373
*/
74+
7475
/**
7576
* @since 2.7.0, use https://github.com/dubbo/dubbo-rpc-native-thrift instead
7677
*/
@@ -108,7 +109,7 @@ public void encode(Channel channel, ChannelBuffer buffer, Object message)
108109
} else if (message instanceof Response) {
109110
encodeResponse(channel, buffer, (Response) message);
110111
} else {
111-
throw new UnsupportedOperationException("Thrift codec only support encode "
112+
throw new UnsupportedOperationException("Thrift codec only support encode "
112113
+ Request.class.getName() + " and " + Response.class.getName());
113114
}
114115

@@ -299,7 +300,7 @@ private Object decode(TProtocol protocol)
299300
.getExtension(ThriftClassNameGenerator.NAME).generateResultClassName(serviceName, message.name);
300301

301302
if (StringUtils.isEmpty(resultClassName)) {
302-
throw new IllegalArgumentException("Could not infer service result class name from service name "
303+
throw new IllegalArgumentException("Could not infer service result class name from service name "
303304
+ serviceName + ", the service name you specified may not generated by thrift idl compiler");
304305
}
305306

@@ -401,7 +402,7 @@ private void encodeRequest(Channel channel, ChannelBuffer buffer, Request reques
401402
String serviceName = inv.getAttachment(Constants.INTERFACE_KEY);
402403

403404
if (StringUtils.isEmpty(serviceName)) {
404-
throw new IllegalArgumentException("Could not find service name in attachment with key "
405+
throw new IllegalArgumentException("Could not find service name in attachment with key "
405406
+ Constants.INTERFACE_KEY);
406407
}
407408

@@ -667,6 +668,7 @@ private void encodeResponse(Channel channel, ChannelBuffer buffer, Response resp
667668
case TMessageType.REPLY:
668669
resultObj.write(protocol);
669670
break;
671+
default:
670672
}
671673
protocol.writeMessageEnd();
672674
protocol.getTransport().flush();

0 commit comments

Comments
 (0)