[jboss-jira] [JBoss JIRA] (DROOLS-4662) Resources added through KieHelper get interpreted using the default character set

Max Zerzouri (Jira) issues at jboss.org
Sun Oct 20 22:49:00 EDT 2019


Max Zerzouri created DROOLS-4662:
------------------------------------

             Summary: Resources added through KieHelper get interpreted using the default character set
                 Key: DROOLS-4662
                 URL: https://issues.jboss.org/browse/DROOLS-4662
             Project: Drools
          Issue Type: Bug
         Environment: Windows. Can be reproduced on other OSes using "-Dfile.encoding=latin1".
            Reporter: Max Zerzouri
            Assignee: Mario Fusco
         Attachments: Test.java

When a resource is added using {{KieHelper.addResource}}, any specified encoding is ignored when it is added to the {{MemoryFileSystem}} by {{KieFileSystemImpl.write(Resource)}} (effectively assuming the {{InputStream}} is already encoded in UTF-8).

Additionally, when the resource is read again by {{AbstractKieModule.getResource}}, it constructs a {{Resource}} object with no encoding specified, whereas it should probably specify an encoding of UTF-8, since it seems that sources are considered to be UTF-8 already at least in the case of the {{MemoryKieModule}}.

I've attached a fairly minimal test case where the rules bytes are passed in UTF-8 with the encoding explicitly specified. This currently produces an error when the default file encoding is not UTF-8 (eg, by passing {{-Dfile.encoding=latin1}} as a JVM argument, or by using the default arguments on Windows).



--
This message was sent by Atlassian Jira
(v7.13.8#713008)


More information about the jboss-jira mailing list