jqassistant-archive / jqa-core-framework

The core framework of jQAssistant providing the infrastructure for scanners, rules, analysis and reports.
http://jqassistant.org/
GNU General Public License v3.0
23 stars 6 forks source link

If queries/constraints return strings containing special character,s HTML report task throws an error and breaks. #107

Closed hmozaffari closed 4 months ago

hmozaffari commented 4 months ago

If queries/contraints return strings with some special characters such as Unicode 0x13 following line of code throws an exception when running report task:

https://github.com/jQAssistant/jqa-core-framework/blob/ec1c6795ec0eb0a058f4f9de879b74d37dcd7f6c/report/src/main/java/com/buschmais/jqassistant/core/report/impl/HtmlReportTransformer.java#L51

ERROR: com.sun.org.apache.xml.internal.utils.WrappedRuntimeException: An invalid XML Character (Unicode: 0x13) was found in the element content of the document

Ideally should it ignore those characters when transforming XML to HTML report?

DirkMahler commented 4 months ago

Looks like invalid encoding somewhere between writing the XML report or doing the XSL transformation to HTML. Will have a look at the pipeline.

DirkMahler commented 4 months ago

Just verified but cannot reproduce (on a linux system). Can you provide a bit more context (e.g. OS, the source containing extra characters, e.g. Java class, etc), maybe even a little demonstrator project?

hmozaffari commented 4 months ago

I was using Git plugin and it happend when a commit message had 0x13 character in it. When I checked "report/jqassitant-report.xml" file I was able to find the 0x13 character in xml file but seems when it tried to transform it to html it failed. It failed both on Linux and Windows.

I guess you can reproduce it if you create a dummy neo4j node, use DC3 (0x13) character in one of its attributes like name, then create a concept or query returning that attirbute.

DirkMahler commented 4 months ago

The fix has been implemented and is available in the latest 2.3.0-SNAPSHOTS (https://oss.sonatype.org/content/repositories/snapshots/com/buschmais/jqassistant/cli/jqassistant-commandline-neo4jv5/2.3.0-SNAPSHOT/). Would you be able to verify it?

hmozaffari commented 4 months ago

To test it do I need to re-create the database with 2.3.0-SNAPSHOTS by scanning or I can import an existing database to 2.3.0-SNAPSHOT instant and just run "jqassistant report" command?

hmozaffari commented 4 months ago

I regenerated the database and performed scan, analyze, report tasks. I confirm special characters are no longer shown in XML file and report task passes. Thanks for fixing it!

DirkMahler commented 4 months ago

Thanks for the feedback!

DirkMahler commented 4 months ago

jQA 2.3.1 is now available, containing the fix.