25 lines
521 B
Plaintext
25 lines
521 B
Plaintext
Using the standard ``++getClassLoader()++`` may not return the _right_ class loader in a JEE context. Instead, go through the ``++currentThread++``.
|
|
|
|
|
|
== Noncompliant Code Example
|
|
|
|
----
|
|
ClassLoader cl = this.getClass().getClassLoader(); // Noncompliant
|
|
----
|
|
|
|
|
|
== Compliant Solution
|
|
|
|
----
|
|
ClassLoader cl = Thread.currentThread().getContextClassLoader();
|
|
----
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::comments-and-links.adoc[]
|
|
endif::env-github,rspecator-view[]
|