[ 
https://issues.apache.org/jira/browse/JCR-4549?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Julian Reschke updated JCR-4549:
--------------------------------
    Labels: candidate_jcr_2_16  (was: candidate_jcr_2_18)

> backup with RepositoryCopier.copy() fails on second method call
> ---------------------------------------------------------------
>
>                 Key: JCR-4549
>                 URL: https://issues.apache.org/jira/browse/JCR-4549
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 2.21.0
>            Reporter: Filipe Roque
>            Assignee: Julian Reschke
>            Priority: Major
>              Labels: candidate_jcr_2_16
>             Fix For: 2.20.1, 2.22, 2.21.1, 2.18.6
>
>         Attachments: JCR-4549.diff
>
>
> I am trying to backup a jackrabbit repository with a quartz cron scheduler. 
> The target repository is then zipped, and deleted. 
>  
> The first time it works fine, but all subsequent backups fail with:
> {code:java}
> javax.jcr.RepositoryException: Failed to copy content
>       at 
> org.apache.jackrabbit.core.RepositoryCopier.copy(RepositoryCopier.java:210)
>       at 
> org.apache.jackrabbit.core.RepositoryCopier.copy(RepositoryCopier.java:150)
>       at 
> org.apache.jackrabbit.core.RepositoryCopier.copy(RepositoryCopier.java:132)
>       at 
> org.apache.jackrabbit.core.RepositoryCopierTest.testRepositoryCopyWithDeleteTarget(RepositoryCopierTest.java:92)
>       at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>       at 
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>       at java.base/java.lang.reflect.Method.invoke(Method.java:566)
>       at junit.framework.TestCase.runTest(TestCase.java:176)
>       at junit.framework.TestCase.runBare(TestCase.java:141)
>       at junit.framework.TestResult$1.protect(TestResult.java:122)
>       at junit.framework.TestResult.runProtected(TestResult.java:142)
>       at junit.framework.TestResult.run(TestResult.java:125)
>       at junit.framework.TestCase.run(TestCase.java:129)
>       at junit.framework.TestSuite.runTest(TestSuite.java:252)
>       at junit.framework.TestSuite.run(TestSuite.java:247)
>       at 
> org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:86)
>       at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
>       at 
> com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
>       at 
> com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
>       at 
> com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
>       at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)
> Caused by: org.apache.jackrabbit.core.data.DataStoreException: Record 
> 6a68c154fa43477a0d7386e8ba0e9c33a2e7b2060cf43188a16421b03dd5a839 does not 
> exist
>       at 
> org.apache.jackrabbit.core.data.AbstractDataStore.getRecord(AbstractDataStore.java:59)
>       at 
> org.apache.jackrabbit.core.value.BLOBInDataStore.getDataRecord(BLOBInDataStore.java:151)
>       at 
> org.apache.jackrabbit.core.value.BLOBInDataStore.getStream(BLOBInDataStore.java:104)
>       at 
> org.apache.jackrabbit.core.value.InternalValue.getStream(InternalValue.java:662)
>       at 
> org.apache.jackrabbit.core.persistence.PersistenceCopier.copy(PersistenceCopier.java:157)
>       at 
> org.apache.jackrabbit.core.persistence.PersistenceCopier.copy(PersistenceCopier.java:114)
>       at 
> org.apache.jackrabbit.core.persistence.PersistenceCopier.copy(PersistenceCopier.java:111)
>       at 
> org.apache.jackrabbit.core.RepositoryCopier.copyWorkspaces(RepositoryCopier.java:276)
>       at 
> org.apache.jackrabbit.core.RepositoryCopier.copy(RepositoryCopier.java:208)
>       ... 21 more
> {code}
> From my analysis, the copy method in PersistenceCopier is changing the source 
> values in
> {code}
> InternalValue[] values = sourceState.getValues();
> if (sourceState.getType() == PropertyType.BINARY) {
>     for (int i = 0; i < values.length; i++) {
>         InputStream stream = values[i].getStream();
>         try {
>             values[i] = InternalValue.create(stream, store);
>         } finally {
>             stream.close();
>         }
>     }
> }
> targetState.setValues(values);
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to