Hi,
I sometimes get a ConcurrentModificationException when l loading multiple
files from a directory (see code below). Does anyone the cause (or fix) of
this problem? I have tried to use commit() after processing every file but
to no avail.
Thanks,
Quentin
public static void main(String[] args) {
// Create a new dataset
Dataset ds = TDBFactory.createDataset($db) ;
Model model = ds.getDefaultModel();
if ( !model.isEmpty() )
model.removeAll();
// Load content from input directory
File directory = new File(input);
String[] files = directory.list();
if ( files == null )
System.out.println("The directory doesn't exist!");
else if ( files.length == 0 )
System.out.println("The directory is empty.");
else {
for (int i = 0, j = files.length; i < j; i++ ) {
System.out.println( files[i] + " is being processed.");
FileManager.get().readModel( model, input + files[i]);
}
}
// Close the different models
model.close();
ds.close();
}