Wiki Markup Migration Fails with Array Out of Bounds Exception
Symptoms
When upgrading into the four series, the following error is displayed in the browser when the upgrade completes.
However, if we stop and start the Confluence service, it will come up as though everything is fine. Upon further use, there will be pages which are viewable but when edited will not show the editor.
This behavior indicates that the wiki to XHTML migration process did not complete properly for this page. If we attempt re-running the migration as described at Wiki Markup to XHTML Migration, the process fails with the following error in the UI as well as the logs.
2013-05-14 11:24:02,176 FATAL [main] [atlassian.config.lifecycle.LifecycleManager] panicAndShutdown Unable to start up Confluence. Fatal error during startup sequence: confluence.lifecycle.core:pluginframeworkdependentupgrades (Run all the upgrades that require the plugin framework to be available) - com.atlassian.confluence.content.render.xhtml.migration.exceptions.MigrationException: java.util.concurrent.ExecutionException: java.lang.ArrayIndexOutOfBoundsException: 1
com.atlassian.confluence.content.render.xhtml.migration.exceptions.MigrationException: java.util.concurrent.ExecutionException: java.lang.ArrayIndexOutOfBoundsException: 1
Diagnosis
Run the following SQL command against the database. If the result is greater then zero then we are affected and should move on to the resolution section.
SELECT COUNT(*) FROM BODYCONTENT WHERE BODY LIKE '%http://%[::]%';
Cause
There is a page which contains the text 'http://' connected to '[::]' with no spaces in between. For example, it could be 'http://atlassian.com/[::]'. A bug report has been filed with development at CONF-29291 - Getting issue details... STATUS to track a resolution.
Resolution
Step One
The following SQL command will give us an output of all the affected pages. Run it and save the output in any format (CSV for example) so we have a backup of the orignal body of the pages to refer to.
SELECT * FROM BODYCONTENT WHERE BODY LIKE '%http://%[::]%';
Step Two
The following SQL command will replace the body of the offending page(s) with the word 'safe'. This is a destructive process so copying the entries into a CSV file before running the following is advised.
Create a backup of the database before running the following SQL and ensure Confluence is shutdown
UPDATE BODYCONTENT SET BODY='safe' WHERE BODY LIKE '%http://%[::]%';
Once the above is complete, start Confluence and Re-run the wiki migration task which should complete as expected. After which, we can use the CONTENTID from the backup we made to navigate to each affected page using the following URL and manually add the original body.
Replace XXXXXX with the CONTENTID for each from the backup we created in step 1 and baseURL with the URL used to connect to Confluence
http://baseURL/pages/editpage.action?pageId=XXXXXX