Revision 59231
Added by Alessia Bardi over 4 years ago
modules/dnet-modular-collector-service/trunk/src/main/java/eu/dnetlib/data/collector/plugins/sftp/SftpIterator.java | ||
---|---|---|
43 | 43 |
private DateTime fromDate = null; |
44 | 44 |
private DateTimeFormatter simpleDateTimeFormatter = DateTimeFormat.forPattern("yyyy-MM-dd"); |
45 | 45 |
|
46 |
private static String EMPTY_RECORD = "<record/>"; |
|
47 |
|
|
46 | 48 |
public SftpIterator(String baseUrl, String username, String password, boolean isRecursive, Set<String> extensionsSet, String fromDate) { |
47 | 49 |
this.baseUrl = baseUrl; |
48 | 50 |
this.username = username; |
... | ... | |
182 | 184 |
fullPathFile = sftpChannel.pwd() + "/" + nextRemotePath; |
183 | 185 |
log.debug(String.format("Collected file from SFTP: %s%s", sftpServerAddress, fullPathFile)); |
184 | 186 |
} |
185 |
return baos.toString(); |
|
187 |
String doc = baos.toString(); |
|
188 |
if(StringUtils.isNotBlank(doc)) return doc; |
|
189 |
else return EMPTY_RECORD; |
|
186 | 190 |
} catch (SftpException e) { |
187 | 191 |
nRepeat++; |
188 | 192 |
log.warn(String.format("An error occurred [%s] for %s%s, retrying.. [retried %s time(s)]", e.getMessage(), sftpServerAddress, fullPathFile, |
Also available in: Unified diff
#5842: do not return blank strings but an empty <record/>