`
hfwork
  • 浏览: 12255 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

kettle的bug

阅读更多
在kettle中的kettle-core.jar中存在一个bug,导致kjb在spoon中执行同在kitchen执行和调用api的时候执行结果不一样,体现在变量替换中如果要替换的变量不存在的时候,在spoon中替换为空,在kitchen中则不替换。
具体bug所在位置为:org.pentaho.di.core.util.StringUtil中的53行。
原来为
int i = rest.indexOf(open);
    while (i > -1)
    {
      int j = rest.indexOf(close, i + open.length());

      if (j > -1)
      {
        String varName = rest.substring(i + open.length(), j);
        Object value = variablesValues.get(varName);
        if (value == null)
        {
          value = open + varName + close;
        }
        else
        {
          int another = ((String)value).indexOf(open);

          if (another > -1)
          {
            if (recursion > 50)
            {
              throw new RuntimeException("Endless loop detected for substitution of variable: " + (String)value);
            }

            recursion++; value = substitute((String)value, variablesValues, open, close, recursion);
          }
        }
        buffer.append(rest.substring(0, i));
        buffer.append(value);
        rest = rest.substring(j + close.length());
      }
      else
      {
        buffer.append(rest);
        rest = "";
      }

      i = rest.indexOf(open);
    }

其中的
value = open + varName + close;
应该为value = "";

分享到:
评论
1 楼 databclar 2014-04-16  
更新后kettle都不能启动了

相关推荐

Global site tag (gtag.js) - Google Analytics