发现storm的一个bug

原创
2017/04/18 17:58
阅读数 161

今天在用storm写应用的时候无意发现一个bug,主要信息如下:

  • storm版本:1.0.3
  • 组件:org.apache.storm:storm-core:1.0.3
  • 方法: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 收藏
0
分享
返回顶部
顶部