r980 - xwiki/trunk/src/main/java/com/xpn/xwiki/doc

Nguyen Viet Chung chungnv at users.forge.objectweb.org
Mon Mar 27 09:42:08 CEST 2006


Author: chungnv
Date: 2006-03-27 09:42:07 +0200 (Mon, 27 Mar 2006)
New Revision: 980

Modified:
   xwiki/trunk/src/main/java/com/xpn/xwiki/doc/XWikiAttachment.java
   xwiki/trunk/src/main/java/com/xpn/xwiki/doc/XWikiAttachmentArchive.java
Log:
Fix bug XWIKI-232 , view attachment revision .

Modified: xwiki/trunk/src/main/java/com/xpn/xwiki/doc/XWikiAttachment.java
===================================================================
--- xwiki/trunk/src/main/java/com/xpn/xwiki/doc/XWikiAttachment.java	2006-03-27 04:58:09 UTC (rev 979)
+++ xwiki/trunk/src/main/java/com/xpn/xwiki/doc/XWikiAttachment.java	2006-03-27 07:42:07 UTC (rev 980)
@@ -500,6 +500,7 @@
             XWikiAttachment revattach = new XWikiAttachment();
             revattach.fromXML(scontent);
             revattach.setDoc(getDoc());
+            revattach.setVersion(rev);
             return revattach;
         }    catch (Exception e) {
             Object[] args = { getFilename() };
@@ -507,6 +508,6 @@
                     "Exception while manipulating the archive for file {0}", e, args);
         }
     }
-    
+
 }
 

Modified: xwiki/trunk/src/main/java/com/xpn/xwiki/doc/XWikiAttachmentArchive.java
===================================================================
--- xwiki/trunk/src/main/java/com/xpn/xwiki/doc/XWikiAttachmentArchive.java	2006-03-27 04:58:09 UTC (rev 979)
+++ xwiki/trunk/src/main/java/com/xpn/xwiki/doc/XWikiAttachmentArchive.java	2006-03-27 07:42:07 UTC (rev 980)
@@ -1,24 +1,24 @@
-/*
- * Copyright 2006, XpertNet SARL, and individual contributors as indicated
- * by the contributors.txt.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- *
- * @author sdumitriu
- */
+/*
+ * Copyright 2006, XpertNet SARL, and individual contributors as indicated
+ * by the contributors.txt.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ * @author sdumitriu
+ */
 
 package com.xpn.xwiki.doc;
 
@@ -104,13 +104,13 @@
 
     public void updateArchive(byte[] data, XWikiContext context) throws XWikiException {
         try {
+            attachment.incrementVersion();
+            attachment.setDate(new Date());
             String sdata = attachment.toStringXML(true, false, context);
             Lines lines = new Lines(sdata);
 
             if (archive!=null) {
                 archive.addRevision(lines.toArray(),"");
-                attachment.incrementVersion();
-                attachment.setDate(new Date());
             }
             else
                 archive = new Archive(lines.toArray(),getAttachment().getFilename(),getAttachment().getVersion());





More information about the Xwiki-notifications mailing list