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
4.1.0 - Standalone mode - analysis-report.docx corrupted. Microsoft Office shows that the file cannot be opened due to an error in the content.
4.0.0 - Standalone mode - analysis-report.docx is generated correctly and Microsoft Office opens the file without problems.
After making a fork of the project and debugging the code, I have been able to verify that the problem is when loading the images of the Measures section in the template.
Stacktrace:
Class: DocXExporter.java Method: replaceSimplePlaceholders()
[...] Class: PlaceHolders.java Method: loadPlaceholdersMap() > for (Measure m : report.getMeasures())
If the code that replaces the images is commented, the generated file works correctly.
// Synthesis placeholders
// for (Measure m : report.getMeasures()) {
// final String placeholder = getPlaceHolderName(m.getMetric());
// String value;
//
// // convert the metric value to a PNG if possible
// if (m.getMetric().contains(RATING)) {
// value = numberToLetter(m.getValue());
// } else if (m.getMetric().contains(STATUS)) {
// value = formatStatus(m.getValue());
// } else {
// value = m.getValue();
// }
//
// replacementValues.put(
// placeholder,
// value);
// }
// MOCK
//replacementValues.put("XX-SECURITYREVIEW-XX", "E.png");
replacementValues.put("XX-DUPLICATION-XX", "1.0");
replacementValues.put("XX-XXXXXXXXXXXXXXX-XX", "20");
replacementValues.put("XX-COMMENTDENSITY-XX", "31.0");
//replacementValues.put("XX-SECURITY-XX", "C.png");
replacementValues.put("XX-LINES-XX", "1343");
//replacementValues.put("XX-QUALITYGATE-XX", "OK.png");
//replacementValues.put("XX-RELIABILITY-XX", "E.png");
replacementValues.put("XX-COVERAGE-XX", "0.0");
//replacementValues.put("XX-MAINTAINABILITY-XX", "A.png");
If the images of the mocked code are uncommented, the file is generated corrupted.
I have tried to debug the code where the images are replaced in the template (DocXTools.java > replaceInParagraph()), but I can't identify what causes the error.
As I said, version 4.0.0 generates the file correctly. I have tried to check the differences between both versions, but the code has been refactored or moved between files and it is difficult to trace it.
Regards.
The text was updated successfully, but these errors were encountered:
Hi all,
4.1.0 - Standalone mode - analysis-report.docx corrupted. Microsoft Office shows that the file cannot be opened due to an error in the content.
4.0.0 - Standalone mode - analysis-report.docx is generated correctly and Microsoft Office opens the file without problems.
After making a fork of the project and debugging the code, I have been able to verify that the problem is when loading the images of the Measures section in the template.
Stacktrace:
Class: DocXExporter.java
Method: replaceSimplePlaceholders()
[...]
Class: PlaceHolders.java
Method: loadPlaceholdersMap() >
for (Measure m : report.getMeasures())
If the code that replaces the images is commented, the generated file works correctly.
If the images of the mocked code are uncommented, the file is generated corrupted.
I have tried to debug the code where the images are replaced in the template (
DocXTools.java > replaceInParagraph()
), but I can't identify what causes the error.As I said, version 4.0.0 generates the file correctly. I have tried to check the differences between both versions, but the code has been refactored or moved between files and it is difficult to trace it.
Regards.
The text was updated successfully, but these errors were encountered: