未验证 提交 f37dc187 编写于 作者: L Lunaticf 提交者: GitHub

Fix some code style issue and remove redundant code (#1378)

Co-authored-by: Ncenter-liu <liu.chaofan@foxmail.com>
上级 18dadebe
......@@ -193,7 +193,7 @@ public class RemoteAddressStrategyFactory {
throw new AclException(String.format("RangeRemoteAddressStrategy netaddress examine scope Exception start is %s , end is %s", start, end));
}
}
return this.end > 0 ? true : false;
return this.end > 0;
}
private boolean ipv6Analysis(String[] strArray, int index) {
......
......@@ -17,9 +17,9 @@
package org.apache.rocketmq.broker.mqtrace;
public interface SendMessageHook {
public String hookName();
String hookName();
public void sendMessageBefore(final SendMessageContext context);
void sendMessageBefore(final SendMessageContext context);
public void sendMessageAfter(final SendMessageContext context);
void sendMessageAfter(final SendMessageContext context);
}
......@@ -124,7 +124,7 @@ public class BrokerOuterAPITest {
boolean success = Iterables.any(booleanList,
new Predicate<Boolean>() {
public boolean apply(Boolean input) {
return input ? true : false;
return input;
}
});
......
......@@ -20,7 +20,7 @@ package org.apache.rocketmq.common.hook;
import java.nio.ByteBuffer;
public interface FilterCheckHook {
public String hookName();
String hookName();
public boolean isFilterMatched(final boolean isUnitMode, final ByteBuffer byteBuffer);
boolean isFilterMatched(final boolean isUnitMode, final ByteBuffer byteBuffer);
}
......@@ -36,8 +36,8 @@ public class SimpleCharStream {
* Position in buffer.
*/
public int bufpos = -1;
protected int bufline[];
protected int bufcolumn[];
protected int[] bufline;
protected int[] bufcolumn;
protected int column = 0;
protected int line = 1;
......@@ -62,8 +62,8 @@ public class SimpleCharStream {
protected void ExpandBuff(boolean wrapAround) {
char[] newbuffer = new char[bufsize + 2048];
int newbufline[] = new int[bufsize + 2048];
int newbufcolumn[] = new int[bufsize + 2048];
int[] newbufline = new int[bufsize + 2048];
int[] newbufcolumn = new int[bufsize + 2048];
try {
if (wrapAround) {
......
......@@ -116,7 +116,6 @@ public class Level implements Serializable {
if (s.equals(OFF_NAME)) {
return Level.OFF;
}
if (s.equals(INFO_NAME)) {
return Level.INFO;
}
......
......@@ -33,7 +33,7 @@ public class FileUtil {
this.fileName = fileName;
}
public static void main(String args[]) {
public static void main(String[] args) {
String filePath = FileUtil.class.getResource("/").getPath();
String fileName = "test.txt";
FileUtil fileUtil = new FileUtil(filePath, fileName);
......
......@@ -76,7 +76,7 @@ public class MQWait {
}
}
public static void main(String args[]) {
public static void main(String[] args) {
long start = System.currentTimeMillis();
MQWait.setCondition(new Condition() {
......
......@@ -100,14 +100,14 @@ public final class RandomUtil {
return n + res % (m - n);
}
private static char getChar(int arg[]) {
private static char getChar(int[] arg) {
int size = arg.length;
int c = rd.nextInt(size / 2);
c = c * 2;
return (char) (getIntegerBetween(arg[c], arg[c + 1]));
}
private static String getString(int n, int arg[]) {
private static String getString(int n, int[] arg) {
StringBuilder res = new StringBuilder();
for (int i = 0; i < n; i++) {
res.append(getChar(arg));
......@@ -116,17 +116,17 @@ public final class RandomUtil {
}
public static String getStringWithCharacter(int n) {
int arg[] = new int[] {'a', 'z' + 1, 'A', 'Z' + 1};
int[] arg = new int[] {'a', 'z' + 1, 'A', 'Z' + 1};
return getString(n, arg);
}
public static String getStringWithNumber(int n) {
int arg[] = new int[] {'0', '9' + 1};
int[] arg = new int[] {'0', '9' + 1};
return getString(n, arg);
}
public static String getStringWithNumAndCha(int n) {
int arg[] = new int[] {'a', 'z' + 1, 'A', 'Z' + 1, '0', '9' + 1};
int[] arg = new int[] {'a', 'z' + 1, 'A', 'Z' + 1, '0', '9' + 1};
return getString(n, arg);
}
......
......@@ -45,16 +45,16 @@ public class RandomUtils {
}
public static String getStringWithNumber(int n) {
int arg[] = new int[] {'0', '9' + 1};
int[] arg = new int[] {'0', '9' + 1};
return getString(n, arg);
}
public static String getStringWithCharacter(int n) {
int arg[] = new int[] {'a', 'z' + 1, 'A', 'Z' + 1};
int[] arg = new int[] {'a', 'z' + 1, 'A', 'Z' + 1};
return getString(n, arg);
}
private static String getString(int n, int arg[]) {
private static String getString(int n, int[] arg) {
StringBuilder res = new StringBuilder();
for (int i = 0; i < n; i++) {
res.append(getChar(arg));
......@@ -62,7 +62,7 @@ public class RandomUtils {
return res.toString();
}
private static char getChar(int arg[]) {
private static char getChar(int[] arg) {
int size = arg.length;
int c = rd.nextInt(size / 2);
c = c * 2;
......
......@@ -140,7 +140,7 @@ public class VerifyUtils {
return rtExpect;
}
public static void main(String args[]) {
public static void main(String[] args) {
verifyBalance(400, 0.1f, 230, 190);
}
}
......@@ -92,7 +92,7 @@ public class MulTagSubIT extends BaseConf {
@Test
public void testSubTwoTabAndMatchTwo() {
String tags[] = {"jueyin1", "jueyin2"};
String[] tags = {"jueyin1", "jueyin2"};
String subExpress = String.format("%s||%s", tags[0], tags[1]);
int msgSize = 10;
......@@ -113,7 +113,7 @@ public class MulTagSubIT extends BaseConf {
@Test
public void testSubThreeTabAndMatchTwo() {
String tags[] = {"jueyin1", "jueyin2", "jueyin3"};
String[] tags = {"jueyin1", "jueyin2", "jueyin3"};
String subExpress = String.format("%s||%s", tags[0], tags[1]);
int msgSize = 10;
......@@ -135,7 +135,7 @@ public class MulTagSubIT extends BaseConf {
@Test
public void testNoMatch() {
String tags[] = {"jueyin1", "jueyin2", "jueyin3"};
String[] tags = {"jueyin1", "jueyin2", "jueyin3"};
String subExpress = "no_match";
int msgSize = 10;
......
......@@ -84,7 +84,7 @@ public class TagMessageWithMulConsumerIT extends BaseConf {
@Test
public void testSendMessagesWithTwoTag() {
String tags[] = {"jueyin1", "jueyin2"};
String[] tags = {"jueyin1", "jueyin2"};
int msgSize = 10;
TagMessage tagMessage = new TagMessage(tags, topic, msgSize);
......@@ -113,7 +113,7 @@ public class TagMessageWithMulConsumerIT extends BaseConf {
@Test
public void testTwoConsumerOneMatchOneOtherMatchAll() {
String tags[] = {"jueyin1", "jueyin2"};
String[] tags = {"jueyin1", "jueyin2"};
String sub1 = String.format("%s||%s", tags[0], tags[1]);
String sub2 = String.format("%s|| noExist", tags[0]);
int msgSize = 10;
......@@ -144,7 +144,7 @@ public class TagMessageWithMulConsumerIT extends BaseConf {
@Test
public void testSubKindsOf() {
String tags[] = {"jueyin1", "jueyin2"};
String[] tags = {"jueyin1", "jueyin2"};
String sub1 = String.format("%s||%s", tags[0], tags[1]);
String sub2 = String.format("%s|| noExist", tags[0]);
String sub3 = tags[0];
......
......@@ -38,7 +38,7 @@ import org.apache.rocketmq.tools.command.SubCommandException;
public class CLusterSendMsgRTCommand implements SubCommand {
public static void main(String args[]) {
public static void main(String[] args) {
}
@Override
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册