jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tobias Bocanegra (JIRA)" <j...@apache.org>
Subject [jira] Closed: (JCR-272) Removal of versions throws javax.jcr.ReferentialIntegrityException
Date Thu, 20 Jul 2006 10:26:15 GMT
     [ http://issues.apache.org/jira/browse/JCR-272?page=all ]

Tobias Bocanegra closed JCR-272.
--------------------------------

    Resolution: Fixed

created new testcases:

RemoveVersionTest

    /**
     * Checks if all versions but the base and root one can be removed.
     */
    public void testRemoveAllBut2();

    /**
     * Checks if all versions by the base and root one can be removed.
     */
    public void testRemoveRootVersion();

    /**
     * Checks if all versions by the base and root one can be removed.
     */
    public void testRemoveBaseVersion();


and all succeed. i reckon this was fixed along the lines of some other versioning bugs.

> Removal of versions throws javax.jcr.ReferentialIntegrityException
> ------------------------------------------------------------------
>
>                 Key: JCR-272
>                 URL: http://issues.apache.org/jira/browse/JCR-272
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: versioning
>    Affects Versions: 0.9, 1.0
>         Environment: CVS build (2005-11-16) and DerbyPersistenceManager
>            Reporter: Nicolas Belisle
>         Assigned To: Tobias Bocanegra
>             Fix For: 1.1
>
>
> From the following thread : http://www.mail-archive.com/jackrabbit-dev%40incubator.apache.org/msg03483.html
> When trying to remove a version of a Node  the VersionHistory.removeVersion() method
throws : "javax.jcr.ReferentialIntegrityException: Unable to remove version. At least once
referenced.".
> Secton 8.2.2.10 (Removal of Versions) of the specification indicates that the version
graph should be automatically repaired upon removal. Then, VersionHistory.removeVersion()
should take care of references. (In fact, a user cannot alter the references (jcr:predecessors
and jcr:successors), since they are protected properties.)
> Here's the example (*updated) :
> Node root1 = session.getRootNode() ;
> Node test1 = root1.addNode("test") ;
> test1.addMixin("mix:versionable");
> test1.setProperty("test", "1");
> session.save();
> test1.checkin();
> test1.checkout();
> test1.setProperty("test", "2");
> session.save();
> test1.checkin();
> test1.checkout();
> test1.setProperty("test", "3");
> session.save();
> test1.checkin();
> String baseVersion = test1.getBaseVersion().getName();
> System.out.println("Base version name: " + baseVersion);
> VersionHistory vh = test1.getVersionHistory();
> for (VersionIterator vi = vh.getAllVersions(); vi.hasNext(); ) {
>     Version currenVersion = vi.nextVersion();
>     String versionName = currenVersion.getName();
>     if (!versionName.equals("jcr:rootVersion") && !versionName.equals(baseVersion))
{ 
>         String propertyValue = currenVersion.getNode("jcr:frozenNode").getProperty("test").getString();
>         System.out.println("Removing version : " + versionName + " with value: " + propertyValue);
>         vh.removeVersion(versionName);
>     }
> }
> Regards, 
> Nicolas

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message