r1043 - xwiki/trunk/src/main/java/com/xpn/xwiki/store
Nguyen Viet Chung
chungnv at users.forge.objectweb.org
Tue Apr 11 11:13:16 CEST 2006
Author: chungnv
Date: 2006-04-11 11:13:11 +0200 (Tue, 11 Apr 2006)
New Revision: 1043
Modified:
xwiki/trunk/src/main/java/com/xpn/xwiki/store/XWikiHibernateAttachmentStore.java
Log:
Fix bug XWiki-172 delete should be non-sensitive to error and delete what it can delete
Modified: xwiki/trunk/src/main/java/com/xpn/xwiki/store/XWikiHibernateAttachmentStore.java
===================================================================
--- xwiki/trunk/src/main/java/com/xpn/xwiki/store/XWikiHibernateAttachmentStore.java 2006-04-11 00:58:40 UTC (rev 1042)
+++ xwiki/trunk/src/main/java/com/xpn/xwiki/store/XWikiHibernateAttachmentStore.java 2006-04-11 09:13:11 UTC (rev 1043)
@@ -166,10 +166,30 @@
Session session = getSession(context);
// Delete the three attachement entries
- loadAttachmentContent(attachment, context, false);
- session.delete(attachment.getAttachment_content());
- loadAttachmentArchive(attachment, context, false);
- session.delete(attachment.getAttachment_archive());
+ try{
+ loadAttachmentContent(attachment, context, false);
+ }catch(XWikiException e){
+ context.put("exception",e);
+ }
+ if(context.get("exception") != null){
+ XWikiException e1 = (XWikiException) context.get("exception");
+ if(e1.getCode() != XWikiException.ERROR_XWIKI_STORE_HIBERNATE_LOADING_ATTACHMENT ){
+ session.delete(attachment.getAttachment_content());
+ }
+ }else session.delete(attachment.getAttachment_content());
+
+ try{
+ loadAttachmentArchive(attachment, context, false);
+ }catch(XWikiException e){
+ context.put("exception",e);
+ }
+ if(context.get("exception") != null){
+ XWikiException e1 = (XWikiException) context.get("exception");
+ if(e1.getCode() != XWikiException.ERROR_XWIKI_STORE_HIBERNATE_LOADING_ATTACHMENT ){
+ session.delete(attachment.getAttachment_archive());
+ }
+ }else session.delete(attachment.getAttachment_archive());
+
session.delete(attachment);
if (parentUpdate) {
More information about the Xwiki-notifications
mailing list