04-21-2008 06:21 AM
RetryingTransactionCallback<Void> callback = new RetryingTransactionCallback<Void>() {
public Void execute() throws Throwable {
ImporterService importerService = serviceRegistry.getImporterService();
ACPImportPackageHandler handler = new ACPImportPackageHandler(new File("path/file.acp"),
ACPImportPackageHandler.DEFAULT_ENCODING);
importerService.importView(handler, location, null, null);
return null;
}
};
retryingTransactionHelper.doInTransaction(callback, false);but after it, I can't delete file (path/file.acp). What I'm doing wrong? It looks like there is a problem with closing stream.
01-20-2010 11:25 AM
public class CustomACPImportPackageHandler extends ACPImportPackageHandler {
private Reader readerDataStream = null;
private InputStream importStream = null;
public CustomACPImportPackageHandler(File zipFile, String dataFileEncoding) {
super(zipFile, dataFileEncoding);
}
@Override
public void endImport() {
super.endImport();
this.close();
}
@Override
public Reader getDataStream() {
this.readerDataStream = super.getDataStream();
return this.readerDataStream;
}
@Override
public InputStream importStream(String content) {
this.importStream = super.importStream(content);
return this.importStream;
}
public void close() {
try {
this.zipFile.close();
this.readerDataStream.close();
this.importStream.close();
} catch (IOException e) {
throw new RuntimeException("Unable to close the zip file", e);
}
}
}
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.