Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
Rocketmq
提交
44bdeeda
R
Rocketmq
项目概览
s920243400
/
Rocketmq
与 Fork 源项目一致
Fork自
Apache RocketMQ / Rocketmq
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rocketmq
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
未验证
提交
44bdeeda
编写于
8月 04, 2021
作者:
G
gorden5566
提交者:
GitHub
8月 04, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[ISSUE 3203] Replace the class 'StringBuffer' by 'StringBuilder' (#3204)
上级
3a2b1726
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
54 addition
and
21 deletion
+54
-21
acl/src/main/java/org/apache/rocketmq/acl/plain/RemoteAddressStrategyFactory.java
...ache/rocketmq/acl/plain/RemoteAddressStrategyFactory.java
+1
-1
common/src/main/java/org/apache/rocketmq/common/UtilAll.java
common/src/main/java/org/apache/rocketmq/common/UtilAll.java
+2
-2
common/src/main/java/org/apache/rocketmq/common/message/Message.java
...main/java/org/apache/rocketmq/common/message/Message.java
+7
-4
common/src/main/java/org/apache/rocketmq/common/protocol/NamespaceUtil.java
...va/org/apache/rocketmq/common/protocol/NamespaceUtil.java
+1
-1
common/src/test/java/org/apache/rocketmq/common/UtilAllTest.java
...src/test/java/org/apache/rocketmq/common/UtilAllTest.java
+13
-0
common/src/test/java/org/apache/rocketmq/common/utils/IOTinyUtilsTest.java
...ava/org/apache/rocketmq/common/utils/IOTinyUtilsTest.java
+2
-2
filter/src/main/java/org/apache/rocketmq/filter/expression/UnaryExpression.java
...rg/apache/rocketmq/filter/expression/UnaryExpression.java
+15
-1
filter/src/main/java/org/apache/rocketmq/filter/parser/ParseException.java
...ava/org/apache/rocketmq/filter/parser/ParseException.java
+4
-3
filter/src/main/java/org/apache/rocketmq/filter/parser/TokenMgrError.java
...java/org/apache/rocketmq/filter/parser/TokenMgrError.java
+2
-1
filter/src/test/java/org/apache/rocketmq/filter/ParserTest.java
.../src/test/java/org/apache/rocketmq/filter/ParserTest.java
+1
-1
remoting/src/main/java/org/apache/rocketmq/remoting/common/RemotingHelper.java
...a/org/apache/rocketmq/remoting/common/RemotingHelper.java
+1
-1
store/src/main/java/org/apache/rocketmq/store/stats/BrokerStatsManager.java
...a/org/apache/rocketmq/store/stats/BrokerStatsManager.java
+2
-2
tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByUniqueKeySubCommand.java
.../tools/command/message/QueryMsgByUniqueKeySubCommand.java
+3
-2
未找到文件。
acl/src/main/java/org/apache/rocketmq/acl/plain/RemoteAddressStrategyFactory.java
浏览文件 @
44bdeeda
...
...
@@ -167,7 +167,7 @@ public class RemoteAddressStrategyFactory {
String
[]
strArray
=
StringUtils
.
split
(
remoteAddr
,
"."
);
if
(
analysis
(
strArray
,
1
)
||
analysis
(
strArray
,
2
)
||
analysis
(
strArray
,
3
))
{
AclUtils
.
verify
(
remoteAddr
,
index
-
1
);
StringBu
ffer
sb
=
new
StringBuff
er
();
StringBu
ilder
sb
=
new
StringBuild
er
();
for
(
int
j
=
0
;
j
<
index
;
j
++)
{
sb
.
append
(
strArray
[
j
].
trim
()).
append
(
"."
);
}
...
...
common/src/main/java/org/apache/rocketmq/common/UtilAll.java
浏览文件 @
44bdeeda
...
...
@@ -565,11 +565,11 @@ public class UtilAll {
if
(
list
==
null
||
list
.
size
()
==
0
)
{
return
null
;
}
StringBu
ffer
str
=
new
StringBuff
er
();
StringBu
ilder
str
=
new
StringBuild
er
();
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
str
.
append
(
list
.
get
(
i
));
if
(
i
==
list
.
size
()
-
1
)
{
continue
;
break
;
}
str
.
append
(
splitor
);
}
...
...
common/src/main/java/org/apache/rocketmq/common/message/Message.java
浏览文件 @
44bdeeda
...
...
@@ -43,11 +43,13 @@ public class Message implements Serializable {
this
.
flag
=
flag
;
this
.
body
=
body
;
if
(
tags
!=
null
&&
tags
.
length
()
>
0
)
if
(
tags
!=
null
&&
tags
.
length
()
>
0
)
{
this
.
setTags
(
tags
);
}
if
(
keys
!=
null
&&
keys
.
length
()
>
0
)
if
(
keys
!=
null
&&
keys
.
length
()
>
0
)
{
this
.
setKeys
(
keys
);
}
this
.
setWaitStoreMsgOK
(
waitStoreMsgOK
);
}
...
...
@@ -127,7 +129,7 @@ public class Message implements Serializable {
}
public
void
setKeys
(
Collection
<
String
>
keys
)
{
StringBu
ffer
sb
=
new
StringBuff
er
();
StringBu
ilder
sb
=
new
StringBuild
er
();
for
(
String
k
:
keys
)
{
sb
.
append
(
k
);
sb
.
append
(
MessageConst
.
KEY_SEPARATOR
);
...
...
@@ -151,8 +153,9 @@ public class Message implements Serializable {
public
boolean
isWaitStoreMsgOK
()
{
String
result
=
this
.
getProperty
(
MessageConst
.
PROPERTY_WAIT_STORE_MSG_OK
);
if
(
null
==
result
)
if
(
null
==
result
)
{
return
true
;
}
return
Boolean
.
parseBoolean
(
result
);
}
...
...
common/src/main/java/org/apache/rocketmq/common/protocol/NamespaceUtil.java
浏览文件 @
44bdeeda
...
...
@@ -120,7 +120,7 @@ public class NamespaceUtil {
return
null
;
}
return
new
StringBu
ff
er
()
return
new
StringBu
ild
er
()
.
append
(
MixAll
.
RETRY_GROUP_TOPIC_PREFIX
)
.
append
(
wrapNamespace
(
namespace
,
consumerGroup
))
.
toString
();
...
...
common/src/test/java/org/apache/rocketmq/common/UtilAllTest.java
浏览文件 @
44bdeeda
...
...
@@ -19,11 +19,15 @@ package org.apache.rocketmq.common;
import
java.net.InetAddress
;
import
java.net.UnknownHostException
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.Properties
;
import
org.junit.Test
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
within
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
public
class
UtilAllTest
{
...
...
@@ -109,6 +113,15 @@ public class UtilAllTest {
assertThat
(
UtilAll
.
ipToIPv6Str
(
nonInternal
.
getAddress
()).
toUpperCase
()).
isEqualTo
(
"2408:4004:0180:8100:3FAA:1DDE:2B3F:898A"
);
}
@Test
public
void
testList2String
()
{
List
<
String
>
list
=
Arrays
.
asList
(
"groupA=DENY"
,
"groupB=PUB|SUB"
,
"groupC=SUB"
);
String
comma
=
","
;
assertEquals
(
"groupA=DENY,groupB=PUB|SUB,groupC=SUB"
,
UtilAll
.
list2String
(
list
,
comma
));
assertEquals
(
null
,
UtilAll
.
list2String
(
null
,
comma
));
assertEquals
(
null
,
UtilAll
.
list2String
(
Collections
.
emptyList
(),
comma
));
}
static
class
DemoConfig
{
private
int
demoWidth
=
0
;
private
int
demoLength
=
0
;
...
...
common/src/test/java/org/apache/rocketmq/common/utils/IOTinyUtilsTest.java
浏览文件 @
44bdeeda
...
...
@@ -82,7 +82,7 @@ public class IOTinyUtilsTest {
@Test
public
void
testReadLines
()
throws
Exception
{
StringBu
ffer
sb
=
new
StringBuff
er
();
StringBu
ilder
sb
=
new
StringBuild
er
();
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
sb
.
append
(
"testReadLines"
).
append
(
"\n"
);
}
...
...
@@ -95,7 +95,7 @@ public class IOTinyUtilsTest {
@Test
public
void
testToBufferedReader
()
throws
Exception
{
StringBu
ffer
sb
=
new
StringBuff
er
();
StringBu
ilder
sb
=
new
StringBuild
er
();
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
sb
.
append
(
"testToBufferedReader"
).
append
(
"\n"
);
}
...
...
filter/src/main/java/org/apache/rocketmq/filter/expression/UnaryExpression.java
浏览文件 @
44bdeeda
...
...
@@ -53,6 +53,7 @@ public abstract class UnaryExpression implements Expression {
public
static
Expression
createNegate
(
Expression
left
)
{
return
new
UnaryExpression
(
left
,
UnaryType
.
NEGATE
)
{
@Override
public
Object
evaluate
(
EvaluationContext
context
)
throws
Exception
{
Object
rvalue
=
right
.
evaluate
(
context
);
if
(
rvalue
==
null
)
{
...
...
@@ -64,6 +65,7 @@ public abstract class UnaryExpression implements Expression {
return
null
;
}
@Override
public
String
getExpressionSymbol
()
{
return
"-"
;
}
...
...
@@ -85,6 +87,7 @@ public abstract class UnaryExpression implements Expression {
final
Collection
inList
=
t
;
return
new
UnaryInExpression
(
right
,
UnaryType
.
IN
,
inList
,
not
)
{
@Override
public
Object
evaluate
(
EvaluationContext
context
)
throws
Exception
{
Object
rvalue
=
right
.
evaluate
(
context
);
...
...
@@ -103,8 +106,9 @@ public abstract class UnaryExpression implements Expression {
}
@Override
public
String
toString
()
{
StringBu
ffer
answer
=
new
StringBuff
er
();
StringBu
ilder
answer
=
new
StringBuild
er
();
answer
.
append
(
right
);
answer
.
append
(
" "
);
answer
.
append
(
getExpressionSymbol
());
...
...
@@ -124,6 +128,7 @@ public abstract class UnaryExpression implements Expression {
return
answer
.
toString
();
}
@Override
public
String
getExpressionSymbol
()
{
if
(
not
)
{
return
"NOT IN"
;
...
...
@@ -139,6 +144,7 @@ public abstract class UnaryExpression implements Expression {
super
(
left
,
unaryType
);
}
@Override
public
boolean
matches
(
EvaluationContext
context
)
throws
Exception
{
Object
object
=
evaluate
(
context
);
return
object
!=
null
&&
object
==
Boolean
.
TRUE
;
...
...
@@ -147,6 +153,7 @@ public abstract class UnaryExpression implements Expression {
public
static
BooleanExpression
createNOT
(
BooleanExpression
left
)
{
return
new
BooleanUnaryExpression
(
left
,
UnaryType
.
NOT
)
{
@Override
public
Object
evaluate
(
EvaluationContext
context
)
throws
Exception
{
Boolean
lvalue
=
(
Boolean
)
right
.
evaluate
(
context
);
if
(
lvalue
==
null
)
{
...
...
@@ -155,6 +162,7 @@ public abstract class UnaryExpression implements Expression {
return
lvalue
.
booleanValue
()
?
Boolean
.
FALSE
:
Boolean
.
TRUE
;
}
@Override
public
String
getExpressionSymbol
()
{
return
"NOT"
;
}
...
...
@@ -163,6 +171,7 @@ public abstract class UnaryExpression implements Expression {
public
static
BooleanExpression
createBooleanCast
(
Expression
left
)
{
return
new
BooleanUnaryExpression
(
left
,
UnaryType
.
BOOLEANCAST
)
{
@Override
public
Object
evaluate
(
EvaluationContext
context
)
throws
Exception
{
Object
rvalue
=
right
.
evaluate
(
context
);
if
(
rvalue
==
null
)
{
...
...
@@ -174,10 +183,12 @@ public abstract class UnaryExpression implements Expression {
return
((
Boolean
)
rvalue
).
booleanValue
()
?
Boolean
.
TRUE
:
Boolean
.
FALSE
;
}
@Override
public
String
toString
()
{
return
right
.
toString
();
}
@Override
public
String
getExpressionSymbol
()
{
return
""
;
}
...
...
@@ -233,6 +244,7 @@ public abstract class UnaryExpression implements Expression {
/**
* @see Object#toString()
*/
@Override
public
String
toString
()
{
return
"("
+
getExpressionSymbol
()
+
" "
+
right
.
toString
()
+
")"
;
}
...
...
@@ -240,6 +252,7 @@ public abstract class UnaryExpression implements Expression {
/**
* @see Object#hashCode()
*/
@Override
public
int
hashCode
()
{
return
toString
().
hashCode
();
}
...
...
@@ -247,6 +260,7 @@ public abstract class UnaryExpression implements Expression {
/**
* @see Object#equals(Object)
*/
@Override
public
boolean
equals
(
Object
o
)
{
if
(
o
==
null
||
!
this
.
getClass
().
equals
(
o
.
getClass
()))
{
...
...
filter/src/main/java/org/apache/rocketmq/filter/parser/ParseException.java
浏览文件 @
44bdeeda
...
...
@@ -106,7 +106,7 @@ public class ParseException extends Exception {
int
[][]
expectedTokenSequences
,
String
[]
tokenImage
)
{
String
eol
=
System
.
getProperty
(
"line.separator"
,
"\n"
);
StringBu
ffer
expected
=
new
StringBuff
er
();
StringBu
ilder
expected
=
new
StringBuild
er
();
int
maxSize
=
0
;
for
(
int
i
=
0
;
i
<
expectedTokenSequences
.
length
;
i
++)
{
if
(
maxSize
<
expectedTokenSequences
[
i
].
length
)
{
...
...
@@ -123,8 +123,9 @@ public class ParseException extends Exception {
String
retval
=
"Encountered \""
;
Token
tok
=
currentToken
.
next
;
for
(
int
i
=
0
;
i
<
maxSize
;
i
++)
{
if
(
i
!=
0
)
if
(
i
!=
0
)
{
retval
+=
" "
;
}
if
(
tok
.
kind
==
0
)
{
retval
+=
tokenImage
[
0
];
break
;
...
...
@@ -157,7 +158,7 @@ public class ParseException extends Exception {
* string literal.
*/
static
String
add_escapes
(
String
str
)
{
StringBu
ffer
retval
=
new
StringBuff
er
();
StringBu
ilder
retval
=
new
StringBuild
er
();
char
ch
;
for
(
int
i
=
0
;
i
<
str
.
length
();
i
++)
{
switch
(
str
.
charAt
(
i
))
{
...
...
filter/src/main/java/org/apache/rocketmq/filter/parser/TokenMgrError.java
浏览文件 @
44bdeeda
...
...
@@ -66,7 +66,7 @@ public class TokenMgrError extends Error {
* equivalents in the given string
*/
protected
static
final
String
addEscapes
(
String
str
)
{
StringBu
ffer
retval
=
new
StringBuff
er
();
StringBu
ilder
retval
=
new
StringBuild
er
();
char
ch
;
for
(
int
i
=
0
;
i
<
str
.
length
();
i
++)
{
switch
(
str
.
charAt
(
i
))
{
...
...
@@ -141,6 +141,7 @@ public class TokenMgrError extends Error {
* <p/>
* from this method for such cases in the release version of your parser.
*/
@Override
public
String
getMessage
()
{
return
super
.
getMessage
();
}
...
...
filter/src/test/java/org/apache/rocketmq/filter/ParserTest.java
浏览文件 @
44bdeeda
...
...
@@ -84,7 +84,7 @@ public class ParserTest {
@Test
public
void
testParse_floatOverFlow
()
{
try
{
StringBu
ffer
sb
=
new
StringBuff
er
(
210000
);
StringBu
ilder
sb
=
new
StringBuild
er
(
210000
);
sb
.
append
(
"1"
);
for
(
int
i
=
0
;
i
<
2048
;
i
++)
{
sb
.
append
(
"111111111111111111111111111111111111111111111111111"
);
...
...
remoting/src/main/java/org/apache/rocketmq/remoting/common/RemotingHelper.java
浏览文件 @
44bdeeda
...
...
@@ -36,7 +36,7 @@ public class RemotingHelper {
private
static
final
InternalLogger
log
=
InternalLoggerFactory
.
getLogger
(
ROCKETMQ_REMOTING
);
public
static
String
exceptionSimpleDesc
(
final
Throwable
e
)
{
StringBu
ffer
sb
=
new
StringBuff
er
();
StringBu
ilder
sb
=
new
StringBuild
er
();
if
(
e
!=
null
)
{
sb
.
append
(
e
.
toString
());
...
...
store/src/main/java/org/apache/rocketmq/store/stats/BrokerStatsManager.java
浏览文件 @
44bdeeda
...
...
@@ -159,7 +159,7 @@ public class BrokerStatsManager {
}
public
String
buildStatsKey
(
String
topic
,
String
group
)
{
StringBu
ffer
strBuilder
=
new
StringBuff
er
();
StringBu
ilder
strBuilder
=
new
StringBuild
er
();
strBuilder
.
append
(
topic
);
strBuilder
.
append
(
"@"
);
strBuilder
.
append
(
group
);
...
...
@@ -217,7 +217,7 @@ public class BrokerStatsManager {
}
public
String
buildCommercialStatsKey
(
String
owner
,
String
topic
,
String
group
,
String
type
)
{
StringBu
ffer
strBuilder
=
new
StringBuff
er
();
StringBu
ilder
strBuilder
=
new
StringBuild
er
();
strBuilder
.
append
(
owner
);
strBuilder
.
append
(
"@"
);
strBuilder
.
append
(
topic
);
...
...
tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByUniqueKeySubCommand.java
浏览文件 @
44bdeeda
...
...
@@ -114,7 +114,7 @@ public class QueryMsgByUniqueKeySubCommand implements SubCommand {
private
static
String
createBodyFile
(
MessageExt
msg
,
int
index
)
throws
IOException
{
DataOutputStream
dos
=
null
;
try
{
StringBu
ffer
bodyTmpFilePath
=
new
StringBuff
er
(
"/tmp/rocketmq/msgbodys"
);
StringBu
ilder
bodyTmpFilePath
=
new
StringBuild
er
(
"/tmp/rocketmq/msgbodys"
);
File
file
=
new
File
(
bodyTmpFilePath
.
toString
());
if
(!
file
.
exists
())
{
file
.
mkdirs
();
...
...
@@ -127,8 +127,9 @@ public class QueryMsgByUniqueKeySubCommand implements SubCommand {
dos
.
write
(
msg
.
getBody
());
return
bodyTmpFilePath
.
toString
();
}
finally
{
if
(
dos
!=
null
)
if
(
dos
!=
null
)
{
dos
.
close
();
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录