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