diff --git a/src/main/java/org/embulk/output/sftp/SftpFileOutput.java b/src/main/java/org/embulk/output/sftp/SftpFileOutput.java index 3379c85..e3c2505 100644 --- a/src/main/java/org/embulk/output/sftp/SftpFileOutput.java +++ b/src/main/java/org/embulk/output/sftp/SftpFileOutput.java @@ -7,6 +7,7 @@ import org.apache.commons.vfs2.impl.StandardFileSystemManager; import org.apache.commons.vfs2.provider.sftp.IdentityInfo; import org.apache.commons.vfs2.provider.sftp.SftpFileSystemConfigBuilder; +import org.embulk.config.ConfigException; import org.embulk.config.TaskReport; import org.embulk.spi.Buffer; import org.embulk.spi.Exec; @@ -56,7 +57,7 @@ private StandardFileSystemManager initializeStandardFileSystemManager() } catch (FileSystemException e) { logger.error(e.getMessage()); - throw new RuntimeException(e); + throw new ConfigException(e); } return manager; @@ -87,7 +88,7 @@ private FileSystemOptions initializeFsOptions(PluginTask task) } catch (FileSystemException e) { logger.error(e.getMessage()); - throw new RuntimeException(e); + throw new ConfigException(e); } return fsOptions; @@ -137,7 +138,9 @@ public void add(Buffer buffer) logger.error(e.getMessage()); Throwables.propagate(e); } - buffer.release(); + finally { + buffer.release(); + } } @Override @@ -161,7 +164,7 @@ public void abort() @Override public TaskReport commit() { - return null; + return Exec.newTaskReport(); } @@ -194,7 +197,7 @@ private URI getSftpFileUri(String remoteFilePath) } catch (URISyntaxException e) { logger.error(e.getMessage()); - throw new RuntimeException(e); + throw new ConfigException(e); } }