InputStream is = getRepository().retrieve(id, np, ext);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
RepositoryHelp.streamCopy(is, baos, true);
String problemText = baos.toString();
// an exception was thrown - throw it up.
throw new Kite9ProcessingException("An exception occurred in processing the work item: "+i.getSubjectId()+" "+i.getName()+"\n"+problemText);
}
}
successful++;
} catch (IOException e) {
failed ++;
throw new Kite9ProcessingException("Could not process server response: " + e);
} finally {
try {
OutputStream fos = getRepository().store(i.getSubjectId(), i.getName(), "xml");
XMLHelper xh = new XMLHelper();
String xml = xh.toXML(i);
OutputStreamWriter w = new OutputStreamWriter(fos);
w.write(xml);
w.close();
} catch (IOException e) {
throw new Kite9ProcessingException("Could not store request XML in local repository: " + e);
}
}
}