Details
-
Bug
-
Resolution: Cannot Reproduce
-
Low
-
None
-
5.7, 5.7-OD-42-046, 6.6.7, 6.11.0, 6.13.6, 6.15.4, 6.15.9
-
35
-
Severity 3 - Minor
-
8
-
Description
Issue Summary
Exporting a Space to HTML fails if the attachment file in any page within the target Space is missing in the filesystem.
The HTML export fails with the following message:
There was an error in the export. Please check your log files. :java.lang.NullPointerException
PDF and XML exports still work, bypassing the missing attachment.
Accessing the page with the missing attachment also works.
Steps to Reproduce
- Install a vanilla instance of Confluence.
- This was validated on versions 6.0.3, 6.13.6 and 6.15.4, including both Server and Data Center deployments.
- Create a sample Space.
- In that Space, create a sample Page.
- In that Page, go to ... > Attachments and upload any file.
- Find the attached file in the file system and delete it.
- Refer to Hierarchical File System Attachment Storage so you find the right file.
- In the sample Space, go to Space tools > Content Tools > Export.
- In Export Formats, choose HTML and click on Next.
- In Export HTML Options, choose Normal Export and click on Export.
Expected Results
The HTML export is created and the file can be downloaded by the user.
Confluence gracefully handles the missing file during the export.
Actual Results
The HTML Space export fails with the following error in the UI:
There was an error in the export. Please check your log files. :java.lang.NullPointerException
An error similar to the below is logged in atlassian-confluence.log:
2019-08-22 20:43:14,491 WARN [Long running task: Export Space] [atlassian.confluence.pages.DefaultAttachmentManager] getAttachmentData Could not find data for attachment: Attachment: <FILENAME> v.1 (3702794) admin - com.atlassian.confluence.pages.persistence.dao.filesystem.AttachmentDataFileSystemException: No such file for Attachment: <FILENAME> v.1 (3702794) admin. Were looking at /confluence-home/atlassian-confluence-6.15.4/attachments/ver003/53/235/3735553/42/202/3702792/3702794/1 -- url: /localhost/spaces/doexportspace.action | referer: http://localhost:26154/localhost/spaces/exportspacehtml.action?key=TE | traceId: 22d1eb1736e9f8d4 | userName: admin | action: doexportspace 2019-08-22 20:43:14,493 ERROR [Long running task: Export Space] [confluence.importexport.impl.HtmlExporter] doExportEntity Error occurred during export. -- url: /localhost/spaces/doexportspace.action | referer: http://localhost:26154/localhost/spaces/exportspacehtml.action?key=TE | traceId: 22d1eb1736e9f8d4 | userName: admin | action: doexportspace java.lang.NullPointerException at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:2314) at org.apache.commons.io.IOUtils.copy(IOUtils.java:2270) at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:2291) at org.apache.commons.io.IOUtils.copy(IOUtils.java:2246) at com.atlassian.core.util.FileUtils.copyFile(FileUtils.java:410) at com.atlassian.confluence.importexport.impl.AbstractRendererExporterImpl.exportResource(AbstractRendererExporterImpl.java:204) at com.atlassian.confluence.importexport.impl.HtmlExporter.doExportEntity(HtmlExporter.java:185) at com.atlassian.confluence.importexport.impl.HtmlExporter.exportPage(HtmlExporter.java:82) at com.atlassian.confluence.importexport.impl.HtmlExporter.exportSpace(HtmlExporter.java:92) at com.atlassian.confluence.importexport.impl.AbstractRendererExporterImpl.doExport(AbstractRendererExporterImpl.java:99) at com.atlassian.confluence.importexport.impl.HtmlExporter.doExport(HtmlExporter.java:37) at com.atlassian.confluence.importexport.DefaultImportExportManager.doExport(DefaultImportExportManager.java:225) at com.atlassian.confluence.importexport.DefaultImportExportManager.exportAs(DefaultImportExportManager.java:191) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213) at com.sun.proxy.$Proxy124.exportAs(Unknown Source) at com.atlassian.confluence.importexport.actions.ExportSpaceLongRunningTask$1.doInTransactionWithoutResult(ExportSpaceLongRunningTask.java:144) at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:34) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) at com.atlassian.confluence.importexport.actions.ExportSpaceLongRunningTask.runInternal(ExportSpaceLongRunningTask.java:117) at com.atlassian.confluence.util.longrunning.ConfluenceAbstractLongRunningTask.run(ConfluenceAbstractLongRunningTask.java:26) at com.atlassian.confluence.util.longrunning.ManagedTask.run(ManagedTask.java:52) at com.atlassian.confluence.impl.util.concurrent.ConfluenceExecutors$ThreadLocalContextTaskWrapper.lambda$wrap$1(ConfluenceExecutors.java:90) at com.atlassian.confluence.vcache.VCacheRequestContextOperations.lambda$doInRequestContext$0(VCacheRequestContextOperations.java:50) at com.atlassian.confluence.impl.vcache.VCacheRequestContextManager.doInRequestContextInternal(VCacheRequestContextManager.java:87) at com.atlassian.confluence.impl.vcache.VCacheRequestContextManager.doInRequestContext(VCacheRequestContextManager.java:71) at com.atlassian.confluence.vcache.VCacheRequestContextOperations.doInRequestContext(VCacheRequestContextOperations.java:49) at com.atlassian.confluence.vcache.VCacheRequestContextOperations.lambda$withRequestContext$2(VCacheRequestContextOperations.java:66) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) 2019-08-22 20:43:14,494 ERROR [Long running task: Export Space] [confluence.importexport.impl.HtmlExporter] doExportEntity Entity being exported was: page: Another page v.1 (3702792) -- url: /localhost/spaces/doexportspace.action | referer: http://localhost:26154/localhost/spaces/exportspacehtml.action?key=TE | traceId: 22d1eb1736e9f8d4 | userName: admin | action: doexportspace 2019-08-22 20:43:14,495 ERROR [Long running task: Export Space] [confluence.importexport.actions.ExportSpaceLongRunningTask] doInTransactionWithoutResult Error during export -- url: /localhost/spaces/doexportspace.action | referer: http://localhost:26154/localhost/spaces/exportspacehtml.action?key=TE | traceId: 22d1eb1736e9f8d4 | userName: admin | action: doexportspace com.atlassian.confluence.importexport.ImportExportException: java.lang.NullPointerException at com.atlassian.confluence.importexport.impl.HtmlExporter.doExportEntity(HtmlExporter.java:194) at com.atlassian.confluence.importexport.impl.HtmlExporter.exportPage(HtmlExporter.java:82) at com.atlassian.confluence.importexport.impl.HtmlExporter.exportSpace(HtmlExporter.java:92) at com.atlassian.confluence.importexport.impl.AbstractRendererExporterImpl.doExport(AbstractRendererExporterImpl.java:99) at com.atlassian.confluence.importexport.impl.HtmlExporter.doExport(HtmlExporter.java:37) at com.atlassian.confluence.importexport.DefaultImportExportManager.doExport(DefaultImportExportManager.java:225) at com.atlassian.confluence.importexport.DefaultImportExportManager.exportAs(DefaultImportExportManager.java:191) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213) at com.sun.proxy.$Proxy124.exportAs(Unknown Source) at com.atlassian.confluence.importexport.actions.ExportSpaceLongRunningTask$1.doInTransactionWithoutResult(ExportSpaceLongRunningTask.java:144) at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:34) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) at com.atlassian.confluence.importexport.actions.ExportSpaceLongRunningTask.runInternal(ExportSpaceLongRunningTask.java:117) at com.atlassian.confluence.util.longrunning.ConfluenceAbstractLongRunningTask.run(ConfluenceAbstractLongRunningTask.java:26) at com.atlassian.confluence.util.longrunning.ManagedTask.run(ManagedTask.java:52) at com.atlassian.confluence.impl.util.concurrent.ConfluenceExecutors$ThreadLocalContextTaskWrapper.lambda$wrap$1(ConfluenceExecutors.java:90) at com.atlassian.confluence.vcache.VCacheRequestContextOperations.lambda$doInRequestContext$0(VCacheRequestContextOperations.java:50) at com.atlassian.confluence.impl.vcache.VCacheRequestContextManager.doInRequestContextInternal(VCacheRequestContextManager.java:87) at com.atlassian.confluence.impl.vcache.VCacheRequestContextManager.doInRequestContext(VCacheRequestContextManager.java:71) at com.atlassian.confluence.vcache.VCacheRequestContextOperations.doInRequestContext(VCacheRequestContextOperations.java:49) at com.atlassian.confluence.vcache.VCacheRequestContextOperations.lambda$withRequestContext$2(VCacheRequestContextOperations.java:66) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.NullPointerException at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:2314) at org.apache.commons.io.IOUtils.copy(IOUtils.java:2270) at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:2291) at org.apache.commons.io.IOUtils.copy(IOUtils.java:2246) at com.atlassian.core.util.FileUtils.copyFile(FileUtils.java:410) at com.atlassian.confluence.importexport.impl.AbstractRendererExporterImpl.exportResource(AbstractRendererExporterImpl.java:204) at com.atlassian.confluence.importexport.impl.HtmlExporter.doExportEntity(HtmlExporter.java:185) ... 36 more
Workaround
Either deleting the attachment from the UI or restoring the attachment in the file system would make the export working again.
Attachments
Issue Links
- is duplicated by
-
CONFSERVER-58750 HTML Space export fails with NPE if attachment file is missing in the file system
- Closed
- is related to
-
CONFSERVER-18642 Space Export to HTML is failing with a NPE on EAC due to data problem. Handle more gracefully
- Closed
- relates to
-
CONFCLOUD-36513 HTML Export fails when there is non-existing attachment
- Closed