Done
Pinned fields
Click on the next to a field label to start pinning.
Details
Assignee
Marco KaufmannMarco KaufmannReporter
Marco KaufmannMarco KaufmannComponents
Fix versions
Priority
Normal
Details
Details
Assignee
Marco Kaufmann
Marco KaufmannReporter
Marco Kaufmann
Marco KaufmannComponents
Fix versions
Priority

Sentry
Sentry
Sentry
Created March 27, 2024 at 12:13 PM
Updated October 16, 2024 at 2:06 PM
Resolved April 4, 2024 at 9:00 AM
In the project root
pom.xml
, the following dependencies need to be updated to the following versions:A change that happened in
org.sonar.api.batch.fs.internal.DefaultIndexedFile
insonar-plugin-api-impl:10.4.1.88267
makes the tests fail however.Problem description:
In API version 9.9,
DefaultIndexedFile
:was replaced in version 10.4 by:
This makes now several tests fail where
PathUtils.checkSanitize(projectRelativePath);
previously returned null, butcheckSanitize(projectRelativePath);
throws an exception.This happens due to the following constructor invocation in
java-frontend/src/test/java/org/sonar/java/TestUtils.java
andjava-symbolic-execution/src/test/java/org/sonar/java/se/utils/SETestUtils.java
:The problem here is that
file
is a file generated in the temp folder, which is not under the project foldermoduleKey
. TheTestInputFileBuilder
creates a relative path from the module folder to the temp file, which is then something like../../../../temp/foo/foo.tmp
. Sanitizing this relative path returnsnull
, which also happened before but did not throw an exception.An obvious solution which we tried is instead of inferring the
moduleBaseDir
from the project key, use this constructor and give it amoduleBaseDir
explicitly. So we changed:to:
in both classes.
This, however, made
org.sonar.java.StrutsTest
andorg.sonar.java.DefaultIndexedFile
fail. Because classes are now visited somewhat differently and in a different order, their expected metrics numbers changed (e.g.,metrics.get("classes") ... isEqualTo(146)
->metrics.get("classes") ... isEqualTo(145)
)The changes were therefore rolled back and a better solution would be to create an own implementation of
IndexedFile
with the old (or a simplified) behavior.