0

scriptella で次のコードを記述するにはどうすればよいですか? Set と String を比較しようとしているようで、最後の for ループが気に入らないようです。&&のような論理式の書き方とは?ありがとうございました。

<connection id="java" driver="scriptella.driver.janino.Driver"/>

<script connection-id="java>

//some code

if(finalOrderCounter &lt; numberOfEntries){
    Set &lt;String> set = new HashSet &lt;String>();
    for(int i = 0; i &lt; fieldNames.length; i++){
        set.add(fieldNames[i]);
    }
    for(int i = 0; i &lt; 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");
}

4

1 に答える 1

0

「古典的な」「for」ループ構文を試すことができますか?

StringBuffer exception = new StringBuffer();
for (int i = 0; i &lt; 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");

ところで、どのようなエラーが発生していますか?

于 2013-03-17T07:21:03.323 に答える