Transaction issue with PageManager#deepCopyPage on 7.17.1

Hi,

Our code using PageManager#deepCopyPage stopped working on Confluence 7.17.1. Here’s a minimal working example that produces the error:

com.atlassian.sal.api.transaction.TransactionTemplate transactionTemplate = …
long contentId = …

transactionTemplate.execute(() -> {
    Page originalPage = pageManager.getPage(contentId);
    Page destinationPage = originalPage.getParent();
    PageCopyOptions options = new PageCopyOptions.Builder()
            .withPrefixNameConflictResolver(true, ThreadLocalRandom.current().nextInt(0, Integer.MAX_VALUE) + "-")
            .withProgressMeter(new ProgressMeter())
            .withUser(AuthenticatedUserThreadLocal.get())
            .build();
    pageManager.deepCopyPage(options, originalPage, destinationPage);
    return null;
})

The error is (full stacktrace + preceding log entries attached):

java.lang.IllegalStateException: Transaction not successfully started
  at org.hibernate.engine.transaction.internal.TransactionImpl.commit(TransactionImpl.java:63)
  …

deepcopypage-mwe-log.txt (41.3 KB)

Is this a bug? Any help would be appreciated.

Maximilian

2 Likes

Hi @maximilian,

Would you mind create one example plugin with the REST api that you have used to reproduce issue? That will be great for troubleshooting

Thanks,
Minh Tran

Hi @mtran ,

Here is an example plugin that demonstrates the problem. It includes the OBR file and the source code.

After installation, you can call the REST resource like so:

GET <base-url>/rest/deep-copy-test/1.0/copy?pageId=<page-id>

I hope that helps.

Best regards,
Maximilian

I don’t have an answer but I just ran into the same error. I can’t say I had anything working before Confluence 7.17.1 because this is the first version where I’ve tried it but I’m getting the same large stack trace when I run it. The odd thing is that it actually seems to work (copies the page tree). It just throws a ton of errors. Even putting the call in a try/catch block doesn’t prevent the errors.

Hoping there is a fix…

1 Like