Bug 1038216

Summary: jcr2vfs: Java keywords in package name are migrated as is, which results in invalid package names
Product: [Retired] JBoss BRMS Platform 6 Reporter: Petr Široký <psiroky>
Component: Migration ToolAssignee: Neus Miras <nmirasch>
Status: CLOSED CURRENTRELEASE QA Contact: Petr Široký <psiroky>
Severity: high Docs Contact:
Priority: medium    
Version: 6.0.0CC: mbaluch, pzapataf
Target Milestone: ER1   
Target Release: 6.0.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: Migrating packages with Java keywords as part of the name. Consequence: After migrating the BRMS 5.3 packages to BRMS 6.0 projects, the keywords in package names are not escaped, thus making the package names invalid. Workaround is to manually rename the projects after migration or the package names before migration. Fix: Result:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-08-06 19:57:10 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
JCR repo that will reproduce the issue. none

Description Petr Široký 2013-12-04 16:08:59 UTC
Description of problem:
When a JCR package name contains Java keywords like 'package' or 'new' (complete list here: http://docs.oracle.com/javase/tutorial/java/nutsandbolts/_keywords.html) it gets migrated into a project that contains the package name as is, thus making it invalid Java package name. Following is a directory structure created by the migration tool. There seems to be a try to "escape" the package keyword, however the assets are saved in the unescaped directory. Also note that for example DRL assets contain the wrong package name (with the unescaped keyword).

|-- pom.xml
|-- project.imports
`-- src
    |-- main
    |   |-- java
    |   |   `-- keyword
    |   |       `-- _package
    |   |           `-- in
    |   |               `-- name
    |   `-- resources
    |       |-- keyword
    |       |   |-- package
    |       |   |   `-- in
    |       |   |       `-- name
    |       |   |           |-- Rule\ in\ invalid\ package.drl
    |       |   |           `-- Simple\ text\ file.txt
    |       |   `-- _package
    |       |       `-- in
    |       |           `-- name
    |       `-- META-INF
    |           `-- kmodule.xml
    `-- test
        |-- java
        |   `-- keyword
        |       `-- _package
        |           `-- in
        |               `-- name
        `-- resources
            `-- keyword
                `-- _package
                    `-- in
                        `-- name



Version-Release number of selected component (if applicable):
6.0.0-ER5 (also community 6.0.0-SNAPSHOT)

Comment 1 Neus Miras 2013-12-10 16:52:31 UTC
To be consistent with the current package name management, all the package name migrated are converted to lowercase and escaped if it has keywords before creation.

Commit:
6.0.x
https://github.com/droolsjbpm/drools-wb/commit/6a6abab9dedc23560036885eb79335816d279589

Comment 2 Neus Miras 2013-12-11 15:53:48 UTC
Resolved an associaced bug related with the package naming of the scenarios 

Commit:
https://github.com/droolsjbpm/drools-wb/commit/25b986ca8fb60642b57c153ad7b9da6f799ed0d0

Comment 3 Petr Široký 2014-01-14 12:16:09 UTC
Tested again with 6.0.0-ER7 and I am still seeing the same wrong directory structure as described above. I am attaching the repo that can be used to reproduce the issue.

Comment 4 Petr Široký 2014-01-14 12:16:50 UTC
Created attachment 849915 [details]
JCR repo that will reproduce the issue.

Comment 6 Neus Miras 2014-01-23 09:56:41 UTC
Fixed. Now adds 'mod_' to the keyword and renames the project packages too.

Commited at 6.0.x:
https://github.com/droolsjbpm/drools-wb/commit/c02c2d71a23486c98df1cf3b633b7166ef3a5ead

Comment 7 Lukáš Petrovický 2014-02-07 16:19:31 UTC
This no longer has a target release of 6.0.0.

Comment 8 Petr Široký 2014-02-20 17:24:17 UTC
I am not sure if the prefix "mod_" is the best one, but it makes it clear that the package name changed, so that is good. The issue is fixed so I am closing it. Verified in 6.0.1-ER1.