Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-8775

Fail to import attachment with empty content in Oracle

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Minor
    • None
    • 3.5.1
    • Old Core
    • None
    • Oracle
    • Unknown
    • N/A
    • N/A

    Description

      When importing a document containing an attachment with en empty content the document is partially imported: everything is imported but the content of all the following attachments. Even if it's rare it's still a valid use case.

      Here is the exception we get in the log:

      ERROR c.x.x.p.p.Package              - Failed to save document Guide Utilisateur Pharaon.WebHome
      com.xpn.xwiki.XWikiException: Error number 3232 in 3: Exception while saving attachment Triptyque.jpg of document Guide Utilisateur Pharaon.WebHome
      Wrapped Exception: Failed to commit or rollback transaction. Root cause [
      SQL next exception = [java.sql.SQLIntegrityConstraintViolationException: ORA-01400: impossible d'insérer NULL dans ("WPR_PINT2_XWIKI"."XWIKIATTACHMENT_CONTENT"."XWA_CONTENT")
      ]]
              at com.xpn.xwiki.store.XWikiHibernateAttachmentStore.saveAttachmentContent(XWikiHibernateAttachmentStore.java:146) ~[xwiki-platform-legacy-oldcore-portlet-3.5-20121219.102940-75.jar:na]
              at com.xpn.xwiki.doc.XWikiDocument.saveAttachmentContent(XWikiDocument.java:4318) ~[xwiki-platform-legacy-oldcore-portlet-3.5-20121219.102940-75.jar:na]
              at com.xpn.xwiki.doc.XWikiDocument.saveAllAttachments(XWikiDocument.java:4275) ~[xwiki-platform-legacy-oldcore-portlet-3.5-20121219.102940-75.jar:na]
              at com.xpn.xwiki.plugin.packaging.Package.installDocument(Package.java:746) ~[xwiki-platform-legacy-oldcore-portlet-3.5-20121219.102940-75.jar:na]
              at com.xpn.xwiki.plugin.packaging.Package.install(Package.java:603) ~[xwiki-platform-legacy-oldcore-portlet-3.5-20121219.102940-75.jar:na]
              at com.xpn.xwiki.plugin.packaging.PackageAPI.install(PackageAPI.java:316) [xwiki-platform-legacy-oldcore-portlet-3.5-20121219.102940-75.jar:na]
              at com.xpn.xwiki.web.ImportAction.render(ImportAction.java:137) [xwiki-platform-legacy-oldcore-portlet-3.5-20121219.102940-75.jar:na]
              at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:231) [xwiki-platform-legacy-oldcore-portlet-3.5-20121219.102940-75.jar:na]
              at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:116) [xwiki-platform-legacy-oldcore-portlet-3.5-20121219.102940-75.jar:na]
              at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431) [struts-1.2.9.jar:1.2.9]
              at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236) [struts-1.2.9.jar:1.2.9]
              at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) [struts-1.2.9.jar:1.2.9]
              at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432) [struts-1.2.9.jar:1.2.9]
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:738) [javax.j2ee.servlet.jar:na]
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:831) [javax.j2ee.servlet.jar:na]
              at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1657) [com.ibm.ws.webcontainer.jar:na]
              at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1597) [com.ibm.ws.webcontainer.jar:na]
              at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:131) [com.ibm.ws.webcontainer.jar:na]
              at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:128) [xwiki-platform-legacy-oldcore-portlet-3.5-20121219.102940-75.jar:na]
              at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:184) [com.ibm.ws.webcontainer.jar:na]
              at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:116) [com.ibm.ws.webcontainer.jar:na]
              at org.xwiki.wysiwyg.server.filter.ConversionFilter.doFilter(ConversionFilter.java:144) [xwiki-platform-wysiwyg-server-portlet-3.5-SNAPSHOT.jar:na]
              at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:184) [com.ibm.ws.webcontainer.jar:na]
              at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:116) [com.ibm.ws.webcontainer.jar:na]
              at com.xpn.xwiki.plugin.webdav.XWikiDavFilter.doFilter(XWikiDavFilter.java:68) [xwiki-platform-webdav-server-portlet-3.5-20121219.103612-72.jar:na]
              at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:184) [com.ibm.ws.webcontainer.jar:na]
              at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:116) [com.ibm.ws.webcontainer.jar:na]
              at org.xwiki.container.servlet.filters.internal.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:217) [xwiki-platform-container-servlet-portlet-3.5-20130121.200021-86.jar:na]
              at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:184) [com.ibm.ws.webcontainer.jar:na]
              at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:116) [com.ibm.ws.webcontainer.jar:na]
              at org.xwiki.container.servlet.filters.internal.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:109) [xwiki-platform-container-servlet-portlet-3.5-20130121.200021-86.jar:na]
              at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:184) [com.ibm.ws.webcontainer.jar:na]
              at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:116) [com.ibm.ws.webcontainer.jar:na]
              at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:77) [com.ibm.ws.webcontainer.jar:na]
              at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:908) [com.ibm.ws.webcontainer.jar:na]
              at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:934) [com.ibm.ws.webcontainer.jar:na]
              at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:502) [com.ibm.ws.webcontainer.jar:na]
              at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:179) [com.ibm.ws.webcontainer.jar:na]
              at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:91) [com.ibm.ws.webcontainer.jar:na]
              at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:864) [com.ibm.ws.webcontainer.jar:na]
              at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1592) [com.ibm.ws.webcontainer.jar:na]
              at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:186) [com.ibm.ws.webcontainer.jar:na]
              at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452) [com.ibm.ws.runtime.jar:na]
              at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511) [com.ibm.ws.runtime.jar:na]
              at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305) [com.ibm.ws.runtime.jar:na]
              at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:83) [com.ibm.ws.runtime.jar:na]
              at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165) [com.ibm.ws.runtime.jar:na]
              at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217) [com.ibm.ws.runtime.jar:na]
              at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161) [com.ibm.ws.runtime.jar:na]
              at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138) [com.ibm.ws.runtime.jar:na]
              at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204) [com.ibm.ws.runtime.jar:na]
              at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775) [com.ibm.ws.runtime.jar:na]
              at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905) [com.ibm.ws.runtime.jar:na]
              at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1604) [com.ibm.ws.runtime.jar:na]
      Caused by: org.hibernate.HibernateException: Failed to commit or rollback transaction. Root cause [
      SQL next exception = [java.sql.SQLIntegrityConstraintViolationException: ORA-01400: impossible d'insérer NULL dans ("WPR_PINT2_XWIKI"."XWIKIATTACHMENT_CONTENT"."XWA_CONTENT")
      ]]
              at com.xpn.xwiki.store.XWikiHibernateBaseStore.endTransaction(XWikiHibernateBaseStore.java:876) ~[xwiki-platform-legacy-oldcore-portlet-3.5-20121219.102940-75.jar:na]
              at com.xpn.xwiki.store.XWikiHibernateBaseStore.endTransaction(XWikiHibernateBaseStore.java:840) ~[xwiki-platform-legacy-oldcore-portlet-3.5-20121219.102940-75.jar:na]
              at com.xpn.xwiki.store.XWikiHibernateAttachmentStore.saveAttachmentContent(XWikiHibernateAttachmentStore.java:142) ~[xwiki-platform-legacy-oldcore-portlet-3.5-20121219.102940-75.jar:na]
              ... 53 common frames omitted
      Caused by: org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
              at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:96) ~[hibernate-core-3.6.9.Final.jar:3.6.9.Final]
              at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) ~[hibernate-core-3.6.9.Final.jar:3.6.9.Final]
              at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275) ~[hibernate-core-3.6.9.Final.jar:3.6.9.Final]
              at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:114) ~[hibernate-core-3.6.9.Final.jar:3.6.9.Final]
              at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:109) ~[hibernate-core-3.6.9.Final.jar:3.6.9.Final]
              at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher.java:244) ~[hibernate-core-3.6.9.Final.jar:3.6.9.Final]
              at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2411) ~[hibernate-core-3.6.9.Final.jar:3.6.9.Final]
              at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2874) ~[hibernate-core-3.6.9.Final.jar:3.6.9.Final]
              at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:79) ~[hibernate-core-3.6.9.Final.jar:3.6.9.Final]
              at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:273) ~[hibernate-core-3.6.9.Final.jar:3.6.9.Final]
              at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:265) ~[hibernate-core-3.6.9.Final.jar:3.6.9.Final]
              at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:184) ~[hibernate-core-3.6.9.Final.jar:3.6.9.Final]
              at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321) ~[hibernate-core-3.6.9.Final.jar:3.6.9.Final]
              at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51) ~[hibernate-core-3.6.9.Final.jar:3.6.9.Final]
              at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1216) ~[hibernate-core-3.6.9.Final.jar:3.6.9.Final]
              at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:383) ~[hibernate-core-3.6.9.Final.jar:3.6.9.Final]
              at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:133) ~[hibernate-core-3.6.9.Final.jar:3.6.9.Final]
              at com.xpn.xwiki.store.XWikiHibernateBaseStore.endTransaction(XWikiHibernateBaseStore.java:869) ~[xwiki-platform-legacy-oldcore-portlet-3.5-20121219.102940-75.jar:na]
              ... 55 common frames omitted
      Caused by: java.sql.BatchUpdateException: ORA-01400: impossible d'insérer NULL dans ("WPR_PINT2_XWIKI"."XWIKIATTACHMENT_CONTENT"."XWA_CONTENT")
      
              at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:629) ~[ojdbc6.jar:Oracle JDBC Driver version - "11.1.0.7.0-Production"]
              at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:9409) ~[ojdbc6.jar:Oracle JDBC Driver version - "11.1.0.7.0-Production"]
              at oracle.jdbc.driver.OracleStatementWrapper.executeBatch(OracleStatementWrapper.java:211) ~[ojdbc6.jar:Oracle JDBC Driver version - "11.1.0.7.0-Production"]
              at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.pmiExecuteBatch(WSJdbcPreparedStatement.java:1012) ~[com.ibm.ws.runtime.jar:na]
              at com.ibm.ws.rsadapter.jdbc.WSJdbcStatement.executeBatch(WSJdbcStatement.java:822) ~[com.ibm.ws.runtime.jar:na]
              at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70) ~[hibernate-core-3.6.9.Final.jar:3.6.9.Final]
              at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268) ~[hibernate-core-3.6.9.Final.jar:3.6.9.Final]
              ... 70 common frames omitted
      

      Note: "impossible d'insérer NULL" means "impossible to insert NULL"

      Sounds like the classical Oracle empty string vs null issue.

      Can probably be reproduced by attaching an empty file to a document.

      Note: I did not tested in more recent version of XWiki.

      Attachments

        Issue Links

          Activity

            People

              vmassol Vincent Massol
              tmortagne Thomas Mortagne
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: