88import org .apache .commons .vfs2 .impl .StandardFileSystemManager ;
99import org .apache .commons .vfs2 .provider .sftp .IdentityInfo ;
1010import org .apache .commons .vfs2 .provider .sftp .SftpFileSystemConfigBuilder ;
11+ import org .embulk .config .ConfigException ;
1112import org .embulk .config .TaskReport ;
1213import org .embulk .spi .Buffer ;
1314import org .embulk .spi .Exec ;
@@ -58,7 +59,7 @@ private StandardFileSystemManager initializeStandardFileSystemManager()
5859 }
5960 catch (FileSystemException e ) {
6061 logger .error (e .getMessage ());
61- throw new RuntimeException (e );
62+ throw new ConfigException (e );
6263 }
6364
6465 return manager ;
@@ -92,7 +93,7 @@ private FileSystemOptions initializeFsOptions(PluginTask task)
9293 }
9394 catch (FileSystemException e ) {
9495 logger .error (e .getMessage ());
95- throw new RuntimeException (e );
96+ throw new ConfigException (e );
9697 }
9798
9899 return fsOptions ;
@@ -142,7 +143,9 @@ public void add(Buffer buffer)
142143 logger .error (e .getMessage ());
143144 Throwables .propagate (e );
144145 }
145- buffer .release ();
146+ finally {
147+ buffer .release ();
148+ }
146149 }
147150
148151 @ Override
@@ -166,7 +169,7 @@ public void abort()
166169 @ Override
167170 public TaskReport commit ()
168171 {
169- return null ;
172+ return Exec . newTaskReport () ;
170173 }
171174
172175
@@ -199,7 +202,7 @@ private URI getSftpFileUri(String remoteFilePath)
199202 }
200203 catch (URISyntaxException e ) {
201204 logger .error (e .getMessage ());
202- throw new RuntimeException (e );
205+ throw new ConfigException (e );
203206 }
204207 }
205208
0 commit comments