src/main/java/org/embulk/decoder/unzip/ArchiveInputStreamIterator.java in embulk-decoder-unzip-0.1.2 vs src/main/java/org/embulk/decoder/unzip/ArchiveInputStreamIterator.java in embulk-decoder-unzip-0.1.3
- old
+ new
@@ -1,10 +1,11 @@
package org.embulk.decoder.unzip;
import java.io.IOException;
import java.io.InputStream;
import java.util.Iterator;
+import java.util.zip.ZipException;
import org.apache.commons.compress.archivers.ArchiveEntry;
import org.apache.commons.compress.archivers.ArchiveInputStream;
class ArchiveInputStreamIterator implements Iterator<InputStream> {
@@ -58,10 +59,18 @@
} else if (entry != null) {
return true;
}
while (true) {
- entry = ain.getNextEntry();
+ try {
+ entry = ain.getNextEntry();
+ } catch (ZipException ze) {
+ System.err.println("ZipException: " + ze.getMessage());
+ continue;
+ } catch (IllegalArgumentException ie) {
+ System.err.println("IllegalArgumentException: " + ie.getMessage());
+ continue;
+ }
if (entry == null) {
endOfArchive = true;
return false;
} else if (entry.isDirectory()) {
continue;