Revision 33948
Added by Andrea Mannocci almost 10 years ago
modules/dnet-modular-collector-service/trunk/src/main/java/eu/dnetlib/data/collector/plugins/filesystem/FilesystemIterable.java | ||
---|---|---|
73 | 73 |
return XmlCleaner.cleanAllEntities(s.startsWith("\uFEFF") ? s.substring(1) : s); |
74 | 74 |
} catch (Exception e) { |
75 | 75 |
log.error("Unable to read " + inputFileName); |
76 |
return null;
|
|
76 |
return "";
|
|
77 | 77 |
} finally { |
78 | 78 |
if (fileInputStream != null) { |
79 | 79 |
try { |
modules/dnet-modular-collector-service/trunk/src/main/java/eu/dnetlib/data/collector/plugins/filesystem/FileSystemIterator.java | ||
---|---|---|
64 | 64 |
*/ |
65 | 65 |
private synchronized String walkTillNext() { |
66 | 66 |
while (pathIterator.hasNext()) { |
67 |
Path next = pathIterator.next(); |
|
68 |
if (Files.isDirectory(next)) { |
|
67 |
Path nextFilePath = pathIterator.next();
|
|
68 |
if (Files.isDirectory(nextFilePath)) {
|
|
69 | 69 |
// concat |
70 | 70 |
try { |
71 |
pathIterator = Iterators.concat(pathIterator, Files.newDirectoryStream(next).iterator()); |
|
72 |
log.debug("Adding folder iterator: " + next.toString()); |
|
71 |
pathIterator = Iterators.concat(pathIterator, Files.newDirectoryStream(nextFilePath).iterator());
|
|
72 |
log.debug("Adding folder iterator: " + nextFilePath.toString());
|
|
73 | 73 |
} catch (IOException e) { |
74 |
log.error("Cannot create folder iterator! Is this path correct? " + next.toString()); |
|
75 |
return "";
|
|
74 |
log.error("Cannot create folder iterator! Is this path correct? " + nextFilePath.toString());
|
|
75 |
return null;
|
|
76 | 76 |
} |
77 | 77 |
} else { |
78 |
if (extensions.contains(FilenameUtils.getExtension(next.toString()))) { |
|
79 |
log.debug("Returning: " + next.toString()); |
|
80 |
return next.toString(); |
|
78 |
if (extensions.contains(FilenameUtils.getExtension(nextFilePath.toString()))) {
|
|
79 |
log.debug("Returning: " + nextFilePath.toString());
|
|
80 |
return nextFilePath.toString();
|
|
81 | 81 |
} |
82 | 82 |
} |
83 | 83 |
} |
84 |
return "";
|
|
84 |
return null;
|
|
85 | 85 |
} |
86 |
|
|
87 | 86 |
} |
Also available in: Unified diff
corrected a bug in next()