@@ -66,7 +66,8 @@ private Document buildDocument(SAXBuilder builder) throws JDOMException, IOExcep
6666 return builder .build (file );
6767 }
6868 // 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.
7071 ZipFile zf = null ;
7172 try {
7273 zf = new ZipFile (file );
@@ -83,10 +84,9 @@ private Document buildDocument(SAXBuilder builder) throws JDOMException, IOExcep
8384 // of the first KML found but continue if first KML file is not in the root level then
8485 // backtrack in stream to first KML if no root-level KML is found.
8586 if (entry .getName ().toLowerCase ().endsWith (".kml" )) {
86- Document doc = builder .build (zf .getInputStream (entry ),
87- file .getAbsoluteFile ().toURI ().toString ());
8887 isKmzFile = true ;
89- return doc ;
88+ return builder .build (zf .getInputStream (entry ),
89+ file .getAbsoluteFile ().toURI ().toString ());
9090 }
9191 }
9292
@@ -108,10 +108,9 @@ private Document buildDocument(SAXBuilder builder) throws JDOMException, IOExcep
108108 out .println ("WARN: ZipFile failed [retry using ZipInputStream]: " + msg );
109109 stats .add ("WARN: " + msg );
110110 warnings ++;
111- Document doc = builder .build (zis ,
112- file .getAbsoluteFile ().toURI ().toString ());
113111 isKmzFile = true ;
114- return doc ;
112+ return builder .build (zis ,
113+ file .getAbsoluteFile ().toURI ().toString ());
115114 }
116115 }
117116 } catch (IOException ioe ) {
0 commit comments