Skip to content

Commit 86f26bf

Browse files
author
dnolen
committed
if we can't examine a zip-file just return nil
1 parent d438d07 commit 86f26bf

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/main/clojure/cljs/js_deps.cljc

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,17 @@ If no ClassLoader is provided, RT/baseLoader is assumed."
2929
distinct)))
3030

3131
(defn ^ZipFile zip-file [jar-path]
32-
(cond
33-
(instance? File jar-path) (ZipFile. ^File jar-path)
34-
(string? jar-path) (ZipFile. ^String jar-path)
35-
:else
36-
(throw
37-
(IllegalArgumentException. (str "Cannot construct zipfile from " jar-path)))))
32+
(try
33+
(cond
34+
(instance? File jar-path) (ZipFile. ^File jar-path)
35+
(string? jar-path) (ZipFile. ^String jar-path))
36+
(catch Exception _
37+
nil)))
3838

3939
(defn jar-entry-names* [jar-path]
40-
(with-open [z (zip-file jar-path)]
41-
(doall (map #(.getName ^ZipEntry %) (enumeration-seq (.entries ^ZipFile z))))))
40+
(when-let [zf (zip-file jar-path)]
41+
(with-open [z zf]
42+
(doall (map #(.getName ^ZipEntry %) (enumeration-seq (.entries ^ZipFile z)))))))
4243

4344
(def jar-entry-names (memoize jar-entry-names*))
4445

0 commit comments

Comments
 (0)