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
- Create a new page
- Add a table of contents macro
- Add a chart macro
- Edit the properties of the Chart macro and:
- Add an attachment name
- Set Attachment Version to Replace
- 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
- duplicates
-
CONFSERVER-26877 Chart macro using attachment parameters not working if a page contains TOC macro
- Closed