You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Report creation fails with a NullPointerException.
To reproduce
Steps to reproduce the behavior.
Run the standalone jar: java -jar sonar-cnes-report-4.3.0.jar -p PROJECT_KEY -b trunk -s http://SERVER_URL:8090/
Expected behavior
A clear and concise description of what you expected to happen.
The report should complete successfully.
Screenshots & log
Stacktrace:
Exception in thread "main" java.lang.NullPointerException
at fr.cnes.sonar.report.providers.facets.AbstractFacetsProvider.extractTimeValuesFromJsonObject(AbstractFacetsProvider.java:176)
at fr.cnes.sonar.report.providers.facets.AbstractFacetsProvider.getTimeFacetsAbstract(AbstractFacetsProvider.java:143)
at fr.cnes.sonar.report.providers.facets.FacetsProviderStandalone.getTimeFacets(FacetsProviderStandalone.java:65)
at fr.cnes.sonar.report.factory.ReportModelFactory.create(ReportModelFactory.java:121)
at fr.cnes.sonar.report.ReportCommandLine.execute(ReportCommandLine.java:145)
at fr.cnes.sonar.report.ReportCommandLine.main(ReportCommandLine.java:82)
According to the stacktrace the report creation fails in fr.cnes.sonar.report.providers.facets.AbstractFacetsProvider#extractTimeValuesFromJsonObject when trying to process this json {"date":"2012-01-01T00:11:23+0100"}
User environment
Please complete the following information.
OS: [Windows 11]
Project version: [4.3.0]
Proposed fix:
Applying the following patch fixes the issue:
diff --git a/src/main/java/fr/cnes/sonar/report/providers/facets/AbstractFacetsProvider.java b/src/main/java/fr/cnes/sonar/report/providers/facets/AbstractFacetsProvider.java
index 7a38c15..111e98d 100644
--- a/src/main/java/fr/cnes/sonar/report/providers/facets/AbstractFacetsProvider.java+++ b/src/main/java/fr/cnes/sonar/report/providers/facets/AbstractFacetsProvider.java@@ -169,11 +169,12 @@ public abstract class AbstractFacetsProvider extends AbstractDataProvider {
// For each measure (date/value) inside the "history" attribute of the measure
for(JsonElement history : metric.get(HISTORY).getAsJsonArray()) {
JsonObject measure = history.getAsJsonObject();
+ // Get data as String because Word charts take Strings as input+ String value = measure.get("date").getAsString();
// Convert Date from SonarQube format to Excel
double date = DateConverter.sonarQubeDateToExcelDate(
- measure.get("date").getAsString());- // Get data as String because Word charts take Strings as input- String value = measure.get("value").getAsString();+ value);+
TimeValue v = new TimeValue(date, value);
values.add(v);
}
The text was updated successfully, but these errors were encountered:
Describe the bug
Report creation fails with a NullPointerException.
To reproduce
Run the standalone jar:
java -jar sonar-cnes-report-4.3.0.jar -p PROJECT_KEY -b trunk -s http://SERVER_URL:8090/
Expected behavior
The report should complete successfully.
Screenshots & log
According to the stacktrace the report creation fails in
fr.cnes.sonar.report.providers.facets.AbstractFacetsProvider#extractTimeValuesFromJsonObject
when trying to process this json{"date":"2012-01-01T00:11:23+0100"}
User environment
Proposed fix:
The text was updated successfully, but these errors were encountered: