您的位置:首页 > 编程语言

发现storm代码的一个Bug

2017-04-19 09:32 267 查看
今天在用storm写应用的时候无意发现一个bug,主要信息如下:

- storm版本:1.0.3

- 组件:storm-core

- 方法:org.apache.storm.utils.Utils#getGlobalStreamId

有问题的代码:

public static GlobalStreamId getGlobalStreamId(String streamId, String componentId) {
if (componentId == null) {
return new GlobalStreamId(streamId, DEFAULT_STREAM_ID);
}
return new GlobalStreamId(streamId, componentId);
}


因为GlobalStreamId的构造方法参数是这样的:

public GlobalStreamId(
String componentId,
String streamId)
{
this();
this.componentId = componentId;
this.streamId = streamId;
}


很明显有问题对吧,正确的应该这样:

public static GlobalStreamId getGlobalStreamId(String streamId, String componentId) {
if (streamId == null) {
return new GlobalStreamId(componentId, DEFAULT_STREAM_ID);
}
return new GlobalStreamId(componentId, streamId);
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  storm bug 大数据