@@ -66,7 +66,8 @@ private Document buildDocument(SAXBuilder builder) throws JDOMException, IOExcep
66
66
return builder .build (file );
67
67
}
68
68
// otherwise try finding KML in compressed KMZ file
69
- // NOTE: only the first "root" KML file is fetched. Supporting KML files will not be validated.
69
+ // NOTE: only the first "root" KML file is fetched. Supporting KML files will not be validated here.
70
+ // If KmzMode is enabled then all KML entries inside KMZ file will be extracted using KmzExplorer class.
70
71
ZipFile zf = null ;
71
72
try {
72
73
zf = new ZipFile (file );
@@ -83,10 +84,9 @@ private Document buildDocument(SAXBuilder builder) throws JDOMException, IOExcep
83
84
// of the first KML found but continue if first KML file is not in the root level then
84
85
// backtrack in stream to first KML if no root-level KML is found.
85
86
if (entry .getName ().toLowerCase ().endsWith (".kml" )) {
86
- Document doc = builder .build (zf .getInputStream (entry ),
87
- file .getAbsoluteFile ().toURI ().toString ());
88
87
isKmzFile = true ;
89
- return doc ;
88
+ return builder .build (zf .getInputStream (entry ),
89
+ file .getAbsoluteFile ().toURI ().toString ());
90
90
}
91
91
}
92
92
@@ -108,10 +108,9 @@ private Document buildDocument(SAXBuilder builder) throws JDOMException, IOExcep
108
108
out .println ("WARN: ZipFile failed [retry using ZipInputStream]: " + msg );
109
109
stats .add ("WARN: " + msg );
110
110
warnings ++;
111
- Document doc = builder .build (zis ,
112
- file .getAbsoluteFile ().toURI ().toString ());
113
111
isKmzFile = true ;
114
- return doc ;
112
+ return builder .build (zis ,
113
+ file .getAbsoluteFile ().toURI ().toString ());
115
114
}
116
115
}
117
116
} catch (IOException ioe ) {
0 commit comments