[ 
https://issues.apache.org/jira/browse/OAK-9697?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17497543#comment-17497543
 ] 

Marcel Reutegger commented on OAK-9697:
---------------------------------------

[~arun92ram], thanks for reporting this issue. I had a quick look at the tests 
you attached.

The test {{testRestoreForItemStaleExceptionWithRemoveFlagTrue}} should indeed 
succeed and not throw an exception. As a side note, I would prefer another name 
for the test method because it designates the undesired behaviour.

The test {{testRestoreForItemExistsExceptionWithRemoveFlagFalse}} in my view 
makes an incorrect assumption. When {{removeExisting}} is {{false}} and there 
exists a conflicting node with the same identifier, then the implementation 
must throw an ItemExistsException. This is what currently happens. What the 
test could do instead is to assert the exception is thrown.

> Restore functionality with removeExisting flag true ,does not working
> ---------------------------------------------------------------------
>
>                 Key: OAK-9697
>                 URL: https://issues.apache.org/jira/browse/OAK-9697
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>            Reporter: Arun Kumar Ram
>            Priority: Major
>         Attachments: added_test_cases_for_restore_exceptions.patch
>
>
> Restore functionality when removeExisting is set to true, does not working as 
> expected. Its giving ItemStaleException.
>  
>  
> {code:java}
> javax.jcr.InvalidItemStateException: Item is stale 
> /testroot/content/www/en/home
>     at 
> org.apache.jackrabbit.oak.jcr.delegate.NodeDelegate.getTree(NodeDelegate.java:882)
>     at 
> org.apache.jackrabbit.oak.jcr.delegate.VersionManagerDelegate.restore(VersionManagerDelegate.java:141)
>     at 
> org.apache.jackrabbit.oak.jcr.version.VersionManagerImpl$1.performVoid(VersionManagerImpl.java:125)
>     at 
> org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.performVoid(SessionDelegate.java:275)
>     at 
> org.apache.jackrabbit.oak.jcr.version.VersionManagerImpl.restore(VersionManagerImpl.java:86)
> {code}
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to