Skip to content

Commit 9186678

Browse files
Continue with other files if JsonMappingException occurs
1 parent deec2b3 commit 9186678

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/main/java/org/radarcns/RestructureAvroRecords.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package org.radarcns;
1818

19+
import com.fasterxml.jackson.databind.JsonMappingException;
1920
import org.apache.avro.Schema.Field;
2021
import org.apache.avro.file.DataFileReader;
2122
import org.apache.avro.generic.GenericDatumReader;
@@ -178,7 +179,12 @@ public void start(String directoryName) throws IOException {
178179
for (Map.Entry<String, List<Path>> entry : topicPaths.entrySet()) {
179180
try (FileCacheStore cache = new FileCacheStore(converterFactory, 100, USE_GZIP, DO_DEDUPLICATE)) {
180181
for (Path filePath : entry.getValue()) {
181-
this.processFile(filePath, entry.getKey(), cache, offsets);
182+
// If Json Mapping exception occurs log error and continue with other files
183+
try {
184+
this.processFile(filePath, entry.getKey(), cache, offsets);
185+
} catch (JsonMappingException exc) {
186+
logger.error("Cannot map values", exc);
187+
}
182188
progressBar.update(++processedFileCount);
183189
}
184190
}

0 commit comments

Comments
 (0)