Confluence doesn't import ZIP file and logs error
Asked by Luke:

Exported a space from Atlassian (self-hosted) v6.1.2, copied the zip file to the file system on our confluence server (self-hosted 6.1.3). Selected import, pressed "Import" and it eventually returned to the Pages view with nothing imported.

The atlassian log records a massive call-stack (I removed the middle 100 odd lines!) incuding:

```
2017-11-15 17:43:14,837 ERROR [http-nio-8090-exec-21] [confluence.spaces.actions.ImportPagesAction] execute An error occurred importing: /home/luke/import/Confluence-space-export-170851-34.xml.zip
 -- space: 16678915 | url: /spaces/doimportpages.action | traceId: d124b0c818177d40 | userName: luke | referer: https://SNIP/spaces/importpages.action?key=W1P | action: doimportpages
java.lang.RuntimeException: org.owasp.validator.html.ScanException: java.lang.ArrayIndexOutOfBoundsException: 1
 at com.atlassian.confluence.content.render.xhtml.PolicyConfiguredCleaner.antiSamyClean(PolicyConfiguredCleaner.java:190)
 at com.atlassian.confluence.content.render.xhtml.PolicyConfiguredCleaner.cleanEntityBody(PolicyConfiguredCleaner.java:140)
 at com.atlassian.confluence.content.render.xhtml.PolicyConfiguredCleaner.cleanQuietlyWithLogging(PolicyConfiguredCleaner.java:149)
 at com.atlassian.confluence.content.render.xhtml.PolicyConfiguredCleaner.cleanQuietly(PolicyConfiguredCleaner.java:76)
 at com.atlassian.confluence.content.render.xhtml.storage.XhtmlCleaningInterceptor$1.clean(XhtmlCleaningInterceptor.java:32)
 at com.atlassian.confluence.core.BodyContent.cleanBody(BodyContent.java:122)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
 at com.atlassian.confluence.servlet.FourOhFourErrorLoggingFilter.doFilter(FourOhFourErrorLoggingFilter.java:64)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
 at com.atlassian.confluence.web.filter.DebugFilter.doFilter(DebugFilter.java:46)
 at com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94)
 at org.apache.catalina.valves.StuckThreadDetectionValve.invoke(StuckThreadDetectionValve.java:206)
 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:509)
 at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1104)
 at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
 at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1524)
 at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1480)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
 at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
 at java.lang.Thread.run(Thread.java:745)
Caused by: org.owasp.validator.html.ScanException: java.lang.ArrayIndexOutOfBoundsException: 1
 at org.owasp.validator.html.scan.AntiSamySAXScanner.scan(AntiSamySAXScanner.java:159)
 at org.owasp.validator.html.AntiSamy.scan(AntiSamy.java:101)
 at org.owasp.validator.html.AntiSamy.scan(AntiSamy.java:78)
 at com.atlassian.confluence.content.render.xhtml.PolicyConfiguredCleaner.antiSamyClean(PolicyConfiguredCleaner.java:174)
 ... 426 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
 at org.owasp.validator.html.scan.MagicSAXFilter.getLocalPartOfAttribute(MagicSAXFilter.java:528)
 at org.owasp.validator.html.scan.MagicSAXFilter.startElement(MagicSAXFilter.java:359)
 at org.cyberneko.html.HTMLTagBalancer.callStartElement(HTMLTagBalancer.java:1164)
 at org.cyberneko.html.HTMLTagBalancer.startElement(HTMLTagBalancer.java:754)
 at com.atlassian.xhtml.parsing.BlockIsolatingTagBalancer.startElement(BlockIsolatingTagBalancer.java:78)
 at org.cyberneko.html.HTMLScanner$ContentScanner.scanStartElement(HTMLScanner.java:2760)
 at org.cyberneko.html.HTMLScanner$ContentScanner.scan(HTMLScanner.java:2110)
 at org.cyberneko.html.HTMLScanner.scanDocument(HTMLScanner.java:920)
 at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:499)
 at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:452)
 at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
 at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
 at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:485)
 at org.owasp.validator.html.scan.AntiSamySAXScanner.scan(AntiSamySAXScanner.java:149)
 ... 429 more
2017-11-15 17:43:14,842 WARN [http-nio-8090-exec-21] [confluence.impl.hibernate.ConfluenceHibernateTransactionManager] doRollback Performing rollback. Transactions:
 ->[null]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT (Session #508392597)
 -- space: 16678915 | url: /spaces/doimportpages.action | traceId: d124b0c818177d40 | userName: luke | referer: https://SNIP/spaces/importpages.action?key=W1P | action: doimportpages
```


Answers:
author: AnnWorley
body: From the URL in the stack trace:

```
/spaces/doimportpages.action
```

and your description of the import process, it sounds like you were importing the space via the Space Tools\>Content Tools menu. That option is for importing text files. The text files become pages in Confluence.

Please try importing the space from the Confluence Administration\>Backup and Restore menu (\<Base_URL\>/admin/backup.action).

I look forward to hearing how it goes.

comments: author: Luke
body: Thanks for that. It worked perfectly. It would be nice if the Content Tools either specified that, gave a link etc. because it is not clear why it wouldn't work like the Atlassian article I found about restoring spaces said i.e. that you can only do pages in that menu, especially since the selected file was a zip, which gives a clue ;-)

Thanks again.