在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 = "";
kettle的bug
猜你喜欢
转载自hfwork.iteye.com/blog/1678595
今日推荐
周排行