jspwiki-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mets...@apache.org
Subject svn commit: r814195 - in /incubator/jspwiki/trunk: ./ src/java/org/apache/wiki/ src/java/org/apache/wiki/action/ src/java/org/apache/wiki/content/ src/java/org/apache/wiki/content/lock/ src/java/org/apache/wiki/log/
Date Sat, 12 Sep 2009 16:48:06 GMT
Author: metskem
Date: Sat Sep 12 16:48:05 2009
New Revision: 814195

URL: http://svn.apache.org/viewvc?rev=814195&view=rev
Log:
3.0.0-svn-154  * JSPWIKI-598: Fixed EditActionBean to also release the PageLock after saving
a page.

Modified:
    incubator/jspwiki/trunk/ChangeLog
    incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java
    incubator/jspwiki/trunk/src/java/org/apache/wiki/action/EditActionBean.java
    incubator/jspwiki/trunk/src/java/org/apache/wiki/content/ContentManager.java
    incubator/jspwiki/trunk/src/java/org/apache/wiki/content/lock/PageLock.java
    incubator/jspwiki/trunk/src/java/org/apache/wiki/log/LoggerFactory.java
    incubator/jspwiki/trunk/src/java/org/apache/wiki/log/LoggerImpl.java

Modified: incubator/jspwiki/trunk/ChangeLog
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/ChangeLog?rev=814195&r1=814194&r2=814195&view=diff
==============================================================================
--- incubator/jspwiki/trunk/ChangeLog (original)
+++ incubator/jspwiki/trunk/ChangeLog Sat Sep 12 16:48:05 2009
@@ -1,3 +1,11 @@
+2009-09-12 Harry Metske <metskem@apache.org>
+
+        * 3.0.0-svn-154
+        
+        * JSPWIKI-598: Fixed EditActionBean to also release the PageLock
+        after saving a page.
+        * Fixed a few checkstyle warnings 
+        
 2009-08-16 Andrew Jaquith <ajaquith AT apache DOT org>
 
         * 3.0.0-svn-153

Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java?rev=814195&r1=814194&r2=814195&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java Sat Sep 12 16:48:05 2009
@@ -77,7 +77,7 @@
      *  <p>
      *  If the build identifier is empty, it is not added.
      */
-    public static final String     BUILD         = "153";
+    public static final String     BUILD         = "154";
 
     /**
      *  This is the generic version string you should use

Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/action/EditActionBean.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/action/EditActionBean.java?rev=814195&r1=814194&r2=814195&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/action/EditActionBean.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/action/EditActionBean.java Sat Sep 12
16:48:05 2009
@@ -109,11 +109,8 @@
         HttpSession session = getContext().getRequest().getSession();
         WikiEngine engine = getContext().getEngine();
         PageLock lock = (PageLock) session.getAttribute( LOCK_PREFIX + pagereq );
-        if( lock != null )
-        {
-            engine.getContentManager().unlockPage( lock );
-            session.removeAttribute( LOCK_PREFIX + pagereq );
-        }
+        engine.getContentManager().unlockPage( lock );
+        session.removeAttribute( LOCK_PREFIX + pagereq );
         return new RedirectResolution( ViewActionBean.class ).addParameter( "page", pagereq
);
     }
 
@@ -426,10 +423,14 @@
             {
                 engine.saveText( wikiContext, m_text );
             }
+            PageLock lock = (PageLock) session.getAttribute( LOCK_PREFIX + pagereq );
+            engine.getContentManager().unlockPage( lock );
             session.removeAttribute( LOCK_PREFIX +page.getName() );
         }
         catch( DecisionRequiredException ex )
         {
+            PageLock lock = (PageLock) session.getAttribute( LOCK_PREFIX + pagereq );
+            engine.getContentManager().unlockPage( lock );
             session.removeAttribute( LOCK_PREFIX +page.getName() );
             return new RedirectResolution( ViewActionBean.class, "view" ).addParameter( "page",
"ApprovalRequiredForPageChanges" );
         }

Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/content/ContentManager.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/content/ContentManager.java?rev=814195&r1=814194&r2=814195&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/content/ContentManager.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/content/ContentManager.java Sat Sep 12
16:48:05 2009
@@ -673,11 +673,11 @@
 
                 m_pageLocks.put( page.getName(), lock );
 
-                log.debug( "Locked page "+page.getName()+" for "+user);
+                log.debug( "Lock set : "+ lock);
             }
             else
             {
-                log.debug( "Page "+page.getName()+" already locked by "+lock.getLocker()
);
+                log.debug( "The lock  " + lock + " already exists" );
                 lock = null; // Nothing to return
             }
         }
@@ -698,7 +698,7 @@
         {
             m_pageLocks.remove( lock.getPage() );
 
-            log.debug( "Unlocked page "+lock.getPage() );
+            log.debug( "Released lock " + lock );
         }
 
         fireEvent( WikiPageEvent.PAGE_UNLOCK, lock.getPage(), NO_ARGS );
@@ -1069,10 +1069,7 @@
                     {
                         i.remove();
 
-                        log.debug( "Reaped lock: "+p.getPage()+
-                                   " by "+p.getLocker()+
-                                   ", acquired "+p.getAcquisitionTime()+
-                                   ", and expired "+p.getExpiryTime() );
+                        log.error( "Reaped lock: " + p );
                     }
                 }
             }

Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/content/lock/PageLock.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/content/lock/PageLock.java?rev=814195&r1=814194&r2=814195&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/content/lock/PageLock.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/content/lock/PageLock.java Sat Sep 12
16:48:05 2009
@@ -114,6 +114,22 @@
 
         return (time / (1000L * 60)) + 1;
     }
+
+    /**
+     * Returns true if the lock is expired.
+     * 
+     * @return true if lock is expired
+     */
+    public boolean isExpired()
+    {
+        return m_lockExpiry.before( new Date() );
+    }
     
-    // FIXME: Should really have a isExpired() method as well.
+    /**
+     * Returns all available information on the lock
+     */
+    public String toString() 
+    {
+        return "pagename:" + getPage() + ",locker:" + getLocker() + ",acquired:" + getAcquisitionTime()
+ ",expiry:" + getExpiryTime();
+    }
 }

Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/log/LoggerFactory.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/log/LoggerFactory.java?rev=814195&r1=814194&r2=814195&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/log/LoggerFactory.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/log/LoggerFactory.java Sat Sep 12 16:48:05
2009
@@ -55,7 +55,7 @@
     private static boolean c_isLog4jPresent = true;
     
     //     it appears that after shutting down JSPWiki, we get new requests for Loggers,
to prevent this we "close the door" :
-    private static boolean c_isLoggerFactoryClosed= false;
+    private static boolean c_isLoggerFactoryClosed;
 
     private static final String SLF4J_LOG4J_ADAPTER_CLASS = "org.slf4j.impl.Log4jLoggerAdapter";
 
@@ -63,7 +63,7 @@
 
     private static HashMap<String, LoggerImpl> c_registeredLoggers = new HashMap<String,
LoggerImpl>( 200 );
     
-    private static String c_wikiName = null;
+    private static String c_wikiName;
 
     /**
      *  Attempt to install the SLF4J bridge handlers.  However, since those

Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/log/LoggerImpl.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/log/LoggerImpl.java?rev=814195&r1=814194&r2=814195&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/log/LoggerImpl.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/log/LoggerImpl.java Sat Sep 12 16:48:05
2009
@@ -32,7 +32,7 @@
 public class LoggerImpl implements org.apache.wiki.log.Logger, Serializable
 {
     private static final long serialVersionUID = 1L;
-    Logger m_slf4jLogger = null;
+    Logger m_slf4jLogger;
     
     /**
      * @param loggerName The name of the SFL4J Logger to find



Mime
View raw message