我如何用scriptella编写下面的代码?看起来它认为我正在尝试比较Set和String,它不像最后一个for循环。写逻辑表达式的方法是什么。谢谢。
<connection id="java" driver="scriptella.driver.janino.Driver"/>
<script connection-id="java>
//some code
if(finalOrderCounter < numberOfEntries){
Set <String> set = new HashSet <String>();
for(int i = 0; i < fieldNames.length; i++){
set.add(fieldNames[i]);
}
for(int i = 0; i < fieldNamesFromXML.length; i++){
set.remove(fieldNamesFromXML[i]);
}
String exception = "";
for(String element:set)
exception += element +"\n";
throw new IOException("Field(s)\n" + exception + "do(es) not exits in the source database");
}
发布于 2013-03-17 15:21:03
也许你可以试试“经典的”'for‘循环语法?
StringBuffer exception = new StringBuffer();
for (int i = 0; i < set.size(); ++i) {
String element = (String) set.get(i);
exception.append(element);
exception.append("\n");
}
throw new IOException("Field(s)\n" + exception.toString() + "do(es) not exits in the source database");顺便说一句,你得到了什么错误?
https://stackoverflow.com/questions/14732519
复制相似问题