rspec/rules/S3032/java/rule.adoc
2021-04-28 18:08:03 +02:00

17 lines
360 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();
----