embulk-input-sftp 0.2.6 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3e5bb47c115c41e13799cbfcf46671af322f84e2
4
- data.tar.gz: eb38505bcf11e80baa8479fe3288865dddb6cd72
3
+ metadata.gz: 8b8b4aab224c69ba312142fbe2670aa8c54d7554
4
+ data.tar.gz: 1273126ed13973cd72c0ddf60d6eb1bcfe010344
5
5
  SHA512:
6
- metadata.gz: 8f79bab7d1840e2be3e99514acea0ead21f2241b0a082b31b65ef5aa5319c7705afc07e0efdb7047ec071b3e3c285a8ff93a9371096e08b1c52c748e19a4429a
7
- data.tar.gz: 6d3b85448f45f749cca6c4fb125f64bcb00b8793e2c935fe2a0896c0841e3922cfda9e196c4fd9937010643b37d094e245b7b1248afc788856b82281a36520a2
6
+ metadata.gz: 155d7ce767e29ef9dbba5fd310d9b8e08d2e9f3441989f1099c8cf26aaec078ba2a36bede8a489c28e7d0313c4dc38efa921c9f955488a29f3d659c7206cf9e9
7
+ data.tar.gz: bb1a68a8c84189a69d01f17f2b3f6e812eff60abd66a3781e063065ebda7a8aa28d414612347284fae1f66fb25c94c9828aca349c6f2dde31e245857033feacd
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 0.2.7 - 2018-03-02
2
+ * [maintenance] Fix SFTP connection remaining problem [#27](https://github.com/sakama/embulk-input-sftp/pull/27)
3
+
1
4
  ## 0.2.6 - 2018-01-15
2
5
  - [maintenance] Upgrade "commons-vfs2", "com.jcraft:jsch" and "commons-io:commons-io"
3
6
  - https://github.com/embulk/embulk-input-sftp/pull/25
data/build.gradle CHANGED
@@ -16,7 +16,7 @@ configurations {
16
16
  }
17
17
 
18
18
  group = "org.embulk.input.sftp"
19
- version = "0.2.6"
19
+ version = "0.2.7"
20
20
 
21
21
  sourceCompatibility = 1.7
22
22
  targetCompatibility = 1.7
@@ -56,6 +56,7 @@ public class SftpFileInput
56
56
  @Override
57
57
  public void close()
58
58
  {
59
+ super.close();
59
60
  }
60
61
 
61
62
  private static StandardFileSystemManager initializeStandardFileSystemManager()
@@ -189,43 +190,49 @@ public class SftpFileInput
189
190
  {
190
191
  String lastKey = null;
191
192
  log.info("Getting to download file list");
192
- StandardFileSystemManager manager = initializeStandardFileSystemManager();
193
- FileSystemOptions fsOptions = initializeFsOptions(task);
193
+ StandardFileSystemManager manager = null;
194
+ try {
195
+ manager = initializeStandardFileSystemManager();
196
+ FileSystemOptions fsOptions = initializeFsOptions(task);
194
197
 
195
- if (task.getLastPath().isPresent() && !task.getLastPath().get().isEmpty()) {
196
- lastKey = manager.resolveFile(getSftpFileUri(task, task.getLastPath().get()), fsOptions).toString();
197
- }
198
+ if (task.getLastPath().isPresent() && !task.getLastPath().get().isEmpty()) {
199
+ lastKey = manager.resolveFile(getSftpFileUri(task, task.getLastPath().get()), fsOptions).toString();
200
+ }
198
201
 
199
- FileObject files = manager.resolveFile(getSftpFileUri(task, task.getPathPrefix()), fsOptions);
202
+ FileObject files = manager.resolveFile(getSftpFileUri(task, task.getPathPrefix()), fsOptions);
200
203
 
201
- if (files.isFolder()) {
202
- //path_prefix is a folder, we add everything in that folder
203
- FileObject[] children = files.getChildren();
204
- Arrays.sort(children);
205
- for (FileObject f : children) {
206
- if (f.isFile()) {
207
- addFileToList(builder, f.toString(), f.getContent().getSize(), "", lastKey);
204
+ if (files.isFolder()) {
205
+ //path_prefix is a folder, we add everything in that folder
206
+ FileObject[] children = files.getChildren();
207
+ Arrays.sort(children);
208
+ for (FileObject f : children) {
209
+ if (f.isFile()) {
210
+ addFileToList(builder, f.toString(), f.getContent().getSize(), "", lastKey);
211
+ }
212
+ }
213
+ } else if (files.isFile()) {
214
+ //path_prefix is a file then we just need to add that file
215
+ addFileToList(builder, files.toString(), files.getContent().getSize(), "", lastKey);
216
+ } else {
217
+ // path_prefix is neither file or folder, then we scan the parent folder to file path
218
+ // that match the path_prefix basename
219
+ FileObject parent = files.getParent();
220
+ FileObject[] children = parent.getChildren();
221
+ Arrays.sort(children);
222
+ String fileName = FilenameUtils.getName(task.getPathPrefix());
223
+ for (FileObject f : children) {
224
+ if (f.isFile()) {
225
+ addFileToList(builder, f.toString(), f.getContent().getSize(), fileName, lastKey);
226
+ }
208
227
  }
209
228
  }
229
+ return builder.build();
210
230
  }
211
- else if (files.isFile()) {
212
- //path_prefix is a file then we just need to add that file
213
- addFileToList(builder, files.toString(), files.getContent().getSize(), "", lastKey);
214
- }
215
- else {
216
- // path_prefix is neither file or folder, then we scan the parent folder to file path
217
- // that match the path_prefix basename
218
- FileObject parent = files.getParent();
219
- FileObject[] children = parent.getChildren();
220
- Arrays.sort(children);
221
- String fileName = FilenameUtils.getName(task.getPathPrefix());
222
- for (FileObject f : children) {
223
- if (f.isFile()) {
224
- addFileToList(builder, f.toString(), f.getContent().getSize(), fileName, lastKey);
225
- }
231
+ finally {
232
+ if (manager != null) {
233
+ manager.close();
226
234
  }
227
235
  }
228
- return builder.build();
229
236
  }
230
237
 
231
238
  @Override
@@ -99,5 +99,8 @@ public class SingleFileProvider
99
99
  @Override
100
100
  public void close()
101
101
  {
102
+ if (manager != null) {
103
+ manager.close();
104
+ }
102
105
  }
103
106
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-input-sftp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Satoshi Akama
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-15 00:00:00.000000000 Z
11
+ date: 2018-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -72,7 +72,7 @@ files:
72
72
  - classpath/commons-io-2.6.jar
73
73
  - classpath/commons-logging-1.2.jar
74
74
  - classpath/commons-vfs2-2.2.jar
75
- - classpath/embulk-input-sftp-0.2.6.jar
75
+ - classpath/embulk-input-sftp-0.2.7.jar
76
76
  - classpath/jsch-0.1.54.jar
77
77
  homepage: https://github.com/embulk/embulk-input-sftp
78
78
  licenses: