You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jspwiki.apache.org by ja...@apache.org on 2008/08/30 18:01:52 UTC

svn commit: r690529 - in /incubator/jspwiki/trunk: ChangeLog src/com/ecyrd/jspwiki/ReferenceManager.java src/com/ecyrd/jspwiki/Release.java

Author: jalkanen
Date: Sat Aug 30 09:01:51 2008
New Revision: 690529

URL: http://svn.apache.org/viewvc?rev=690529&view=rev
Log:
JSPWIKI-27: ReferenceManager was happily loading old page information when the wiki was restarted from the serialization store. The problem was that if someone didn't add a changenote, that information was not saved at serialization. 

Modified:
    incubator/jspwiki/trunk/ChangeLog
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ReferenceManager.java
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/Release.java

Modified: incubator/jspwiki/trunk/ChangeLog
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/ChangeLog?rev=690529&r1=690528&r2=690529&view=diff
==============================================================================
--- incubator/jspwiki/trunk/ChangeLog (original)
+++ incubator/jspwiki/trunk/ChangeLog Sat Aug 30 09:01:51 2008
@@ -1,3 +1,11 @@
+2008-08-20  Janne Jalkanen <ja...@apache.org>
+
+        * 2.7.0-alpha-32
+        
+        * JSPWIKI-27: ReferenceManager was not serializing properly when there
+        was no page metadata, therefore inadvertently loading old data whenever
+        the wiki was restarted. 
+        
 2008-08-30 Dirk Frederickx <di...@gmail.com>
 
         * 2.7.0-alpha-31

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ReferenceManager.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ReferenceManager.java?rev=690529&r1=690528&r2=690529&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ReferenceManager.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ReferenceManager.java Sat Aug 30 09:01:51 2008
@@ -491,17 +491,11 @@
     private synchronized void serializeAttrsToDisk( WikiPage p )
     {
         ObjectOutputStream out = null;
+        StopWatch sw = new StopWatch();
+        sw.start();
 
         try
         {
-            // FIXME: There is a concurrency issue here...
-            Set entries = p.getAttributes().entrySet();
-
-            // if( entries.size() == 0 ) return;
-
-            StopWatch sw = new StopWatch();
-            sw.start();
-
             File f = new File( m_engine.getWorkDir(), SERIALIZATION_DIR );
 
             if( !f.exists() ) f.mkdirs();
@@ -511,6 +505,18 @@
             //
             f = new File( f, getHashFileName(p.getName()) );
 
+            // FIXME: There is a concurrency issue here...
+            Set entries = p.getAttributes().entrySet();
+
+            if( entries.size() == 0 ) 
+            {
+                //  Nothing to serialize, therefore we will just simply remove the
+                //  serialization file so that the next time we boot, we don't
+                //  deserialize old data.
+                f.delete();
+                return;
+            }
+
             out = new ObjectOutputStream( new BufferedOutputStream(new FileOutputStream(f)) );
 
             out.writeLong( serialVersionUID );
@@ -532,9 +538,6 @@
 
             out.close();
 
-            sw.stop();
-
-            log.debug("serialization for "+p.getName()+" done - took "+sw);
         }
         catch( IOException e )
         {
@@ -550,6 +553,12 @@
         {
             log.fatal("No MD5 algorithm!?!");
         }
+        finally
+        {
+            sw.stop();
+
+            log.debug("serialization for "+p.getName()+" done - took "+sw);
+        }
     }
 
     /**

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/Release.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/Release.java?rev=690529&r1=690528&r2=690529&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/Release.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/Release.java Sat Aug 30 09:01:51 2008
@@ -77,7 +77,7 @@
      *  <p>
      *  If the build identifier is empty, it is not added.
      */
-    public static final String     BUILD         = "31";
+    public static final String     BUILD         = "32";
     
     /**
      *  This is the generic version string you should use