xwikisas / application-confluence-migrator-pro

GNU Lesser General Public License v2.1
0 stars 5 forks source link

Recover from a failure to get the cause of an exception when building the error logs #160

Closed raphj closed 2 months ago

raphj commented 2 months ago

We've seen this exception in the error logs generated by Confluence Migrator Pro. It is unclear why it would happen and it might be a product issue. In the meantime, we need to defend against such failures.

java.lang.NullPointerException: Cannot invoke "java.util.List.iterator()" because "this.causes" is null
    at org.xwiki.store.TransactionException.printInfo(TransactionException.java:211)
    at org.xwiki.store.TransactionException.getMessage(TransactionException.java:163)
    at java.base/java.lang.Throwable.getLocalizedMessage(Unknown Source)
    at java.base/java.lang.Throwable.toString(Unknown Source)
    at java.base/java.lang.String.valueOf(Unknown Source)
    at java.base/java.lang.StringBuilder.append(Unknown Source)
    at java.base/java.lang.Throwable.printEnclosedStackTrace(Unknown Source)
    at java.base/java.lang.Throwable.printEnclosedStackTrace(Unknown Source)
    at java.base/java.lang.Throwable.printEnclosedStackTrace(Unknown Source)
    at java.base/java.lang.Throwable.printEnclosedStackTrace(Unknown Source)
    at java.base/java.lang.Throwable.printStackTrace(Unknown Source)
    at java.base/java.lang.Throwable.printStackTrace(Unknown Source)
    at org.apache.commons.lang3.exception.ExceptionUtils.getStackTrace(ExceptionUtils.java:468)
    at org.apache.commons.lang3.exception.ExceptionUtils.getStackFrames(ExceptionUtils.java:448)
    at com.xwiki.confluencepro.internal.DefaultConfluenceMigrationManager.addToJsonList(DefaultConfluenceMigrationManager.java:438)
    at com.xwiki.confluencepro.internal.DefaultConfluenceMigrationManager.addToJsonList(DefaultConfluenceMigrationManager.java:428)
    at com.xwiki.confluencepro.internal.DefaultConfluenceMigrationManager.setLogRelatedFields(DefaultConfluenceMigrationManager.java:208)
    at com.xwiki.confluencepro.internal.DefaultConfluenceMigrationManager.updateAndSaveMigration(DefaultConfluenceMigrationManager.java:124)
    at com.xwiki.confluencepro.internal.ConfluenceMigrationJob.runInternal(ConfluenceMigrationJob.java:169)
    at org.xwiki.job.AbstractJob.runInContext(AbstractJob.java:246)
    at org.xwiki.job.AbstractJob.run(AbstractJob.java:223)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.base/java.lang.Thread.run(Unknown Source)