Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
皇甫嗷嗷叫
qlexpress
提交
9a5646b4
Q
qlexpress
项目概览
皇甫嗷嗷叫
/
qlexpress
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Q
qlexpress
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
9a5646b4
编写于
11月 17, 2017
作者:
T
tianqiao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update runner.getOutFunctionNames nullPointer exception
上级
5f921d8d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
64 addition
and
16 deletion
+64
-16
pom.xml
pom.xml
+1
-1
src/main/java/com/ql/util/express/InstructionSet.java
src/main/java/com/ql/util/express/InstructionSet.java
+13
-11
src/test/java/com/ql/util/express/example/ArgumentTypeMismatchTest.java
...com/ql/util/express/example/ArgumentTypeMismatchTest.java
+50
-4
未找到文件。
pom.xml
浏览文件 @
9a5646b4
...
...
@@ -6,7 +6,7 @@
<groupId>
com.taobao.util
</groupId>
<artifactId>
taobao-express
</artifactId>
<packaging>
jar
</packaging>
<version>
3.1.
6
</version>
<version>
3.1.
7
</version>
<name>
taobao-express
</name>
<dependencies>
...
...
src/main/java/com/ql/util/express/InstructionSet.java
浏览文件 @
9a5646b4
...
...
@@ -99,17 +99,19 @@ public class InstructionSet implements Serializable{
if
(
instruction
instanceof
InstructionOperator
)
{
String
opName
=
((
InstructionOperator
)
instruction
)
.
getOperator
().
getName
();
if
(
opName
.
equalsIgnoreCase
(
"def"
)
||
opName
.
equalsIgnoreCase
(
"exportDef"
))
{
String
varLocalName
=
(
String
)
((
InstructionConstData
)
instructionList
[
i
-
1
])
.
getOperateData
().
getObject
(
null
);
result
.
remove
(
varLocalName
);
}
else
if
(
opName
.
equalsIgnoreCase
(
"alias"
)
||
opName
.
equalsIgnoreCase
(
"exportAlias"
))
{
String
varLocalName
=
(
String
)
((
InstructionConstData
)
instructionList
[
i
-
2
])
.
getOperateData
().
getObject
(
null
);
result
.
remove
(
varLocalName
);
}
if
(
opName
!=
null
){
//addOperator(op)中op.name有可能为空
if
(
opName
.
equalsIgnoreCase
(
"def"
)
||
opName
.
equalsIgnoreCase
(
"exportDef"
))
{
String
varLocalName
=
(
String
)
((
InstructionConstData
)
instructionList
[
i
-
1
])
.
getOperateData
().
getObject
(
null
);
result
.
remove
(
varLocalName
);
}
else
if
(
opName
.
equalsIgnoreCase
(
"alias"
)
||
opName
.
equalsIgnoreCase
(
"exportAlias"
))
{
String
varLocalName
=
(
String
)
((
InstructionConstData
)
instructionList
[
i
-
2
])
.
getOperateData
().
getObject
(
null
);
result
.
remove
(
varLocalName
);
}
}
}
}
return
result
.
keySet
().
toArray
(
new
String
[
0
]);
...
...
src/test/java/com/ql/util/express/example/ArgumentTypeMismatchTest.java
浏览文件 @
9a5646b4
package
com.ql.util.express.example
;
import
com.ql.util.express.
DefaultContext
;
import
com.ql.util.express.
ExpressRunner
;
import
com.ql.util.express.IExpressContext
;
import
com.ql.util.express.Operator
;
import
com.ql.util.express.
*
;
import
com.ql.util.express.
instruction.op.OperatorBase
;
import
org.apache.commons.lang.builder.ToStringBuilder
;
import
org.apache.commons.lang.builder.ToStringStyle
;
import
org.junit.Test
;
/**
...
...
@@ -60,4 +60,50 @@ public class ArgumentTypeMismatchTest {
}
System
.
out
.
print
(
"test ok!"
);
}
@Test
public
void
test3
()
throws
Exception
{
ExpressRunner
runner
=
new
ExpressRunner
();
runner
.
addFunction
(
"abc"
,
new
Operator
()
{
@Override
public
Object
executeInner
(
Object
[]
list
)
throws
Exception
{
Long
paramA
=
Long
.
valueOf
(
list
[
0
].
toString
());
Integer
paramB
=
Integer
.
valueOf
(
list
[
1
].
toString
());
String
paramC
=
list
[
2
].
toString
();
singleton
.
functionABC
(
paramA
,
paramB
,
paramC
);
return
null
;
}
});
OperatorBase
function
=
runner
.
getFunciton
(
"abc"
);
System
.
out
.
println
(
"function = "
+
ToStringBuilder
.
reflectionToString
(
function
,
ToStringStyle
.
MULTI_LINE_STYLE
));
String
exp
=
"abc(a,b,c)"
;
IExpressContext
<
String
,
Object
>
context
=
new
DefaultContext
<
String
,
Object
>();
context
.
put
(
"a"
,
"1"
);
context
.
put
(
"b"
,
"2"
);
context
.
put
(
"c"
,
"3"
);
InstructionSet
instructionSet
=
runner
.
getInstructionSetFromLocalCache
(
exp
);
String
[]
outFunctionNames
=
runner
.
getOutFunctionNames
(
exp
);
String
[]
outVarNames
=
runner
.
getOutVarNames
(
exp
);
System
.
out
.
println
(
"before execute instructionSet = "
+
instructionSet
);
System
.
out
.
println
(
"outFunctionNames = "
+
ToStringBuilder
.
reflectionToString
(
outFunctionNames
,
ToStringStyle
.
MULTI_LINE_STYLE
));
System
.
out
.
println
(
"outVarNames = "
+
ToStringBuilder
.
reflectionToString
(
outVarNames
,
ToStringStyle
.
MULTI_LINE_STYLE
));
try
{
runner
.
execute
(
exp
,
context
,
null
,
false
,
false
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
instructionSet
=
runner
.
getInstructionSetFromLocalCache
(
exp
);
outFunctionNames
=
runner
.
getOutFunctionNames
(
exp
);
outVarNames
=
runner
.
getOutVarNames
(
exp
);
System
.
out
.
println
(
"after execute instructionSet = "
+
instructionSet
);
System
.
out
.
println
(
"outFunctionNames = "
+
ToStringBuilder
.
reflectionToString
(
outFunctionNames
,
ToStringStyle
.
MULTI_LINE_STYLE
));
System
.
out
.
println
(
"outVarNames = "
+
ToStringBuilder
.
reflectionToString
(
outVarNames
,
ToStringStyle
.
MULTI_LINE_STYLE
));
System
.
out
.
println
(
"test ok!"
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录