FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Numerous ESAPI JUnit test failures when using JDK 9 or later · Issue #496 · ESAPI/esapi-java-legacy · GitHub

Repository navigation

Numerous ESAPI JUnit test failures when using JDK 9 or later #496

Description

When mvn test is run with JDK 9 or later, there are multiple JUnit test failures. E.g., when using OpenJDK 11, here are the failures:

[ERROR] Tests run: 19, Failures: 0, Errors: 19, Skipped: 0, Time elapsed: 1.818 s <<< FAILURE! - in org.owasp.esapi.filters.SecurityWrapperResponseTest
[ERROR] Tests run: 16, Failures: 0, Errors: 16, Skipped: 0, Time elapsed: 1.939 s <<< FAILURE! - in org.owasp.esapi.reference.DefaultValidaterDateAPITest
[ERROR] Tests run: 3, Failures: 0, Errors: 3, Skipped: 0, Time elapsed: 0.034 s <<< FAILURE! - in org.owasp.esapi.reference.crypto.EncryptedPropertiesUtilsTest
[ERROR] Tests run: 10, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.062 s <<< FAILURE! - in org.owasp.esapi.reference.crypto.ReferenceEncryptedPropertiesTest
[ERROR] Tests run: 18, Failures: 9, Errors: 9, Skipped: 0, Time elapsed: 2.012 s <<< FAILURE! - in org.owasp.esapi.reference.DefaultValidatorInputStringAPITest
[ERROR] Tests run: 4144, Failures: 0, Errors: 40, Skipped: 0

This problem seems to be related to Java Platform Module System (JPMS) which was first introduced in Java 9. (See the Guice GitHub issue referenced below.)

The first clue about this is the Maven error that appears for any Maven goal and
looks like this (at least for Maven 3.6.0):

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

which @jeremiahjstacey tracked down to Google Guice issue 1133 which has been open since 2017 and is apparently related to JPMS. Maven uses Google Guice, as does Eclipse, so we need to address these issues before Oracle JDK 8 is scheduled for end-of-life (tentatively for end of December, 2020; see https://www.oracle.com/technetwork/java/java-se-support-roadmap.html for details).

Activity

  1. kwwall commented on Jun 2, 2019

    ContributorAuthor

    Note: It appears that many of the failing tests were related to Mockito and/or Power Mock which also is likely to be affected by JPMS as well. Currently all tests are passing with OpenJDK 8. At this point it is not clear if ESAPI 2.2.0.0-RC2 or later will work everywhere expected with a JavaEE application server that uses JDK 9 or later though. If you are aware of such situations, please drop us a note here and we may kick up the priority of this. Thanks.

  2. xeno6696 commented on Aug 31, 2019

    Collaborator

    I'm not 100% sure if I've just fixed this for JDK 1.9+ but I fixed it for JDK 1.8:

    powermock/powermock#864

    Will be doing a PR soon for this issue as well as the new logic for the Referer headers.

  3. kwwall commented on Sep 1, 2019

    ContributorAuthor
  4. xeno6696 commented on Sep 1, 2019

    Collaborator

    @kwwall @jeremiahjstacey I'm not sure how we want to proceed here. I've essentially silenced our failing tests using @PowermockIgnore, however we have a dependency for when Powermock finally fixes their library.

    Do we want to leave this issue open then, since it's not technically fixed?

    Also, in every version of maven I still can't get a build to complete even using Java 1.8 because it hangs on dependency check.

  5. kwwall commented on Sep 1, 2019

    ContributorAuthor
  6. added a commit that references this issue on Oct 6, 2019
  7. noloader commented on Jul 21, 2022

    Contributor

    @kwwall, @xeno6696,

    With PR #730, I was able to build and run the self tests on Java 8 and Java 11. All tests were successful. Java 8 was always Ok, Java 11 was the problem. And that was ESAPI 2.4.0 and 2.5.0. Also see GH #721.

    I had a really bad experience with Java 17, however. Too many errors to count due to Reflection abuses.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL