DependencyCheck icon indicating copy to clipboard operation
DependencyCheck copied to clipboard

Change mocking framework to be Java 11+ compatible

Open aikebah opened this issue 1 year ago • 0 comments

Uncovered in the attempts to upgrade to Java 11: The JMockit library is not compatible with modern java, causing JaCoCo to run into IndexOutOfBoundExceptions in coverage analysis

See also https://github.com/jacoco/jacoco/issues/896#issuecomment-500944865

Changing <jacoco-maven-plugin.version>0.8.12</jacoco-maven-plugin.version> to <jacoco-maven-plugin.version>0.8.3</jacoco-maven-plugin.version> resolves

[ERROR] Errors: 
[ERROR] org.owasp.dependencycheck.AnalysisTaskTest.shouldAnalyzeReturnsFalseIfTheFileTypeAnalyzerDoesNotAcceptTheDependency
[ERROR]   Run 1: AnalysisTaskTest.shouldAnalyzeReturnsFalseIfTheFileTypeAnalyzerDoesNotAcceptTheDependency » ArrayIndexOutOfBounds Index 2562 out of bounds for length 777
[ERROR]   Run 2: AnalysisTaskTest.shouldAnalyzeReturnsFalseIfTheFileTypeAnalyzerDoesNotAcceptTheDependency » ArrayIndexOutOfBounds Index 2562 out of bounds for length 777
[INFO] 
[ERROR] org.owasp.dependencycheck.AnalysisTaskTest.shouldAnalyzeReturnsTrueForNonFileTypeAnalyzers
[ERROR]   Run 1: AnalysisTaskTest.shouldAnalyzeReturnsTrueForNonFileTypeAnalyzers » ArrayIndexOutOfBounds Index 2562 out of bounds for length 777
[ERROR]   Run 2: AnalysisTaskTest.shouldAnalyzeReturnsTrueForNonFileTypeAnalyzers » ArrayIndexOutOfBounds Index 2562 out of bounds for length 777
[INFO] 
[ERROR] org.owasp.dependencycheck.AnalysisTaskTest.shouldAnalyzeReturnsTrueIfTheFileTypeAnalyzersAcceptsTheDependency
[ERROR]   Run 1: AnalysisTaskTest.shouldAnalyzeReturnsTrueIfTheFileTypeAnalyzersAcceptsTheDependency » ArrayIndexOutOfBounds Index 2562 out of bounds for length 777
[ERROR]   Run 2: AnalysisTaskTest.shouldAnalyzeReturnsTrueIfTheFileTypeAnalyzersAcceptsTheDependency » ArrayIndexOutOfBounds Index 2562 out of bounds for length 777
[INFO] 
[ERROR] org.owasp.dependencycheck.AnalysisTaskTest.taskAnalyzes
[ERROR]   Run 1: AnalysisTaskTest.taskAnalyzes » ArrayIndexOutOfBounds Index 2562 out of bounds for length 777
[ERROR]   Run 2: AnalysisTaskTest.taskAnalyzes » ArrayIndexOutOfBounds Index 2562 out of bounds for length 777
[INFO] 
[ERROR] org.owasp.dependencycheck.AnalysisTaskTest.taskDoesNothingIfItShouldNotAnalyze
[ERROR]   Run 1: AnalysisTaskTest.taskDoesNothingIfItShouldNotAnalyze » ArrayIndexOutOfBounds Index 2562 out of bounds for length 777
[ERROR]   Run 2: AnalysisTaskTest.taskDoesNothingIfItShouldNotAnalyze » ArrayIndexOutOfBounds Index 2562 out of bounds for length 777
[INFO] 
[ERROR] org.owasp.dependencycheck.analyzer.DependencyBundlingAnalyzerTest.testAnalyze
[ERROR]   Run 1: DependencyBundlingAnalyzerTest.testAnalyze » ArrayIndexOutOfBounds Index 3588 out of bounds for length 1169
[ERROR]   Run 2: DependencyBundlingAnalyzerTest.testAnalyze » ArrayIndexOutOfBounds Index 3588 out of bounds for length 1169
[INFO] 
[ERROR] org.owasp.dependencycheck.analyzer.DependencyBundlingAnalyzerTest.testFirstPathIsShortest
[ERROR]   Run 1: DependencyBundlingAnalyzerTest.testFirstPathIsShortest » ArrayIndexOutOfBounds Index 3588 out of bounds for length 1169
[ERROR]   Run 2: DependencyBundlingAnalyzerTest.testFirstPathIsShortest » ArrayIndexOutOfBounds Index 3588 out of bounds for length 1169
[INFO] 
[ERROR] org.owasp.dependencycheck.analyzer.DependencyBundlingAnalyzerTest.testGetAnalysisPhase
[ERROR]   Run 1: DependencyBundlingAnalyzerTest.testGetAnalysisPhase » ArrayIndexOutOfBounds Index 3588 out of bounds for length 1169
[ERROR]   Run 2: DependencyBundlingAnalyzerTest.testGetAnalysisPhase » ArrayIndexOutOfBounds Index 3588 out of bounds for length 1169
[INFO] 
[ERROR] org.owasp.dependencycheck.analyzer.DependencyBundlingAnalyzerTest.testGetName
[ERROR]   Run 1: DependencyBundlingAnalyzerTest.testGetName » ArrayIndexOutOfBounds Index 3588 out of bounds for length 1169
[ERROR]   Run 2: DependencyBundlingAnalyzerTest.testGetName » ArrayIndexOutOfBounds Index 3588 out of bounds for length 1169
[INFO] 
[ERROR] org.owasp.dependencycheck.analyzer.DependencyBundlingAnalyzerTest.testIsCore
[ERROR]   Run 1: DependencyBundlingAnalyzerTest.testIsCore » ArrayIndexOutOfBounds Index 3588 out of bounds for length 1169
[ERROR]   Run 2: DependencyBundlingAnalyzerTest.testIsCore » ArrayIndexOutOfBounds Index 3588 out of bounds for length 1169
[INFO] 
[ERROR] org.owasp.dependencycheck.analyzer.DependencyBundlingAnalyzerTest.testIsShaded
[ERROR]   Run 1: DependencyBundlingAnalyzerTest.testIsShaded » ArrayIndexOutOfBounds Index 3588 out of bounds for length 1169
[ERROR]   Run 2: DependencyBundlingAnalyzerTest.testIsShaded » ArrayIndexOutOfBounds Index 3588 out of bounds for length 1169
[INFO] 
[ERROR] org.owasp.dependencycheck.analyzer.DependencyBundlingAnalyzerTest.testIsWebJar
[ERROR]   Run 1: DependencyBundlingAnalyzerTest.testIsWebJar » ArrayIndexOutOfBounds Index 3588 out of bounds for length 1169
[ERROR]   Run 2: DependencyBundlingAnalyzerTest.testIsWebJar » ArrayIndexOutOfBounds Index 3588 out of bounds for length 1169
[INFO] 
[ERROR] org.owasp.dependencycheck.data.update.EngineVersionCheckTest.testGetCurrentReleaseVersion
[ERROR]   Run 1: EngineVersionCheckTest.testGetCurrentReleaseVersion » ArrayIndexOutOfBounds Index 3849 out of bounds for length 2392
[ERROR]   Run 2: EngineVersionCheckTest.testGetCurrentReleaseVersion » ArrayIndexOutOfBounds Index 3849 out of bounds for length 2392
[INFO] 
[ERROR] org.owasp.dependencycheck.data.update.EngineVersionCheckTest.testShouldUpdate
[ERROR]   Run 1: EngineVersionCheckTest.testShouldUpdate » ArrayIndexOutOfBounds Index 3849 out of bounds for length 2392
[ERROR]   Run 2: EngineVersionCheckTest.testShouldUpdate » ArrayIndexOutOfBounds Index 3849 out of bounds for length 2392

Indicating that the test-failures I see locally are caused by this outdated and apparently unmaintained (see e.g. discussion on https://github.com/jmockit/jmockit1/issues/729) Mock library

aikebah avatar Jul 06 '24 10:07 aikebah