File tree 1 file changed +6
-4
lines changed
src/main/java/com/blueconic/browscap
1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -75,11 +75,13 @@ private UserAgentParser createParserWithFields(final Collection<BrowsCapField> f
75
75
// http://browscap.org/version-number
76
76
try (final InputStream zipStream = getCsvFileStream ();
77
77
final ZipInputStream zipIn = new ZipInputStream (zipStream )) {
78
- final ZipEntry entry = zipIn .getNextEntry ();
79
-
80
- // look for the first file that isn't a directory
78
+ // look for the first file that isn't a directory and a .csv
81
79
// that should be a BrowsCap .csv file
82
- if (!entry .isDirectory ()) {
80
+ ZipEntry entry = null ;
81
+ do {
82
+ entry = zipIn .getNextEntry ();
83
+ } while (!(entry == null || entry .getName ().endsWith (".csv" )));
84
+ if (!(entry == null || entry .isDirectory ())) {
83
85
return UserAgentFileParser .parse (new InputStreamReader (zipIn , UTF_8 ), fields );
84
86
} else {
85
87
throw new IOException (
You can’t perform that action at this time.
0 commit comments