Data d = r.getData();
for (int i=0; i<20 && d.getSize() == 0; i++)
d = r.getData();
if (d.getSize()== 0)
return;
QTemporaryFile f = writeResource(d);
if (!keepRunning) {
return;
}
InputStream input;
try {
input = new FileInputStream(new File(f.fileName()));
ContentHandler textHandler = new BodyContentHandler(-1);
Metadata metadata = new Metadata();
OpenDocumentParser parser = new OpenDocumentParser();
ParseContext context = new ParseContext();
parser.parse(input, textHandler, metadata, context);
String[] result = textHandler.toString().split(regex);
for (int i=0; i<result.length && keepRunning; i++) {
if (interrupt) {
processInterrupt();
}
addToIndex(r.getNoteGuid(), result[i], "RESOURCE");
}
input.close();
f.close();
} catch (java.lang.ClassCastException e) {
logger.log(logger.LOW, "Cast exception: " +e.getMessage());
} catch (FileNotFoundException e) {
logger.log(logger.LOW, "FileNotFound exception: " +e.getMessage());
} catch (IOException e) {