This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 1290721 - Adding Multibyte class name Java file fails with "The public type <class name> must be defined in its own file" in business-central
Adding Multibyte class name Java file fails with "The public type <class name...
Status: NEW
Product: JBoss BRMS Platform 6
Classification: JBoss
Component: Business Central (Show other bugs)
6.2.0
Unspecified Unspecified
unspecified Severity high
: ---
: ---
Assigned To: manstis
Jiri Locker
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-12-11 03:49 EST by Toshiya Kobayashi
Modified: 2016-01-07 18:52 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
あいうえお.java (215 bytes, text/plain)
2015-12-11 03:57 EST, Toshiya Kobayashi
no flags Details

  None (edit)
Description Toshiya Kobayashi 2015-12-11 03:49:51 EST
Description of problem:

If you add a multibyte class name Java file (e.g. あいうえお.java) to a project using "git push", the project fails to build. The error messages are displayed in "Messages" pane.

======
The public type あいうえお must be defined in its own file | あいうえお.java
The type あいうえお collides with a package | あいうえお.java
======

No error is logged in server.log.

Note: You cannot create a multibyte class name Java file by Data Objects Editor. This issue can be reproduced by pushing the local Java file via git.



Steps to Reproduce:

1. Login to business-central
2. Clone a repository (e.g. 'repository1') to local filesystem by ssh git clone (e.g. git clone ssh://brmsAdmin@localhost:8001/repository1)
3. Add a multibyte class name Java file (e.g. あいうえお.java attached to this BZ for your convenience) to local filesystem (e.g. /repository1/project1/src/main/java/org/kie/example/project1/あいうえお.java)
4. git add, commit and push
5. Confirm that "あいうえお" exists under Project Explorer "DATA OBJECTS"
5. "Build&Deploy" in business-central

Actual results:

Build failed with the messages
=====
The public type あいうえお must be defined in its own file | あいうえお.java
The type あいうえお collides with a package | あいうえお.java
=====

Expected results:

Build successful and we can use the class for rules.
Comment 1 Toshiya Kobayashi 2015-12-11 03:52:56 EST
Note: We can use a multibyte class name Java file and multibyte filed name in simple Drools use case. https://github.com/droolsjbpm/drools/blob/master/drools-compiler/src/test/java/org/drools/compiler/integrationtests/I18nTest.java covers only multibyte filed name though.
Comment 2 Toshiya Kobayashi 2015-12-11 03:55:59 EST
[Analysis]

The error is raised in KieBuilderImpl.compileJavaClasses() because KieBuilderImpl.srcMfs stores the java file (あいうえお.java) path as URL encoded path "src/main/java/org/kie/example/project1/%E3%81%82%E3%81%84%E3%81%86%E3%81%88%E3%81%8A.java". So failed in compilation. 

URL encoding is done by EncodingUtil.encodePath()

Daemon Thread [http-localhost.localdomain/127.0.0.1:8080-4] (Suspended (breakpoint at line 238 in EncodingUtil))	
	EncodingUtil.encodePath(String) line: 238	
	JGitPathImpl(AbstractPath<FS>).encodePath(String) line: 256	
	JGitPathImpl(AbstractPath<FS>).toURIString() line: 252	
	JGitPathImpl(AbstractPath<FS>).toUri() line: 243	
	Builder.visitPaths(DirectoryStream<Path>) line: 574	
	Builder.visitPaths(DirectoryStream<Path>) line: 560	
	Builder.visitPaths(DirectoryStream<Path>) line: 560	
	Builder.visitPaths(DirectoryStream<Path>) line: 560	
	Builder.visitPaths(DirectoryStream<Path>) line: 560	
	Builder.visitPaths(DirectoryStream<Path>) line: 560	
	Builder.visitPaths(DirectoryStream<Path>) line: 560	
	Builder.visitPaths(DirectoryStream<Path>) line: 560	
	Builder.<init>(Project, IOService, KieProjectService, ProjectImportsService, List<BuildValidationHelper>, PackageNameWhiteList, LRUProjectDependenciesClassLoaderCache, LRUPomModelCache) line: 141	
	LRUBuilderCache.assertBuilder(Project) line: 93	
	LRUBuilderCache$Proxy$_$$_WeldClientProxy.assertBuilder(Project) line: not available	
	BuildServiceImpl.doBuild(Project) line: 173	
...
Comment 3 Toshiya Kobayashi 2015-12-11 03:57 EST
Created attachment 1104594 [details]
あいうえお.java

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