Bug 1108994 - "Debug As Drools Application" doesn't honour Eclipse encoding settings
Summary: "Debug As Drools Application" doesn't honour Eclipse encoding settings
Keywords:
Status: CLOSED EOL
Alias: None
Product: JBoss BRMS Platform 6
Classification: Retired
Component: Eclipse Tooling
Version: 6.0.1
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: ---
Assignee: Kris Verlaenen
QA Contact: Tomas David
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-06-13 04:34 UTC by Toshiya Kobayashi
Modified: 2020-03-27 20:01 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2020-03-27 20:01:14 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
multi-byte-rulename.zip (11.75 KB, application/zip)
2014-10-07 01:34 UTC, Toshiya Kobayashi
no flags Details

Description Toshiya Kobayashi 2014-06-13 04:34:23 UTC
Description of problem:

"Run As Java Application" honours Eclipse encoding settings, which you can configure at Workspace / Project / Run Configuration levels. But "Debug As Drools Application" picks up OS LOCALE regardless of Eclipse settings.


Steps to Reproduce:
1. export LANG=C
2. Start JBDS 7
3. Import attached multi-byte-rulename.zip
4. Confirm that your project encoding is UTF-8 ([Resource]->"Text file encoding")
5. "Run As Java Application" DroolsTest. Confirm that file.encoding is UTF-8
---
file.encoding : UTF-8
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Hello World
Goodbye cruel world
---
6. "Debug As Drools Application" DroolsTest

Actual results:
file.encoding is ANSI_X3.4-1968. Execution fails.

---
file.encoding : ANSI_X3.4-1968
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
java.lang.RuntimeException: Error while creating KieBase[Message [id=1, level=ERROR, path=rules/Sample.drl, line=20, column=0
   text=Duplicate rule name: ???????????????]]
	at org.drools.compiler.kie.builder.impl.KieContainerImpl.getKieBase(KieContainerImpl.java:337)
	at org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:486)
	at org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:457)
	at com.sample.DroolsTest.main(DroolsTest.java:20)
---

Expected results:

file.encoding is UTF-8. Execution works. And you can debug DRL.

Additional info:

There are 2 workarounds.

- Set UTF-8 as OS LOCALE (e.g. export LANG=ja_JP.UTF-8) before launching JBDS
or
- Set "-Dfile.encoding=UTF-8" in "VM arguments" section in "Arguments" tab in "Debug Configuration"

Comment 1 Tomas David 2014-10-06 10:21:29 UTC
I followed the steps, but I cannot get the exception. I tried it on 6.0.1.Final and 6.1.0.Final and it works fine.

I am not sure if I can verify this, because it can depend on different environment.

Toshiya, could you test this issue on 6.1.0.Final, please?

Thanks.

Tomas D.

Comment 2 Toshiya Kobayashi 2014-10-07 01:34:37 UTC
Created attachment 944434 [details]
multi-byte-rulename.zip

Comment 3 Toshiya Kobayashi 2014-10-07 01:37:01 UTC
Ohh, very sorry, I forgot to attach the example. Now attached (multi-byte-rulename.zip).

I tested with:

- JBDS 7.1.1 + Drools plugin (JBoss Drools Core 6.0.3.201406040014)
- Eclipse Luna Service Release 1 (4.4.1) + Drools plugin (JBoss Drools Core 6.1.0.Final)

and still reproduced in both versions.

The main point is

- If OS locale is not UTF-8, (export LANG=C)
- "Debug As Drools Application"
- file.encoding is picked from OS locale (ANSI_X3.4-1968)
- The RuntimeException is a side effect of the wrong file.encoding

So it's not very environment specific. I think you can reproduce the issue on your side as well.

Could you try with the attached multi-byte-rulename.zip?

Regards,
Toshiya

Comment 4 Tomas David 2014-10-07 07:38:35 UTC
Thank you Toshiya.

I finally got the exception with attached zip.

So the problem is still in 6.1.0.Final.

Thanks again.

Tomas D.


Note You need to log in before you can comment on or make changes to this bug.