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
Summary: Adding Multibyte class name Java file fails with "The public type <class name...
Keywords:
Status: CLOSED EOL
Alias: None
Product: JBoss BRMS Platform 6
Classification: Retired
Component: Business Central
Version: 6.2.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
: ---
Assignee: manstis
QA Contact: Jiri Locker
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-12-11 08:49 UTC by Toshiya Kobayashi
Modified: 2020-03-27 19:08 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-03-27 19:08:11 UTC
Type: Bug
Embargoed:


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

Description Toshiya Kobayashi 2015-12-11 08:49:51 UTC
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 08:52:56 UTC
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 08:55:59 UTC
[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 08:57:01 UTC
Created attachment 1104594 [details]
あいうえお.java


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