Skip to content

Commit

Permalink
Code rule (#3016)
Browse files Browse the repository at this point in the history
  • Loading branch information
x-ultimate authored and ralf0131 committed Jan 4, 2019
1 parent f36bed9 commit ddb518d
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,7 @@ private static Object parse(Reader reader, JSONVisitor handler, int expect) thro
handler.objectItemValue(value, false);
break;
}
default:
}
}
break;
Expand Down Expand Up @@ -629,6 +630,7 @@ private static Object parse(Reader reader, JSONVisitor handler, int expect) thro
handler.objectItemValue(value, false);
break;
}
default:
}
}
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ private void beforeValue() throws IOException {
case OBJECT_VALUE:
mState.type = OBJECT;
return;
default:
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,7 @@ public JSONToken yylex() throws java.io.IOException, ParseException {
return null;
} else {
zzScanError(ZZ_NO_MATCH);
break;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,12 @@
* <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
*/
Expand Down Expand Up @@ -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());
}

Expand Down Expand Up @@ -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");
}

Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit ddb518d

Please sign in to comment.