Bug 751744 - Package-tree corruption after migration from BRMS 5.1.0 to 5.2.0
Summary: Package-tree corruption after migration from BRMS 5.1.0 to 5.2.0
Keywords:
Status: VERIFIED
Alias: None
Product: JBoss Enterprise BRMS Platform 5
Classification: JBoss
Component: BRM (Guvnor)
Version: BRMS 5.2.0.GA
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ER6
: BRMS 5.3.0.GA
Assignee: Mark Proctor
QA Contact: Lukáš Petrovický
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-11-07 12:33 UTC by Toshiya Kobayashi
Modified: 2020-04-27 01:12 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: ---


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 756802 0 unspecified VERIFIED Snapshot disappears after migration from BRMS 5.1.0 to 5.2.0. 2021-02-22 00:41:40 UTC
Red Hat Issue Tracker GUVNOR-1736 0 Major Resolved Package-tree corruption after migration from Drools 5.1.1 to 5.2.0/5.3.0 2013-10-30 19:41:32 UTC

Description Toshiya Kobayashi 2011-11-07 12:33:46 UTC
Package-tree in 'Knowledge Bases' panel may corrupt after they export/import a repository from BRMS 5.1.0 to 5.2.0.

You can reproduce it by:

- Start up BRMS 5.1.0 and install mortgages example
- 'Copy' mortgages package as 'newpackage' package
- Export the repository
- Start up BRMS 5.2.0
- Import the exported repository
- You will see duplicate 'mortgages' packages in package-tree

In BRMS 5.1.0, when you copy a package, the title of a new package would be just copied from the old title(= old package name).

org.drools.repository.RulesRepository

    public void copyPackage(String sourcePackageName,
                            String destPackageName) {
        PackageItem source = loadPackage( sourcePackageName );
        String sourcePath;

        try {
            sourcePath = source.getNode().getPath();

            String destPath = source.getNode().getParent().getPath() + "/" + destPackageName;
            if ( this.getAreaNode( RULE_PACKAGE_AREA ).hasNode( destPackageName ) ) {
                throw new RulesRepositoryException( "Destination already exists." );
            }
            this.session.getWorkspace().copy( sourcePath,
                                              destPath );

            PackageItem newPkg = loadPackage( destPackageName );

            for ( Iterator iter = newPkg.getAssets(); iter.hasNext(); ) {
                AssetItem as = (AssetItem) iter.next();
                as.updateStringProperty( destPackageName,
                                         AssetItem.PACKAGE_NAME_PROPERTY );
            }

            save();

        } catch ( RepositoryException e ) {
            log.error( e.getMessage(), e );
            throw new RulesRepositoryException( e );
        }

    }

# In BRMS 5.2.0, the title will be filled with the new package name

As long as you use BRMS 5.1.0, this is not a problem because PackageConfigData.name is filled with PackageItem.getName().

org.drools.guvnor.server.ServiceImplementation

    private PackageConfigData[] listPackages(boolean archive,
                                             RepositoryFilter filter) {
        List<PackageConfigData> result = new ArrayList<PackageConfigData>();
        PackageIterator pkgs = repository.listPackages();
        pkgs.setArchivedIterator( archive );
        while ( pkgs.hasNext() ) {
            PackageItem pkg = pkgs.next();

            PackageConfigData data = new PackageConfigData();
            data.uuid = pkg.getUUID();
            data.name = pkg.getName();
...
org.drools.repository.VersionableItem

        public String getName() {
                try {
                        return getVersionContentNode().getName();
                } catch (RepositoryException e) {
                        throw new RulesRepositoryException(e);
                }
        }

But In BRMS 5.2.0, PackageItem.getName() returns getTitle().

org.drools.repository.VersionableItem

    public String getName() {
        return getTitle();
    }

That is the cause of the corruption.

Comment 1 Jervis Liu 2012-02-22 03:25:07 UTC
As the exported repository file was created by guvnor 5.1 which has the
drools:title value set incorrectly, the only solution we can provide to
customers is this workaround:

Before exporting the repository, do a package rename. This should fix the package 
drools:title attribute.

Comment 3 Lukáš Petrovický 2012-05-17 13:33:40 UTC
Nothing to verify here.


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