dbf-exporter http://jira.mfd.msk:8088/browse/CLS-313ил логов и детализацию ошибок парсинга файлов
This commit is contained in:
parent
4b8c8fc2bb
commit
f7b129bf24
2 changed files with 6 additions and 0 deletions
|
|
@ -79,10 +79,14 @@ public enum FilenameTemplate {
|
|||
for (SftpFileInfo file : files) {
|
||||
String name = file.getFilename();
|
||||
String[] splitName = name.split("_");
|
||||
if (splitName.length < 3)
|
||||
throw new IllegalArgumentException("Filename did not contains 3 or 4 separator \"_\": " + name);
|
||||
String prefix = splitName[0];
|
||||
String timestamp = splitName[2];
|
||||
|
||||
if (prefix.equalsIgnoreCase(prefixOfTable) && timestamp.contains(timestampNow)) {
|
||||
if (splitName.length < 4)
|
||||
throw new IllegalArgumentException("Filename did not contains 4 separator \"_\": " + name);
|
||||
String counter = splitName[3];
|
||||
int positionOfDot = counter.indexOf('.');
|
||||
if (positionOfDot != -1) {
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ public class PrepareDBFFile extends Stage implements InitializingBean {
|
|||
public StageResult process(ResultContainer resultContainer) {
|
||||
Objects.requireNonNull(resultContainer.getTableForExport());
|
||||
List<SftpFileInfo> files = gateway.listFiles(settings.getStore().getOutDir());
|
||||
log.debug("From sFTP dir \"{}\" list {} file names.", settings.getStore().getOutDir(), files.size());
|
||||
Table table = resultContainer.getTableForExport();
|
||||
LocalDateTime currentDateTime = LocalDateTime.now();
|
||||
resultContainer.setRegistrationDateTime(currentDateTime);
|
||||
|
|
@ -64,6 +65,7 @@ public class PrepareDBFFile extends Stage implements InitializingBean {
|
|||
throw new IOException("Output directory " + outDirPath + " is file.");
|
||||
if (!outDirFile.exists()) Files.createDirectories(outDirFile.toPath());
|
||||
this.outDir = outDirPath;
|
||||
log.info("Output directory: {}", outDirFile.getAbsolutePath());
|
||||
}
|
||||
|
||||
private static final Map<Table, FilenameTemplate> nameTemplates = new EnumMap<>(Table.class);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue