clojure.java.io/resource NPEs when the context ClassLoader is null

Description

clojure.java.io/resource assumes the current Thread's context ClassLoader will be non-null. if the Thread's context ClassLoader is null then it NPEs

(resource n (.getContextClassLoader (Thread/currentThread)))

the javadocs indicate it may reasonably be null, and i'm seeing a case in the wild where it's non-null - https://docs.oracle.com/javase/8/docs/api/java/lang/Thread.html#getContextClassLoader--

Proposed: clojure.java.io/resource should default to using (ClassLoader/getSystemClassLoader) when the context ClassLoader is null

Patch: clj-2431-2.patch

Environment

clojure 1.9

Assignee

Unassigned

Reporter

import

Labels

Approval

Prescreened

Patch

Code and Test

Affects versions

Priority

Minor