Pack-in issue when an attachment has been changed

Description

Steps to reproduce.

1. Create new record on "Pack in" window and attach the file "packout_example.zip" file (Attached to this ticket)
2. Click "Packin" process and this works properly.
3 .Now the jasper file has been change in the file "packout_example.zip" and it becomes the file "packout_example_2.zip" (Attached to this ticket)
4. Try to import again the last file (packout_example_2.zip) and you'll find out a bug :

This msg is shown on the script : "MAttachment[1000048,Title=zip,Entries=1:report_example.jasper]"

These messages are shown on the log file :

1/10/2013 04:11:56 PM org.compiere.util.DB executeUpdate
SEVERE: INSERT INTO AD_Attachment (AD_Attachment_ID,AD_Table_ID,Title,Created,AD_Org_ID,IsActive,CreatedBy,UpdatedBy,AD_Attachment_UU,Updated,Record_ID,AD_Client_ID) VALUES (?,?,?,?,?,?,?,?,?,?,?,?) [SvrProcess_60a82e8f-30ac-4214-b126-574a1e4af6cd]
org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "ad_attachment_record"
Detail: Key (ad_table_id, record_id)=(284, 1000001) already exists.
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2157)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1886)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:559)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:417)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:363)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:147)
at sun.reflect.GeneratedMethodAccessor37.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.compiere.db.StatementProxy.invoke(StatementProxy.java:126)
at $Proxy0.executeUpdate(Unknown Source)
at org.compiere.util.DB.executeUpdate(DB.java:1028)
at org.compiere.util.DB.executeUpdate(DB.java:997)
at org.compiere.model.PO.doInsert(PO.java:2942)
at org.compiere.model.PO.saveNew(PO.java:2746)
at org.compiere.model.PO.save(PO.java:2107)
at org.compiere.model.PO.save(PO.java:2300)
at org.adempiere.pipo2.handler.AttachmentElementHandler.startElement(AttachmentElementHandler.java:77)
at org.adempiere.pipo2.PackInHandler.processElement(PackInHandler.java:221)
at org.adempiere.pipo2.PackInHandler.processElement(PackInHandler.java:229)
at org.adempiere.pipo2.PackInHandler.endElement(PackInHandler.java:298)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:198)
at org.adempiere.pipo2.PackIn.importXML(PackIn.java:164)
at org.adempiere.pipo2.PackIn.importXML(PackIn.java:127)
at org.adempiere.pipo2.PackInProcess.doIt(PackInProcess.java:132)
at org.compiere.process.SvrProcess.process(SvrProcess.java:176)
at org.compiere.process.SvrProcess.startProcess(SvrProcess.java:122)
at org.adempiere.util.ProcessUtil.startJavaProcess(ProcessUtil.java:172)
at org.compiere.apps.AbstractProcessCtl.startProcess(AbstractProcessCtl.java:466)
at org.compiere.apps.AbstractProcessCtl.run(AbstractProcessCtl.java:234)
at org.adempiere.webui.apps.WProcessCtl.process(WProcessCtl.java:158)
at org.adempiere.webui.apps.ProcessModalDialog$ProcessDialogRunnable.doRun(ProcessModalDialog.java:514)
at org.adempiere.util.ContextRunnable.run(ContextRunnable.java:38)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
1/10/2013 04:11:56 PM org.compiere.util.CLogger saveError
SEVERE: SaveErrorNotUnique - ERROR: duplicate key value violates unique constraint "ad_attachment_record"
Detail: Key (ad_table_id, record_id)=(284, 1000001) already exists.

Environment

None

Assignee

Carlos Ruiz

Reporter

Richard Morales Herrera

Labels

Tested By

None

Components

Affects versions

Priority

Major
Configure