Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-27751

TOC macro crashes when used in conjunction with Charting Macro's attachmentVersion option

    XMLWordPrintable

Details

    Description

      When attachmentVersion is set to replace, it errors out if used in conjunction with the TOC macro.

      Error Produced:

      org.springframework.dao.DataIntegrityViolationException: Hibernate operation: could not delete: [com.atlassian.confluence.pages.Attachment#46497891]; SQL []; ERROR: update or delete on table "attachments" violates foreign key constraint "fka768048734a4917e" on table "imagedetails"
        Detail: Key (attachmentid)=(46497891) is still referenced from table "imagedetails".; nested exception is org.postgresql.util.PSQLException: ERROR: update or delete on table "attachments" violates foreign key constraint "fka768048734a4917e" on table "imagedetails"
        Detail: Key (attachmentid)=(46497891) is still referenced from table "imagedetails".
      	at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:100)
      	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
      	at org.springframework.orm.hibernate.HibernateTransactionManager.convertJdbcAccessException(HibernateTransactionManager.java:619)
      	at org.springframework.orm.hibernate.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:605)
      	at org.springframework.orm.hibernate.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:518)
      	at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:732)
      ...
      Caused by: org.postgresql.util.PSQLException: ERROR: update or delete on table "attachments" violates foreign key constraint "fka768048734a4917e" on table "imagedetails"
        Detail: Key (attachmentid)=(46497891) is still referenced from table "imagedetails".
      	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2102)
      	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1835)
      	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
      	at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:500)
      	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:388)
      	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:334)
      	at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
      	at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
      	at net.sf.hibernate.impl.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:22)
      	at net.sf.hibernate.persister.EntityPersister.delete(EntityPersister.java:581)
      	at net.sf.hibernate.impl.ScheduledDeletion.execute(ScheduledDeletion.java:29)
      	at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2464)
      	at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2450)
      	at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2412)
      	at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2276)
      	at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)
      	at org.springframework.orm.hibernate.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:510)
      	... 298 more
      

      Reproduction

      1. Create a new page
      2. Add a table of contents macro
      3. Add a chart macro
      4. Edit the properties of the Chart macro and:
        1. Add an attachment name
        2. Set Attachment Version to Replace
      5. Save the page
        • Note that the page will not display (Error 330 (net::ERR_CONTENT_DECODING_FAILED): Unknown error) and the above error will appear in the logs.

      Alternatively use this XML to create a page to create the error:

      <p>
        <ac:macro ac:name="toc"/>
      </p>
      <p> </p>
      <ac:macro ac:name="chart">
        <ac:parameter ac:name="attachmentVersion">replace</ac:parameter>
        <ac:parameter ac:name="title">Test</ac:parameter>
        <ac:parameter ac:name="height">600</ac:parameter>
        <ac:parameter ac:name="width">1200</ac:parameter>
        <ac:parameter ac:name="datadisplay">after</ac:parameter>
        <ac:parameter ac:name="attachment">new.png</ac:parameter>
        <ac:parameter ac:name="categoryLabelPosition">up45</ac:parameter>
        <ac:rich-text-body>
          <table>
            <tbody>
              <tr>
                <th> </th>
                <th>A</th>
                <th>B</th>
              </tr>
              <tr>
                <td>TEST</td>
                <td>1</td>
                <td>2</td>
              </tr>
            </tbody>
          </table>
        </ac:rich-text-body>
      </ac:macro>
      
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              a38518e05741 David Yu
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: