发现storm代码的一个Bug

来源:互联网 发布:身材丰满的av演员知乎 编辑:程序博客网 时间:2024/05/19 03:19

今天在用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);    }
0 0
原创粉丝点击