[
https://issues.jboss.org/browse/DROOLS-3402?page=com.atlassian.jira.plugi...
]
Mario Fusco commented on DROOLS-3402:
-------------------------------------
I cannot reproduce this problem. I tried both
{code}
@Test
public void testConsequence() {
// DROOLS-3402
String drl =
"import " + Person.class.getCanonicalName() + ";\n" +
"rule R when\n" +
" $p : Person()\n" +
"then\n" +
" $p.setName(\"Rückfrage\");\n" +
"end";
KieSession ksession = new KieHelper().addContent( drl, ResourceType.DRL
).build().newKieSession();
Person p = new Person();
ksession.insert(p);
int fired = ksession.fireAllRules();
assertEquals(1, fired);
assertEquals("Rückfrage", p.getName());
System.out.println(p.getName());
ksession.dispose();
}
{code}
and
{code}
@Test
public void testConsequence2() {
// DROOLS-3402
KieServices kieServices = KieServices.Factory.get();
KieFileSystem kieFileSystem = kieServices.newKieFileSystem();
kieFileSystem.write(ResourceFactory.newClassPathResource("org/drools/compiler/compiler/i18n.drl",
"UTF-8"));
KieBuilder kieBuilder = kieServices.newKieBuilder(kieFileSystem);
kieBuilder.buildAll();
KieModule kieModule = kieBuilder.getKieModule();
KieContainer kieContainer =
kieServices.newKieContainer(kieModule.getReleaseId());
KieSession ksession = kieContainer.newKieSession();
Person p = new Person();
ksession.insert(p);
int fired = ksession.fireAllRules();
assertEquals(1, fired);
assertEquals("Rückfrage", p.getName());
System.out.println(p.getName());
ksession.dispose();
}
{code}
and both test cases are ok for me. I believe that the problem is related to some local
setting of your environment/operating system. If you can send me a proper reproducer feel
free to reopen this ticket.
Encoding set in constructor not taking effect
---------------------------------------------
Key: DROOLS-3402
URL:
https://issues.jboss.org/browse/DROOLS-3402
Project: Drools
Issue Type: Bug
Affects Versions: 7.13.0.Final
Reporter: Barnabás Kurucz
Assignee: Mario Fusco
Priority: Major
In my drl file, I'm using German characters such as Umlauts or ß. Thus, I am setting
the encoding to UTF-8 with the overloaded constructor when creating the Resource for the
Kie File System. However, after firing the rules on the inserted Fact Drools does not seem
to apply the specified encoding. I insert the fact, and if the condition is true to that
fact it should modify the Action1 (String) attribute of the fact to "Rückfrage"
and return the modified fact. However, when I look at the retrieved bean's Action1
attribute I am seeing "Rückfrage" instead of "Rückfrage". I tried
both UTF-8 and ISO-8859-1 encoding. Any ideas what's wrong?
Drools 7.13
*KieSessionGenerator*:
public KieSessionGenerator() {
KieServices kieServices = KieServices.Factory.get();
KieFileSystem kieFileSystem = kieServices.newKieFileSystem();
kieFileSystem.write(ResourceFactory.newClassPathResource(drlFile,
"UTF-8"));
KieBuilder kieBuilder = kieServices.newKieBuilder(kieFileSystem);
kieBuilder.buildAll();
KieModule kieModule = kieBuilder.getKieModule();
KieContainer kieContainer = kieServices.newKieContainer(kieModule.getReleaseId());
kieSession = kieContainer.newKieSession();
}
*Snippet from DRL:*
rule "813"
when
$bean : Bean(longDesc == "Infektion")
then
$bean.setAction1("Rückfrage");
end
*Inserting the fact:*
public Bean lookupBean(Bean bean) {
kieSessionGenerator.getKieSession().insert(bean);
kieSessionGenerator.getKieSession().fireAllRules();
return bean;
}
--
This message was sent by Atlassian Jira
(v7.12.1#712002)