You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jspwiki.apache.org by gm...@apache.org on 2013/12/31 04:37:41 UTC

svn commit: r1554363 [1/2] - in /jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki: ./ auth/acl/ diff/ forms/ parser/ plugin/ rpc/json/ rss/

Author: gmazza
Date: Tue Dec 31 03:37:41 2013
New Revision: 1554363

URL: http://svn.apache.org/r1554363
Log:
Fixed some Sonar 'if stmts must use braces' complaints via code-reformat using IntelliJ IDEA (switching to that IDE's modern indentation style in the process), if no objections will do so for some other files having this Sonar complaint.

Modified:
    jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/PageManager.java
    jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/WikiServlet.java
    jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/auth/acl/DefaultAclManager.java
    jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/diff/DifferenceManager.java
    jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/forms/FormInfo.java
    jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/parser/PluginContent.java
    jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/plugin/WeblogEntryPlugin.java
    jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/rpc/json/JSONRPCManager.java
    jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/rss/Feed.java
    jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/rss/RSS10Feed.java

Modified: jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/PageManager.java
URL: http://svn.apache.org/viewvc/jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/PageManager.java?rev=1554363&r1=1554362&r2=1554363&view=diff
==============================================================================
--- jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/PageManager.java (original)
+++ jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/PageManager.java Tue Dec 31 03:37:41 2013
@@ -58,70 +58,98 @@ import org.apache.wiki.workflow.Workflow
 
 
 /**
- *  Manages the WikiPages.  This class functions as an unified interface towards
- *  the page providers.  It handles initialization and management of the providers,
- *  and provides utility methods for accessing the contents.
- *  <p>
- *  Saving a page is a two-stage Task; first the pre-save operations and then the
- *  actual save.  See the descriptions of the tasks for further information.
+ * Manages the WikiPages.  This class functions as an unified interface towards
+ * the page providers.  It handles initialization and management of the providers,
+ * and provides utility methods for accessing the contents.
+ * <p/>
+ * Saving a page is a two-stage Task; first the pre-save operations and then the
+ * actual save.  See the descriptions of the tasks for further information.
  *
- *  @since 2.0
+ * @since 2.0
  */
 // FIXME: This class currently only functions just as an extra layer over providers,
 //        complicating things.  We need to move more provider-specific functionality
 //        from WikiEngine (which is too big now) into this class.
 public class PageManager extends ModuleManager implements WikiEventListener {
-	
+
     private static final long serialVersionUID = 1L;
 
-    /** The property value for setting the current page provider.  Value is {@value}. */
+    /**
+     * The property value for setting the current page provider.  Value is {@value}.
+     */
     public static final String PROP_PAGEPROVIDER = "jspwiki.pageProvider";
-    
-    /** The property value for setting the cache on/off.  Value is {@value}. */
-    public static final String PROP_USECACHE     = "jspwiki.usePageCache";
-    
-    /** The property value for setting the amount of time before the page locks expire. Value is {@value}. */
-    public static final String PROP_LOCKEXPIRY   = "jspwiki.lockExpiryTime";
-    
-    /** The message key for storing the text for the presave task.  Value is <tt>{@value}</tt>*/
+
+    /**
+     * The property value for setting the cache on/off.  Value is {@value}.
+     */
+    public static final String PROP_USECACHE = "jspwiki.usePageCache";
+
+    /**
+     * The property value for setting the amount of time before the page locks expire. Value is {@value}.
+     */
+    public static final String PROP_LOCKEXPIRY = "jspwiki.lockExpiryTime";
+
+    /**
+     * The message key for storing the text for the presave task.  Value is <tt>{@value}</tt>
+     */
     public static final String PRESAVE_TASK_MESSAGE_KEY = "task.preSaveWikiPage";
-    
-    /** The workflow attribute which stores the wikiContext. */
+
+    /**
+     * The workflow attribute which stores the wikiContext.
+     */
     public static final String PRESAVE_WIKI_CONTEXT = "wikiContext";
-    
-    /** The name of the key from jspwiki.properties which defines who shall approve
-     *  the workflow of storing a wikipage.  Value is <tt>{@value}</tt>*/
-    public static final String SAVE_APPROVER             = "workflow.saveWikiPage";
-    
-    /** The message key for storing the Decision text for saving a page.  Value is {@value}. */
+
+    /**
+     * The name of the key from jspwiki.properties which defines who shall approve
+     * the workflow of storing a wikipage.  Value is <tt>{@value}</tt>
+     */
+    public static final String SAVE_APPROVER = "workflow.saveWikiPage";
+
+    /**
+     * The message key for storing the Decision text for saving a page.  Value is {@value}.
+     */
     public static final String SAVE_DECISION_MESSAGE_KEY = "decision.saveWikiPage";
-    
-    /** The message key for rejecting the decision to save the page.  Value is {@value}. */
-    public static final String SAVE_REJECT_MESSAGE_KEY   = "notification.saveWikiPage.reject";
-    
-    /** The message key of the text to finally approve a page save.  Value is {@value}. */
-    public static final String SAVE_TASK_MESSAGE_KEY     = "task.saveWikiPage";
-    
-    /** Fact name for storing the page name.  Value is {@value}. */
+
+    /**
+     * The message key for rejecting the decision to save the page.  Value is {@value}.
+     */
+    public static final String SAVE_REJECT_MESSAGE_KEY = "notification.saveWikiPage.reject";
+
+    /**
+     * The message key of the text to finally approve a page save.  Value is {@value}.
+     */
+    public static final String SAVE_TASK_MESSAGE_KEY = "task.saveWikiPage";
+
+    /**
+     * Fact name for storing the page name.  Value is {@value}.
+     */
     public static final String FACT_PAGE_NAME = "fact.pageName";
-    
-    /** Fact name for storing a diff text. Value is {@value}. */
+
+    /**
+     * Fact name for storing a diff text. Value is {@value}.
+     */
     public static final String FACT_DIFF_TEXT = "fact.diffText";
-    
-    /** Fact name for storing the current text.  Value is {@value}. */
+
+    /**
+     * Fact name for storing the current text.  Value is {@value}.
+     */
     public static final String FACT_CURRENT_TEXT = "fact.currentText";
-    
-    /** Fact name for storing the proposed (edited) text.  Value is {@value}. */
+
+    /**
+     * Fact name for storing the proposed (edited) text.  Value is {@value}.
+     */
     public static final String FACT_PROPOSED_TEXT = "fact.proposedText";
-    
-    /** Fact name for storing whether the user is authenticated or not.  Value is {@value}. */
+
+    /**
+     * Fact name for storing whether the user is authenticated or not.  Value is {@value}.
+     */
     public static final String FACT_IS_AUTHENTICATED = "fact.isAuthenticated";
 
-    static Logger log = Logger.getLogger( PageManager.class );
+    static Logger log = Logger.getLogger(PageManager.class);
 
     private WikiPageProvider m_provider;
 
-    protected HashMap<String,PageLock> m_pageLocks = new HashMap<String,PageLock>();
+    protected HashMap<String, PageLock> m_pageLocks = new HashMap<String, PageLock>();
 
     private WikiEngine m_engine;
 
@@ -130,118 +158,118 @@ public class PageManager extends ModuleM
     private LockReaper m_reaper = null;
 
     /**
-     *  Creates a new PageManager.
-     *  
-     *  @param engine WikiEngine instance
-     *  @param props Properties to use for initialization
-     *  @throws WikiException If anything goes wrong, you get this.
+     * Creates a new PageManager.
+     *
+     * @param engine WikiEngine instance
+     * @param props  Properties to use for initialization
+     * @throws WikiException If anything goes wrong, you get this.
      */
-    public PageManager( WikiEngine engine, Properties props ) throws WikiException {
-        super( engine );
+    public PageManager(WikiEngine engine, Properties props) throws WikiException {
+        super(engine);
         String classname;
         m_engine = engine;
-        boolean useCache = "true".equals( props.getProperty( PROP_USECACHE ) );
+        boolean useCache = "true".equals(props.getProperty(PROP_USECACHE));
 
-        m_expiryTime = TextUtil.parseIntParameter( props.getProperty( PROP_LOCKEXPIRY ), 60 );
+        m_expiryTime = TextUtil.parseIntParameter(props.getProperty(PROP_LOCKEXPIRY), 60);
 
         //
         //  If user wants to use a cache, then we'll use the CachingProvider.
         //
-        if( useCache ) {
+        if (useCache) {
             classname = "org.apache.wiki.providers.CachingProvider";
         } else {
-            classname = TextUtil.getRequiredProperty( props, PROP_PAGEPROVIDER );
+            classname = TextUtil.getRequiredProperty(props, PROP_PAGEPROVIDER);
         }
 
         try {
-            log.debug( "Page provider class: '" + classname + "'" );
-            Class< ? > providerclass = ClassUtil.findClass( "org.apache.wiki.providers", classname );
-            m_provider = ( WikiPageProvider )providerclass.newInstance();
-
-            log.debug( "Initializing page provider class " + m_provider );
-            m_provider.initialize( m_engine, props );
-        } catch( ClassNotFoundException e ) {
-            log.error( "Unable to locate provider class '" + classname + "'", e );
-            throw new WikiException( "No provider class.", e );
-        } catch( InstantiationException e ) {
-            log.error( "Unable to create provider class '" + classname + "'", e );
-            throw new WikiException( "Faulty provider class.", e );
-        } catch( IllegalAccessException e ) {
-            log.error( "Illegal access to provider class '" + classname + "'", e );
-            throw new WikiException( "Illegal provider class.", e );
-        } catch( NoRequiredPropertyException e ) {
-            log.error( "Provider did not found a property it was looking for: " + e.getMessage(), e );
+            log.debug("Page provider class: '" + classname + "'");
+            Class<?> providerclass = ClassUtil.findClass("org.apache.wiki.providers", classname);
+            m_provider = (WikiPageProvider) providerclass.newInstance();
+
+            log.debug("Initializing page provider class " + m_provider);
+            m_provider.initialize(m_engine, props);
+        } catch (ClassNotFoundException e) {
+            log.error("Unable to locate provider class '" + classname + "'", e);
+            throw new WikiException("No provider class.", e);
+        } catch (InstantiationException e) {
+            log.error("Unable to create provider class '" + classname + "'", e);
+            throw new WikiException("Faulty provider class.", e);
+        } catch (IllegalAccessException e) {
+            log.error("Illegal access to provider class '" + classname + "'", e);
+            throw new WikiException("Illegal provider class.", e);
+        } catch (NoRequiredPropertyException e) {
+            log.error("Provider did not found a property it was looking for: " + e.getMessage(), e);
             throw e;  // Same exception works.
-        } catch( IOException e ) {
-            log.error("An I/O exception occurred while trying to create a new page provider: " + classname, e );
-            throw new WikiException( "Unable to start page provider: " + e.getMessage(), e );
+        } catch (IOException e) {
+            log.error("An I/O exception occurred while trying to create a new page provider: " + classname, e);
+            throw new WikiException("Unable to start page provider: " + e.getMessage(), e);
         }
 
     }
 
     /**
-     *  Returns the page provider currently in use.
-     *  
-     *  @return A WikiPageProvider instance.
+     * Returns the page provider currently in use.
+     *
+     * @return A WikiPageProvider instance.
      */
     public WikiPageProvider getProvider() {
         return m_provider;
     }
 
     /**
-     *  Returns all pages in some random order.  If you need just the page names, 
-     *  please see {@link ReferenceManager#findCreated()}, which is probably a lot
-     *  faster.  This method may cause repository access.
-     *  
-     *  @return A Collection of WikiPage objects.
-     *  @throws ProviderException If the backend has problems.
+     * Returns all pages in some random order.  If you need just the page names,
+     * please see {@link ReferenceManager#findCreated()}, which is probably a lot
+     * faster.  This method may cause repository access.
+     *
+     * @return A Collection of WikiPage objects.
+     * @throws ProviderException If the backend has problems.
      */
     public Collection getAllPages() throws ProviderException {
         return m_provider.getAllPages();
     }
 
     /**
-     *  Fetches the page text from the repository.  This method also does some sanity checks,
-     *  like checking for the pageName validity, etc.  Also, if the page repository has been
-     *  modified externally, it is smart enough to handle such occurrences.
-     *  
-     *  @param pageName The name of the page to fetch.
-     *  @param version The version to find
-     *  @return The page content as a raw string
-     *  @throws ProviderException If the backend has issues.
+     * Fetches the page text from the repository.  This method also does some sanity checks,
+     * like checking for the pageName validity, etc.  Also, if the page repository has been
+     * modified externally, it is smart enough to handle such occurrences.
+     *
+     * @param pageName The name of the page to fetch.
+     * @param version  The version to find
+     * @return The page content as a raw string
+     * @throws ProviderException If the backend has issues.
      */
-    public String getPageText( String pageName, int version ) throws ProviderException {
-        if( pageName == null || pageName.length() == 0 ) {
+    public String getPageText(String pageName, int version) throws ProviderException {
+        if (pageName == null || pageName.length() == 0) {
             throw new ProviderException("Illegal page name");
         }
         String text = null;
 
         try {
-            text = m_provider.getPageText( pageName, version );
-        } catch( RepositoryModifiedException e ) {
+            text = m_provider.getPageText(pageName, version);
+        } catch (RepositoryModifiedException e) {
             //
             //  This only occurs with the latest version.
             //
-            log.info( "Repository has been modified externally while fetching page " + pageName );
+            log.info("Repository has been modified externally while fetching page " + pageName);
 
             //
             //  Empty the references and yay, it shall be recalculated
             //
             //WikiPage p = new WikiPage( pageName );
-            WikiPage p = m_provider.getPageInfo( pageName, version );
+            WikiPage p = m_provider.getPageInfo(pageName, version);
 
-            m_engine.updateReferences( p );
+            m_engine.updateReferences(p);
 
-            if( p != null ) {
-                m_engine.getSearchManager().reindexPage( p );
-                text = m_provider.getPageText( pageName, version );
+            if (p != null) {
+                m_engine.getSearchManager().reindexPage(p);
+                text = m_provider.getPageText(pageName, version);
             } else {
                 //
                 //  Make sure that it no longer exists in internal data structures either.
                 //
-                WikiPage dummy = new WikiPage( m_engine, pageName );
-                m_engine.getSearchManager().pageRemoved( dummy );
-                m_engine.getReferenceManager().pageRemoved( dummy );
+                WikiPage dummy = new WikiPage(m_engine, pageName);
+                m_engine.getSearchManager().pageRemoved(dummy);
+                m_engine.getReferenceManager().pageRemoved(dummy);
             }
         }
 
@@ -249,67 +277,67 @@ public class PageManager extends ModuleM
     }
 
     /**
-     *  Returns the WikiEngine to which this PageManager belongs to.
-     *  
-     *  @return The WikiEngine object.
+     * Returns the WikiEngine to which this PageManager belongs to.
+     *
+     * @return The WikiEngine object.
      */
     public WikiEngine getEngine() {
         return m_engine;
     }
 
     /**
-     *  Puts the page text into the repository.  Note that this method does NOT update
-     *  JSPWiki internal data structures, and therefore you should always use WikiEngine.saveText()
+     * Puts the page text into the repository.  Note that this method does NOT update
+     * JSPWiki internal data structures, and therefore you should always use WikiEngine.saveText()
      *
-     * @param page Page to save
+     * @param page    Page to save
      * @param content Wikimarkup to save
      * @throws ProviderException If something goes wrong in the saving phase
      */
-    public void putPageText( WikiPage page, String content ) throws ProviderException {
-        if( page == null || page.getName() == null || page.getName().length() == 0 ) {
-            throw new ProviderException( "Illegal page name" );
+    public void putPageText(WikiPage page, String content) throws ProviderException {
+        if (page == null || page.getName() == null || page.getName().length() == 0) {
+            throw new ProviderException("Illegal page name");
         }
 
-        m_provider.putPageText( page, content );
+        m_provider.putPageText(page, content);
     }
 
     /**
-     *  Locks page for editing.  Note, however, that the PageManager
-     *  will in no way prevent you from actually editing this page;
-     *  the lock is just for information.
+     * Locks page for editing.  Note, however, that the PageManager
+     * will in no way prevent you from actually editing this page;
+     * the lock is just for information.
      *
-     *  @param page WikiPage to lock
-     *  @param user Username to use for locking
-     *  @return null, if page could not be locked.
+     * @param page WikiPage to lock
+     * @param user Username to use for locking
+     * @return null, if page could not be locked.
      */
-    public PageLock lockPage( WikiPage page, String user ) {
+    public PageLock lockPage(WikiPage page, String user) {
         PageLock lock = null;
 
-        if( m_reaper == null ) {
+        if (m_reaper == null) {
             //
             //  Start the lock reaper lazily.  We don't want to start it in
             //  the constructor, because starting threads in constructors
             //  is a bad idea when it comes to inheritance.  Besides,
             //  laziness is a virtue.
             //
-            m_reaper = new LockReaper( m_engine );
+            m_reaper = new LockReaper(m_engine);
             m_reaper.start();
         }
 
-        synchronized( m_pageLocks ) {
-            fireEvent( WikiPageEvent.PAGE_LOCK, page.getName() ); // prior to or after actual lock?
-            lock = m_pageLocks.get( page.getName() );
+        synchronized (m_pageLocks) {
+            fireEvent(WikiPageEvent.PAGE_LOCK, page.getName()); // prior to or after actual lock?
+            lock = m_pageLocks.get(page.getName());
 
-            if( lock == null ) {
+            if (lock == null) {
                 //
                 //  Lock is available, so make a lock.
                 //
                 Date d = new Date();
-                lock = new PageLock( page, user, d, new Date( d.getTime() + m_expiryTime*60*1000L ) );
-                m_pageLocks.put( page.getName(), lock );
-                log.debug( "Locked page "+page.getName()+" for "+user);
+                lock = new PageLock(page, user, d, new Date(d.getTime() + m_expiryTime * 60 * 1000L));
+                m_pageLocks.put(page.getName(), lock);
+                log.debug("Locked page " + page.getName() + " for " + user);
             } else {
-                log.debug( "Page "+page.getName()+" already locked by "+lock.getLocker() );
+                log.debug("Page " + page.getName() + " already locked by " + lock.getLocker());
                 lock = null; // Nothing to return
             }
         }
@@ -318,52 +346,54 @@ public class PageManager extends ModuleM
     }
 
     /**
-     *  Marks a page free to be written again.  If there has not been a lock, will fail quietly.
+     * Marks a page free to be written again.  If there has not been a lock, will fail quietly.
      *
-     *  @param lock A lock acquired in lockPage().  Safe to be null.
+     * @param lock A lock acquired in lockPage().  Safe to be null.
      */
-    public void unlockPage( PageLock lock ) {
-        if( lock == null ) return;
+    public void unlockPage(PageLock lock) {
+        if (lock == null) {
+            return;
+        }
 
-        synchronized( m_pageLocks ) {
-            m_pageLocks.remove( lock.getPage() );
-            log.debug( "Unlocked page "+lock.getPage() );
+        synchronized (m_pageLocks) {
+            m_pageLocks.remove(lock.getPage());
+            log.debug("Unlocked page " + lock.getPage());
         }
 
-        fireEvent( WikiPageEvent.PAGE_UNLOCK, lock.getPage() );
+        fireEvent(WikiPageEvent.PAGE_UNLOCK, lock.getPage());
     }
 
     /**
-     *  Returns the current lock owner of a page.  If the page is not
-     *  locked, will return null.
+     * Returns the current lock owner of a page.  If the page is not
+     * locked, will return null.
      *
-     *  @param page The page to check the lock for
-     *  @return Current lock, or null, if there is no lock
+     * @param page The page to check the lock for
+     * @return Current lock, or null, if there is no lock
      */
-    public PageLock getCurrentLock( WikiPage page ) {
+    public PageLock getCurrentLock(WikiPage page) {
         PageLock lock = null;
 
-        synchronized( m_pageLocks ) {
-            lock = m_pageLocks.get( page.getName() );
+        synchronized (m_pageLocks) {
+            lock = m_pageLocks.get(page.getName());
         }
 
         return lock;
     }
 
     /**
-     *  Returns a list of currently applicable locks.  Note that by the time you get the list,
-     *  the locks may have already expired, so use this only for informational purposes.
+     * Returns a list of currently applicable locks.  Note that by the time you get the list,
+     * the locks may have already expired, so use this only for informational purposes.
      *
-     *  @return List of PageLock objects, detailing the locks.  If no locks exist, returns
-     *          an empty list.
-     *  @since 2.0.22.
+     * @return List of PageLock objects, detailing the locks.  If no locks exist, returns
+     *         an empty list.
+     * @since 2.0.22.
      */
     public List<PageLock> getActiveLocks() {
         ArrayList<PageLock> result = new ArrayList<PageLock>();
 
-        synchronized( m_pageLocks ) {
-            for( PageLock lock : m_pageLocks.values() ) {
-                result.add( lock );
+        synchronized (m_pageLocks) {
+            for (PageLock lock : m_pageLocks.values()) {
+                result.add(lock);
             }
         }
 
@@ -371,33 +401,33 @@ public class PageManager extends ModuleM
     }
 
     /**
-     *  Finds a WikiPage object describing a particular page and version.
-     *  
-     *  @param pageName  The name of the page
-     *  @param version   A version number
-     *  @return          A WikiPage object, or null, if the page does not exist
-     *  @throws ProviderException If there is something wrong with the page 
-     *                            name or the repository
-     */
-    public WikiPage getPageInfo( String pageName, int version ) throws ProviderException {
-        if( pageName == null || pageName.length() == 0 ) {
-            throw new ProviderException( "Illegal page name '" + pageName + "'" );
+     * Finds a WikiPage object describing a particular page and version.
+     *
+     * @param pageName The name of the page
+     * @param version  A version number
+     * @return A WikiPage object, or null, if the page does not exist
+     * @throws ProviderException If there is something wrong with the page
+     *                           name or the repository
+     */
+    public WikiPage getPageInfo(String pageName, int version) throws ProviderException {
+        if (pageName == null || pageName.length() == 0) {
+            throw new ProviderException("Illegal page name '" + pageName + "'");
         }
 
         WikiPage page = null;
 
         try {
-            page = m_provider.getPageInfo( pageName, version );
-        } catch( RepositoryModifiedException e ) {
+            page = m_provider.getPageInfo(pageName, version);
+        } catch (RepositoryModifiedException e) {
             //
             //  This only occurs with the latest version.
             //
-            log.info( "Repository has been modified externally while fetching info for " + pageName );
-            page = m_provider.getPageInfo( pageName, version );
-            if( page != null ) {
-                m_engine.updateReferences( page );
+            log.info("Repository has been modified externally while fetching info for " + pageName);
+            page = m_provider.getPageInfo(pageName, version);
+            if (page != null) {
+                m_engine.updateReferences(page);
             } else {
-                m_engine.getReferenceManager().pageRemoved( new WikiPage( m_engine, pageName ) );
+                m_engine.getReferenceManager().pageRemoved(new WikiPage(m_engine, pageName));
             }
         }
 
@@ -415,139 +445,139 @@ public class PageManager extends ModuleM
     }
 
     /**
-     *  Gets a version history of page.  Each element in the returned
-     *  List is a WikiPage.
-     *  
-     *  @param pageName The name of the page to fetch history for
-     *  @return If the page does not exist, returns null, otherwise a List
-     *          of WikiPages.
-     *  @throws ProviderException If the repository fails.
-     */
-    public List getVersionHistory( String pageName ) throws ProviderException {
-        if( pageExists( pageName ) ) {
-            return m_provider.getVersionHistory( pageName );
+     * Gets a version history of page.  Each element in the returned
+     * List is a WikiPage.
+     *
+     * @param pageName The name of the page to fetch history for
+     * @return If the page does not exist, returns null, otherwise a List
+     *         of WikiPages.
+     * @throws ProviderException If the repository fails.
+     */
+    public List getVersionHistory(String pageName) throws ProviderException {
+        if (pageExists(pageName)) {
+            return m_provider.getVersionHistory(pageName);
         }
 
         return null;
     }
 
     /**
-     *  Returns a human-readable description of the current provider.
-     *  
-     *  @return A human-readable description.
+     * Returns a human-readable description of the current provider.
+     *
+     * @return A human-readable description.
      */
     public String getProviderDescription() {
         return m_provider.getProviderInfo();
     }
 
     /**
-     *  Returns the total count of all pages in the repository. This
-     *  method is equivalent of calling getAllPages().size(), but
-     *  it swallows the ProviderException and returns -1 instead of
-     *  any problems.
-     *  
-     *  @return The number of pages, or -1, if there is an error.
+     * Returns the total count of all pages in the repository. This
+     * method is equivalent of calling getAllPages().size(), but
+     * it swallows the ProviderException and returns -1 instead of
+     * any problems.
+     *
+     * @return The number of pages, or -1, if there is an error.
      */
     public int getTotalPageCount() {
         try {
             return m_provider.getAllPages().size();
-        } catch( ProviderException e ) {
-            log.error( "Unable to count pages: ",e );
+        } catch (ProviderException e) {
+            log.error("Unable to count pages: ", e);
             return -1;
         }
     }
 
     /**
-     *  Returns true, if the page exists (any version).
-     *  
-     *  @param pageName  Name of the page.
-     *  @return A boolean value describing the existence of a page
-     *  @throws ProviderException If the backend fails or the name is illegal.
+     * Returns true, if the page exists (any version).
+     *
+     * @param pageName Name of the page.
+     * @return A boolean value describing the existence of a page
+     * @throws ProviderException If the backend fails or the name is illegal.
      */
-    public boolean pageExists( String pageName ) throws ProviderException {
-        if( pageName == null || pageName.length() == 0 ) {
-            throw new ProviderException( "Illegal page name" );
+    public boolean pageExists(String pageName) throws ProviderException {
+        if (pageName == null || pageName.length() == 0) {
+            throw new ProviderException("Illegal page name");
         }
 
-        return m_provider.pageExists( pageName );
+        return m_provider.pageExists(pageName);
     }
 
     /**
-     *  Checks for existence of a specific page and version.
-     *  
-     *  @since 2.3.29
-     *  @param pageName Name of the page
-     *  @param version The version to check
-     *  @return <code>true</code> if the page exists, <code>false</code> otherwise
-     *  @throws ProviderException If backend fails or name is illegal
+     * Checks for existence of a specific page and version.
+     *
+     * @param pageName Name of the page
+     * @param version  The version to check
+     * @return <code>true</code> if the page exists, <code>false</code> otherwise
+     * @throws ProviderException If backend fails or name is illegal
+     * @since 2.3.29
      */
-    public boolean pageExists( String pageName, int version ) throws ProviderException {
-        if( pageName == null || pageName.length() == 0 ) {
+    public boolean pageExists(String pageName, int version) throws ProviderException {
+        if (pageName == null || pageName.length() == 0) {
             throw new ProviderException("Illegal page name");
         }
 
-        if( version == WikiProvider.LATEST_VERSION ) {
-        	return pageExists( pageName );
+        if (version == WikiProvider.LATEST_VERSION) {
+            return pageExists(pageName);
         }
 
-        return m_provider.pageExists( pageName , version );
+        return m_provider.pageExists(pageName, version);
     }
 
     /**
-     *  Deletes only a specific version of a WikiPage.
-     *  
-     *  @param page The page to delete.
-     *  @throws ProviderException if the page fails
+     * Deletes only a specific version of a WikiPage.
+     *
+     * @param page The page to delete.
+     * @throws ProviderException if the page fails
      */
-    public void deleteVersion( WikiPage page ) throws ProviderException {
-        m_provider.deleteVersion( page.getName(), page.getVersion() );
+    public void deleteVersion(WikiPage page) throws ProviderException {
+        m_provider.deleteVersion(page.getName(), page.getVersion());
 
         // FIXME: If this was the latest, reindex Lucene
         // FIXME: Update RefMgr
     }
 
     /**
-     *  Deletes an entire page, all versions, all traces.
-     *  
-     *  @param page The WikiPage to delete
-     *  @throws ProviderException If the repository operation fails
+     * Deletes an entire page, all versions, all traces.
+     *
+     * @param page The WikiPage to delete
+     * @throws ProviderException If the repository operation fails
      */
-    public void deletePage( WikiPage page ) throws ProviderException {
-        fireEvent( WikiPageEvent.PAGE_DELETE_REQUEST, page.getName() );
-        m_provider.deletePage( page.getName() );
-        fireEvent( WikiPageEvent.PAGE_DELETED, page.getName() );
+    public void deletePage(WikiPage page) throws ProviderException {
+        fireEvent(WikiPageEvent.PAGE_DELETE_REQUEST, page.getName());
+        m_provider.deletePage(page.getName());
+        fireEvent(WikiPageEvent.PAGE_DELETED, page.getName());
     }
 
     /**
-     *  This is a simple reaper thread that runs roughly every minute
-     *  or so (it's not really that important, as long as it runs),
-     *  and removes all locks that have expired.
+     * This is a simple reaper thread that runs roughly every minute
+     * or so (it's not really that important, as long as it runs),
+     * and removes all locks that have expired.
      */
     private class LockReaper extends WikiBackgroundThread {
         /**
-         *  Create a LockReaper for a given engine.
-         *  
-         *  @param engine WikiEngine to own this thread.
+         * Create a LockReaper for a given engine.
+         *
+         * @param engine WikiEngine to own this thread.
          */
-        public LockReaper( WikiEngine engine ) {
-            super( engine, 60 );
+        public LockReaper(WikiEngine engine) {
+            super(engine, 60);
             setName("JSPWiki Lock Reaper");
         }
 
         public void backgroundTask() throws Exception {
-            synchronized( m_pageLocks ) {
-                Collection< PageLock > entries = m_pageLocks.values();
+            synchronized (m_pageLocks) {
+                Collection<PageLock> entries = m_pageLocks.values();
                 Date now = new Date();
-                for( Iterator< PageLock > i = entries.iterator(); i.hasNext(); ) {
+                for (Iterator<PageLock> i = entries.iterator(); i.hasNext(); ) {
                     PageLock p = i.next();
-                    
-                    if( now.after( p.getExpiryTime() ) ) {
+
+                    if (now.after(p.getExpiryTime())) {
                         i.remove();
 
-                        log.debug( "Reaped lock: " + p.getPage() +
-                                   " by " + p.getLocker() +
-                                   ", acquired " + p.getAcquisitionTime() +
-                                   ", and expired " + p.getExpiryTime() );
+                        log.debug("Reaped lock: " + p.getPage() +
+                                " by " + p.getLocker() +
+                                ", acquired " + p.getAcquisitionTime() +
+                                ", and expired " + p.getExpiryTime());
                     }
                 }
             }
@@ -562,7 +592,6 @@ public class PageManager extends ModuleM
      * returns {@link org.apache.wiki.workflow.Outcome#STEP_ABORT}. Any
      * WikiExceptions thrown by page filters will be re-thrown, and the workflow
      * will abort.
-     *
      */
     public static class PreSaveWikiPageTask extends Task {
         private static final long serialVersionUID = 6304715570092804615L;
@@ -570,19 +599,19 @@ public class PageManager extends ModuleM
         private final String m_proposedText;
 
         /**
-         *  Creates the task.
-         *  
-         *  @param context The WikiContext
-         *  @param proposedText The text that was just saved.
+         * Creates the task.
+         *
+         * @param context      The WikiContext
+         * @param proposedText The text that was just saved.
          */
-        public PreSaveWikiPageTask( WikiContext context, String proposedText ) {
-            super( PRESAVE_TASK_MESSAGE_KEY );
+        public PreSaveWikiPageTask(WikiContext context, String proposedText) {
+            super(PRESAVE_TASK_MESSAGE_KEY);
             m_context = context;
             m_proposedText = proposedText;
         }
 
         /**
-         *  {@inheritDoc}
+         * {@inheritDoc}
          */
         @Override
         public Outcome execute() throws WikiException {
@@ -596,22 +625,22 @@ public class PageManager extends ModuleM
             // Figure out who the author was. Prefer the author
             // set programmatically; otherwise get from the
             // current logged in user
-            if ( page.getAuthor() == null ) {
+            if (page.getAuthor() == null) {
                 Principal wup = m_context.getCurrentUser();
 
-                if ( wup != null ) {
-                	page.setAuthor( wup.getName() );
+                if (wup != null) {
+                    page.setAuthor(wup.getName());
                 }
             }
 
             // Run the pre-save filters. If any exceptions, add error to list, abort, and redirect
             String saveText;
             FilterManager fm = engine.getFilterManager();
-            saveText = fm.doPreSaveFiltering( m_context, m_proposedText );
+            saveText = fm.doPreSaveFiltering(m_context, m_proposedText);
 
             // Stash the wiki context, old and new text as workflow attributes
-            workflow.setAttribute( PRESAVE_WIKI_CONTEXT, m_context );
-            workflow.setAttribute( FACT_PROPOSED_TEXT, saveText );
+            workflow.setAttribute(PRESAVE_WIKI_CONTEXT, m_context);
+            workflow.setAttribute(FACT_PROPOSED_TEXT, saveText);
             return Outcome.STEP_COMPLETE;
         }
     }
@@ -621,36 +650,37 @@ public class PageManager extends ModuleM
      * of this class are assumed to have been added to an approval workflow via
      * {@link org.apache.wiki.workflow.WorkflowBuilder#buildApprovalWorkflow(Principal, String, Task, String, org.apache.wiki.workflow.Fact[], Task, String)};
      * they will not function correctly otherwise.
-     *
      */
     public static class SaveWikiPageTask extends Task {
         private static final long serialVersionUID = 3190559953484411420L;
 
         /**
-         *  Creates the Task.
+         * Creates the Task.
          */
         public SaveWikiPageTask() {
-            super( SAVE_TASK_MESSAGE_KEY );
+            super(SAVE_TASK_MESSAGE_KEY);
         }
 
-        /** {@inheritDoc} */
+        /**
+         * {@inheritDoc}
+         */
         @Override
         public Outcome execute() throws WikiException {
             // Retrieve attributes
-            WikiContext context = (WikiContext) getWorkflow().getAttribute( PRESAVE_WIKI_CONTEXT );
-            String proposedText = (String) getWorkflow().getAttribute( FACT_PROPOSED_TEXT );
+            WikiContext context = (WikiContext) getWorkflow().getAttribute(PRESAVE_WIKI_CONTEXT);
+            String proposedText = (String) getWorkflow().getAttribute(FACT_PROPOSED_TEXT);
 
             WikiEngine engine = context.getEngine();
             WikiPage page = context.getPage();
 
             // Let the rest of the engine handle actual saving.
-            engine.getPageManager().putPageText( page, proposedText );
+            engine.getPageManager().putPageText(page, proposedText);
 
             // Refresh the context for post save filtering.
-            engine.getPage( page.getName() );
-            engine.textToHTML( context, proposedText );
+            engine.getPage(page.getName());
+            engine.textToHTML(context, proposedText);
             FilterManager fm = engine.getFilterManager();
-            fm.doPostSaveFiltering( context, proposedText );
+            fm.doPostSaveFiltering(context, proposedText);
 
             return Outcome.STEP_COMPLETE;
         }
@@ -659,120 +689,118 @@ public class PageManager extends ModuleM
     // events processing .......................................................
 
     /**
-     *  Fires a WikiPageEvent of the provided type and page name
-     *  to all registered listeners.
+     * Fires a WikiPageEvent of the provided type and page name
+     * to all registered listeners.
      *
+     * @param type     the event type to be fired
+     * @param pagename the wiki page name as a String
      * @see org.apache.wiki.event.WikiPageEvent
-     * @param type       the event type to be fired
-     * @param pagename   the wiki page name as a String
      */
-    protected final void fireEvent( int type, String pagename ) {
-        if ( WikiEventManager.isListening( this ) ) {
-            WikiEventManager.fireEvent( this, new WikiPageEvent( m_engine, type, pagename ) );
+    protected final void fireEvent(int type, String pagename) {
+        if (WikiEventManager.isListening(this)) {
+            WikiEventManager.fireEvent(this, new WikiPageEvent(m_engine, type, pagename));
         }
     }
 
     /**
-     *  {@inheritDoc}
+     * {@inheritDoc}
      */
     @Override
-    public Collection modules()
-    {
+    public Collection modules() {
         // TODO Auto-generated method stub
         return null;
     }
 
 
     /**
-     *  Listens for {@link org.apache.wiki.event.WikiSecurityEvent#PROFILE_NAME_CHANGED}
-     *  events. If a user profile's name changes, each page ACL is inspected. If an entry contains
-     *  a name that has changed, it is replaced with the new one. No events are emitted
-     *  as a consequence of this method, because the page contents are still the same; it is
-     *  only the representations of the names within the ACL that are changing.
-     * 
-     *  @param event The event
+     * Listens for {@link org.apache.wiki.event.WikiSecurityEvent#PROFILE_NAME_CHANGED}
+     * events. If a user profile's name changes, each page ACL is inspected. If an entry contains
+     * a name that has changed, it is replaced with the new one. No events are emitted
+     * as a consequence of this method, because the page contents are still the same; it is
+     * only the representations of the names within the ACL that are changing.
+     *
+     * @param event The event
      */
-    public void actionPerformed( WikiEvent event ) {
-        if (! ( event instanceof WikiSecurityEvent ) ) {
+    public void actionPerformed(WikiEvent event) {
+        if (!(event instanceof WikiSecurityEvent)) {
             return;
         }
 
-        WikiSecurityEvent se = (WikiSecurityEvent)event;
-        if ( se.getType() == WikiSecurityEvent.PROFILE_NAME_CHANGED ) {
-            UserProfile[] profiles = (UserProfile[])se.getTarget();
+        WikiSecurityEvent se = (WikiSecurityEvent) event;
+        if (se.getType() == WikiSecurityEvent.PROFILE_NAME_CHANGED) {
+            UserProfile[] profiles = (UserProfile[]) se.getTarget();
             Principal[] oldPrincipals = new Principal[]
-                { new WikiPrincipal( profiles[0].getLoginName() ),
-                  new WikiPrincipal( profiles[0].getFullname() ),
-                  new WikiPrincipal( profiles[0].getWikiName() ) };
-            Principal newPrincipal = new WikiPrincipal( profiles[1].getFullname() );
+                    {new WikiPrincipal(profiles[0].getLoginName()),
+                            new WikiPrincipal(profiles[0].getFullname()),
+                            new WikiPrincipal(profiles[0].getWikiName())};
+            Principal newPrincipal = new WikiPrincipal(profiles[1].getFullname());
 
             // Examine each page ACL
             try {
                 int pagesChanged = 0;
                 Collection pages = getAllPages();
-                for ( Iterator it = pages.iterator(); it.hasNext(); ) {
-                    WikiPage page = (WikiPage)it.next();
-                    boolean aclChanged = changeAcl( page, oldPrincipals, newPrincipal );
-                    if ( aclChanged ) {
+                for (Iterator it = pages.iterator(); it.hasNext(); ) {
+                    WikiPage page = (WikiPage) it.next();
+                    boolean aclChanged = changeAcl(page, oldPrincipals, newPrincipal);
+                    if (aclChanged) {
                         // If the Acl needed changing, change it now
                         try {
-                            m_engine.getAclManager().setPermissions( page, page.getAcl() );
-                        } catch ( WikiSecurityException e ) {
-                            log.error( "Could not change page ACL for page " + page.getName() + ": " + e.getMessage(), e );
+                            m_engine.getAclManager().setPermissions(page, page.getAcl());
+                        } catch (WikiSecurityException e) {
+                            log.error("Could not change page ACL for page " + page.getName() + ": " + e.getMessage(), e);
                         }
                         pagesChanged++;
                     }
                 }
-                log.info( "Profile name change for '" + newPrincipal.toString() +
-                          "' caused " + pagesChanged + " page ACLs to change also." );
-            }
-            catch ( ProviderException e ) {
+                log.info("Profile name change for '" + newPrincipal.toString() +
+                        "' caused " + pagesChanged + " page ACLs to change also.");
+            } catch (ProviderException e) {
                 // Oooo! This is really bad...
-                log.error( "Could not change user name in Page ACLs because of Provider error:" + e.getMessage(), e );
+                log.error("Could not change user name in Page ACLs because of Provider error:" + e.getMessage(), e);
             }
         }
     }
 
     /**
-     *  For a single wiki page, replaces all Acl entries matching a supplied array of Principals 
-     *  with a new Principal.
-     * 
-     *  @param page the wiki page whose Acl is to be modified
-     *  @param oldPrincipals an array of Principals to replace; all AclEntry objects whose
-     *   {@link AclEntry#getPrincipal()} method returns one of these Principals will be replaced
-     *  @param newPrincipal the Principal that should receive the old Principals' permissions
-     *  @return <code>true</code> if the Acl was actually changed; <code>false</code> otherwise
+     * For a single wiki page, replaces all Acl entries matching a supplied array of Principals
+     * with a new Principal.
+     *
+     * @param page          the wiki page whose Acl is to be modified
+     * @param oldPrincipals an array of Principals to replace; all AclEntry objects whose
+     *                      {@link AclEntry#getPrincipal()} method returns one of these Principals will be replaced
+     * @param newPrincipal  the Principal that should receive the old Principals' permissions
+     * @return <code>true</code> if the Acl was actually changed; <code>false</code> otherwise
      */
-    protected boolean changeAcl( WikiPage page, Principal[] oldPrincipals, Principal newPrincipal ) {
+    protected boolean changeAcl(WikiPage page, Principal[] oldPrincipals, Principal newPrincipal) {
         Acl acl = page.getAcl();
         boolean pageChanged = false;
-        if ( acl != null ) {
-            Enumeration< AclEntry > entries      = acl.entries();
-            Collection< AclEntry > entriesToAdd    = new ArrayList< AclEntry >();
-            Collection< AclEntry > entriesToRemove = new ArrayList< AclEntry >();
-            while ( entries.hasMoreElements() ) {
+        if (acl != null) {
+            Enumeration<AclEntry> entries = acl.entries();
+            Collection<AclEntry> entriesToAdd = new ArrayList<AclEntry>();
+            Collection<AclEntry> entriesToRemove = new ArrayList<AclEntry>();
+            while (entries.hasMoreElements()) {
                 AclEntry entry = entries.nextElement();
-                if ( ArrayUtils.contains( oldPrincipals, entry.getPrincipal() ) ) {
+                if (ArrayUtils.contains(oldPrincipals, entry.getPrincipal())) {
                     // Create new entry
                     AclEntry newEntry = new AclEntryImpl();
-                    newEntry.setPrincipal( newPrincipal );
-                    Enumeration< Permission > permissions = entry.permissions();
-                    while ( permissions.hasMoreElements() ) {
+                    newEntry.setPrincipal(newPrincipal);
+                    Enumeration<Permission> permissions = entry.permissions();
+                    while (permissions.hasMoreElements()) {
                         Permission permission = permissions.nextElement();
-                        newEntry.addPermission( permission );
+                        newEntry.addPermission(permission);
                     }
                     pageChanged = true;
-                    entriesToRemove.add( entry );
-                    entriesToAdd.add( newEntry );
+                    entriesToRemove.add(entry);
+                    entriesToAdd.add(newEntry);
                 }
             }
-            for ( Iterator< AclEntry > ix = entriesToRemove.iterator(); ix.hasNext(); ) {
+            for (Iterator<AclEntry> ix = entriesToRemove.iterator(); ix.hasNext(); ) {
                 AclEntry entry = ix.next();
-                acl.removeEntry( entry );
+                acl.removeEntry(entry);
             }
-            for ( Iterator< AclEntry > ix = entriesToAdd.iterator(); ix.hasNext(); ) {
+            for (Iterator<AclEntry> ix = entriesToAdd.iterator(); ix.hasNext(); ) {
                 AclEntry entry = ix.next();
-                acl.addEntry( entry );
+                acl.addEntry(entry);
             }
         }
         return pageChanged;

Modified: jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/WikiServlet.java
URL: http://svn.apache.org/viewvc/jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/WikiServlet.java?rev=1554363&r1=1554362&r2=1554363&view=diff
==============================================================================
--- jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/WikiServlet.java (original)
+++ jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/WikiServlet.java Tue Dec 31 03:37:41 2013
@@ -28,28 +28,25 @@ import org.apache.log4j.Logger;
 import org.apache.wiki.url.DefaultURLConstructor;
 
 /**
- *  This provides a master servlet for dealing with short urls.  It mostly does
- *  redirects to the proper JSP pages. It also intercepts the servlet
- *  shutdown events and uses it to signal wiki shutdown.
- *  
- *  @since 2.2
+ * This provides a master servlet for dealing with short urls.  It mostly does
+ * redirects to the proper JSP pages. It also intercepts the servlet
+ * shutdown events and uses it to signal wiki shutdown.
+ *
+ * @since 2.2
  */
-public class WikiServlet
-    extends HttpServlet
-{
+public class WikiServlet extends HttpServlet {
     private static final long serialVersionUID = 3258410651167633973L;
     private WikiEngine m_engine;
     static final Logger log = Logger.getLogger(WikiServlet.class.getName());
 
     /**
-     *  {@inheritDoc}
+     * {@inheritDoc}
      */
-    public void init( ServletConfig config )
-        throws ServletException 
-    {
-        super.init( config );
+    public void init(ServletConfig config)
+            throws ServletException {
+        super.init(config);
 
-        m_engine         = WikiEngine.getInstance( config );
+        m_engine = WikiEngine.getInstance(config);
 
         log.info("WikiServlet initialized.");
     }
@@ -60,10 +57,10 @@ public class WikiServlet
      * protected method {@link WikiEngine#shutdown()}, which
      * sends {@link org.apache.wiki.event.WikiEngineEvent#SHUTDOWN}
      * events to registered listeners.
+     *
      * @see javax.servlet.GenericServlet#destroy()
      */
-    public void destroy()
-    {
+    public void destroy() {
         log.info("WikiServlet shutdown.");
         CacheManager.getInstance().shutdown();
         m_engine.shutdown();
@@ -71,33 +68,32 @@ public class WikiServlet
     }
 
     /**
-     *  {@inheritDoc}
+     * {@inheritDoc}
      */
-    public void doPost( HttpServletRequest req, HttpServletResponse res )
-        throws IOException, ServletException
-    {
-        doGet( req, res );
+    public void doPost(HttpServletRequest req, HttpServletResponse res)
+            throws IOException, ServletException {
+        doGet(req, res);
     }
-    
+
     /**
-     *  {@inheritDoc}
+     * {@inheritDoc}
      */
-    public void doGet( HttpServletRequest req, HttpServletResponse res ) 
-        throws IOException, ServletException 
-    {
-        String pageName = DefaultURLConstructor.parsePageFromURL( req,
-                                                                  m_engine.getContentEncoding() );
-
-        log.info("Request for page: "+pageName);
-
-        if( pageName == null ) pageName = m_engine.getFrontPage(); // FIXME: Add special pages as well
-        
-        String jspPage = m_engine.getURLConstructor().getForwardPage( req );
-        
-        RequestDispatcher dispatcher = req.getRequestDispatcher("/"+jspPage+"?page="+m_engine.encodeName(pageName)+"&"+req.getQueryString() );
+    public void doGet(HttpServletRequest req, HttpServletResponse res)
+            throws IOException, ServletException {
+        String pageName = DefaultURLConstructor.parsePageFromURL(req,
+                m_engine.getContentEncoding());
 
-        dispatcher.forward( req, res );
-    }
-}
+        log.info("Request for page: " + pageName);
+
+        if (pageName == null) {
+            pageName = m_engine.getFrontPage(); // FIXME: Add special pages as well
+        }
 
+        String jspPage = m_engine.getURLConstructor().getForwardPage(req);
 
+        RequestDispatcher dispatcher = req.getRequestDispatcher("/" + jspPage + "?page="
+                + m_engine.encodeName(pageName) + "&" + req.getQueryString());
+
+        dispatcher.forward(req, res);
+    }
+}

Modified: jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/auth/acl/DefaultAclManager.java
URL: http://svn.apache.org/viewvc/jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/auth/acl/DefaultAclManager.java?rev=1554363&r1=1554362&r2=1554363&view=diff
==============================================================================
--- jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/auth/acl/DefaultAclManager.java (original)
+++ jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/auth/acl/DefaultAclManager.java Tue Dec 31 03:37:41 2013
@@ -49,40 +49,41 @@ import org.apache.wiki.render.RenderingM
 
 /**
  * Default implementation that parses Acls from wiki page markup.
+ *
  * @since 2.3
  */
 public class DefaultAclManager implements AclManager {
 
-    private static final Logger  log    = Logger.getLogger( DefaultAclManager.class );
+    private static final Logger log = Logger.getLogger(DefaultAclManager.class);
 
     private AuthorizationManager m_auth = null;
-    private WikiEngine           m_engine = null;
+    private WikiEngine m_engine = null;
     private static final String PERM_REGEX = "(" +
-        PagePermission.COMMENT_ACTION + "|" +
-        PagePermission.DELETE_ACTION  + "|" +
-        PagePermission.EDIT_ACTION    + "|" +
-        PagePermission.MODIFY_ACTION  + "|" +
-        PagePermission.RENAME_ACTION  + "|" +
-        PagePermission.UPLOAD_ACTION  + "|" +
-        PagePermission.VIEW_ACTION    + ")";
+            PagePermission.COMMENT_ACTION + "|" +
+            PagePermission.DELETE_ACTION + "|" +
+            PagePermission.EDIT_ACTION + "|" +
+            PagePermission.MODIFY_ACTION + "|" +
+            PagePermission.RENAME_ACTION + "|" +
+            PagePermission.UPLOAD_ACTION + "|" +
+            PagePermission.VIEW_ACTION + ")";
     private static final String ACL_REGEX = "\\[\\{\\s*ALLOW\\s+" + PERM_REGEX + "\\s*(.*?)\\s*\\}\\]";
 
     /**
      * Identifies ACL strings in wiki text; the first group is the action (view, edit) and
      * the second is the list of Principals separated by commas. The overall match is
      * the ACL string from [{ to }].
-     * */
-    public static final Pattern ACL_PATTERN = Pattern.compile( ACL_REGEX );
+     */
+    public static final Pattern ACL_PATTERN = Pattern.compile(ACL_REGEX);
 
     /**
      * Initializes the AclManager with a supplied wiki engine and properties.
+     *
      * @param engine the wiki engine
-     * @param props the initialization properties
+     * @param props  the initialization properties
      * @see org.apache.wiki.auth.acl.AclManager#initialize(org.apache.wiki.WikiEngine,
      *      java.util.Properties)
      */
-    public void initialize( WikiEngine engine, Properties props )
-    {
+    public void initialize(WikiEngine engine, Properties props) {
         m_auth = engine.getAuthorizationManager();
         m_engine = engine;
     }
@@ -91,62 +92,54 @@ public class DefaultAclManager implement
      * A helper method for parsing textual AccessControlLists. The line is in
      * form "ALLOW <permission> <principal>, <principal>, <principal>". This
      * method was moved from Authorizer.
-     * @param page The current wiki page. If the page already has an ACL, it
-     *            will be used as a basis for this ACL in order to avoid the
-     *            creation of a new one.
+     *
+     * @param page     The current wiki page. If the page already has an ACL, it
+     *                 will be used as a basis for this ACL in order to avoid the
+     *                 creation of a new one.
      * @param ruleLine The rule line, as described above.
      * @return A valid Access Control List. May be empty.
      * @throws WikiSecurityException if the ruleLine was faulty somehow.
      * @since 2.1.121
      */
-    public Acl parseAcl( WikiPage page, String ruleLine ) throws WikiSecurityException
-    {
+    public Acl parseAcl(WikiPage page, String ruleLine) throws WikiSecurityException {
         Acl acl = page.getAcl();
-        if ( acl == null )
+        if (acl == null) {
             acl = new AclImpl();
+        }
 
-        try
-        {
-            StringTokenizer fieldToks = new StringTokenizer( ruleLine );
+        try {
+            StringTokenizer fieldToks = new StringTokenizer(ruleLine);
             fieldToks.nextToken();
             String actions = fieldToks.nextToken();
             page.getName();
 
-            while( fieldToks.hasMoreTokens() )
-            {
-                String principalName = fieldToks.nextToken( "," ).trim();
-                Principal principal = m_auth.resolvePrincipal( principalName );
-                AclEntry oldEntry = acl.getEntry( principal );
-
-                if ( oldEntry != null )
-                {
-                    log.debug( "Adding to old acl list: " + principal + ", " + actions );
-                    oldEntry.addPermission( PermissionFactory.getPagePermission( page, actions ) );
-                }
-                else
-                {
-                    log.debug( "Adding new acl entry for " + actions );
+            while (fieldToks.hasMoreTokens()) {
+                String principalName = fieldToks.nextToken(",").trim();
+                Principal principal = m_auth.resolvePrincipal(principalName);
+                AclEntry oldEntry = acl.getEntry(principal);
+
+                if (oldEntry != null) {
+                    log.debug("Adding to old acl list: " + principal + ", " + actions);
+                    oldEntry.addPermission(PermissionFactory.getPagePermission(page, actions));
+                } else {
+                    log.debug("Adding new acl entry for " + actions);
                     AclEntry entry = new AclEntryImpl();
 
-                    entry.setPrincipal( principal );
-                    entry.addPermission( PermissionFactory.getPagePermission( page, actions ) );
+                    entry.setPrincipal(principal);
+                    entry.addPermission(PermissionFactory.getPagePermission(page, actions));
 
-                    acl.addEntry( entry );
+                    acl.addEntry(entry);
                 }
             }
 
-            page.setAcl( acl );
+            page.setAcl(acl);
 
-            log.debug( acl.toString() );
-        }
-        catch( NoSuchElementException nsee )
-        {
-            log.warn( "Invalid access rule: " + ruleLine + " - defaults will be used." );
-            throw new WikiSecurityException( "Invalid access rule: " + ruleLine, nsee );
-        }
-        catch( IllegalArgumentException iae )
-        {
-            throw new WikiSecurityException( "Invalid permission type: " + ruleLine, iae );
+            log.debug(acl.toString());
+        } catch (NoSuchElementException nsee) {
+            log.warn("Invalid access rule: " + ruleLine + " - defaults will be used.");
+            throw new WikiSecurityException("Invalid access rule: " + ruleLine, nsee);
+        } catch (IllegalArgumentException iae) {
+            throw new WikiSecurityException("Invalid permission type: " + ruleLine, iae);
         }
 
         return acl;
@@ -160,47 +153,42 @@ public class DefaultAclManager implement
      * This method was moved from Authorizer;
      * it was consolidated with some code from AuthorizationManager.
      * This method is guaranteed to return a non-<code>null</code> Acl.
+     *
      * @param page the page
-     * @since 2.2.121
      * @return the Acl representing permissions for the page
+     * @since 2.2.121
      */
-    public Acl getPermissions( WikiPage page )
-    {
+    public Acl getPermissions(WikiPage page) {
         //
         //  Does the page already have cached ACLs?
         //
         Acl acl = page.getAcl();
-        log.debug( "page="+page.getName()+"\n"+acl );
+        log.debug("page=" + page.getName() + "\n" + acl);
 
-        if( acl == null )
-        {
+        if (acl == null) {
             //
             //  If null, try the parent.
             //
-            if( page instanceof Attachment )
-            {
-                WikiPage parent = m_engine.getPage( ((Attachment)page).getParentName() );
+            if (page instanceof Attachment) {
+                WikiPage parent = m_engine.getPage(((Attachment) page).getParentName());
 
-                acl = getPermissions( parent );
-            }
-            else
-            {
+                acl = getPermissions(parent);
+            } else {
                 //
                 //  Or, try parsing the page
                 //
-                WikiContext ctx = new WikiContext( m_engine, page );
+                WikiContext ctx = new WikiContext(m_engine, page);
 
-                ctx.setVariable( RenderingManager.VAR_EXECUTE_PLUGINS, Boolean.FALSE );
+                ctx.setVariable(RenderingManager.VAR_EXECUTE_PLUGINS, Boolean.FALSE);
 
-                m_engine.getHTML( ctx, page );
+                m_engine.getHTML(ctx, page);
 
-                page = m_engine.getPage( page.getName(), page.getVersion() );
+                page = m_engine.getPage(page.getName(), page.getVersion());
                 acl = page.getAcl();
 
-                if( acl == null )
-                {
+                if (acl == null) {
                     acl = new AclImpl();
-                    page.setAcl( acl );
+                    page.setAcl(acl);
                 }
             }
         }
@@ -214,34 +202,30 @@ public class DefaultAclManager implement
      * called, all other ACL markup in the page is removed. This method will forcibly
      * expire locks on the wiki page if they exist. Any ProviderExceptions will be
      * re-thrown as WikiSecurityExceptions.
+     *
      * @param page the wiki page
-     * @param acl the access control list
-     * @since 2.5
+     * @param acl  the access control list
      * @throws WikiSecurityException of the Acl cannot be set
+     * @since 2.5
      */
-    public void setPermissions( WikiPage page, Acl acl ) throws WikiSecurityException
-    {
+    public void setPermissions(WikiPage page, Acl acl) throws WikiSecurityException {
         PageManager pageManager = m_engine.getPageManager();
 
         // Forcibly expire any page locks
-        PageLock lock = pageManager.getCurrentLock( page );
-        if ( lock != null )
-        {
-            pageManager.unlockPage( lock );
+        PageLock lock = pageManager.getCurrentLock(page);
+        if (lock != null) {
+            pageManager.unlockPage(lock);
         }
 
         // Remove all of the existing ACLs.
-        String pageText = m_engine.getPureText( page );
-        Matcher matcher = DefaultAclManager.ACL_PATTERN.matcher( pageText );
-        String cleansedText = matcher.replaceAll( "" );
-        String newText = DefaultAclManager.printAcl( page.getAcl() ) + cleansedText;
-        try
-        {
-            pageManager.putPageText( page, newText );
-        }
-        catch ( ProviderException e )
-        {
-            throw new WikiSecurityException( "Could not set Acl. Reason: ProviderExcpetion " + e.getMessage(), e );
+        String pageText = m_engine.getPureText(page);
+        Matcher matcher = DefaultAclManager.ACL_PATTERN.matcher(pageText);
+        String cleansedText = matcher.replaceAll("");
+        String newText = DefaultAclManager.printAcl(page.getAcl()) + cleansedText;
+        try {
+            pageManager.putPageText(page, newText);
+        } catch (ProviderException e) {
+            throw new WikiSecurityException("Could not set Acl. Reason: ProviderExcpetion " + e.getMessage(), e);
         }
     }
 
@@ -249,58 +233,51 @@ public class DefaultAclManager implement
      * Generates an ACL string for inclusion in a wiki page, based on a supplied Acl object.
      * All of the permissions in this Acl are assumed to apply to the same page scope.
      * The names of the pages are ignored; only the actions and principals matter.
+     *
      * @param acl the ACL
      * @return the ACL string
      */
-    protected static String printAcl( Acl acl )
-    {
+    protected static String printAcl(Acl acl) {
         // Extract the ACL entries into a Map with keys == permissions, values == principals
         Map<String, List<Principal>> permissionPrincipals = new TreeMap<String, List<Principal>>();
         Enumeration<AclEntry> entries = acl.entries();
-        while ( entries.hasMoreElements() )
-        {
+        while (entries.hasMoreElements()) {
             AclEntry entry = entries.nextElement();
             Principal principal = entry.getPrincipal();
             Enumeration<Permission> permissions = entry.permissions();
-            while ( permissions.hasMoreElements() )
-            {
+            while (permissions.hasMoreElements()) {
                 Permission permission = permissions.nextElement();
-                List<Principal> principals = permissionPrincipals.get( permission.getActions() );
-                if ( principals == null )
-                {
+                List<Principal> principals = permissionPrincipals.get(permission.getActions());
+                if (principals == null) {
                     principals = new ArrayList<Principal>();
                     String action = permission.getActions();
-                    if ( action.indexOf(',') != -1 )
-                    {
-                        throw new IllegalStateException( "AclEntry permission cannot have multiple targets." );
+                    if (action.indexOf(',') != -1) {
+                        throw new IllegalStateException("AclEntry permission cannot have multiple targets.");
                     }
-                    permissionPrincipals.put( action, principals );
+                    permissionPrincipals.put(action, principals);
                 }
-                principals.add( principal );
+                principals.add(principal);
             }
         }
 
         // Now, iterate through each permission in the map and generate an ACL string
 
         StringBuffer s = new StringBuffer();
-        for ( Map.Entry<String,List<Principal>>entry : permissionPrincipals.entrySet() )
-        {
+        for (Map.Entry<String, List<Principal>> entry : permissionPrincipals.entrySet()) {
             String action = entry.getKey();
             List<Principal> principals = entry.getValue();
-            Collections.sort( principals, new PrincipalComparator() );
-            s.append( "[{ALLOW ");
-            s.append( action );
-            s.append( " ");
-            for ( int i = 0; i < principals.size(); i++ )
-            {
-                Principal principal = principals.get( i );
-                s.append( principal.getName() );
-                if ( i < ( principals.size() - 1 ) )
-                {
+            Collections.sort(principals, new PrincipalComparator());
+            s.append("[{ALLOW ");
+            s.append(action);
+            s.append(" ");
+            for (int i = 0; i < principals.size(); i++) {
+                Principal principal = principals.get(i);
+                s.append(principal.getName());
+                if (i < (principals.size() - 1)) {
                     s.append(",");
                 }
             }
-            s.append( "}]\n");
+            s.append("}]\n");
         }
         return s.toString();
     }

Modified: jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/diff/DifferenceManager.java
URL: http://svn.apache.org/viewvc/jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/diff/DifferenceManager.java?rev=1554363&r1=1554362&r2=1554363&view=diff
==============================================================================
--- jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/diff/DifferenceManager.java (original)
+++ jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/diff/DifferenceManager.java Tue Dec 31 03:37:41 2013
@@ -32,23 +32,23 @@ import org.apache.wiki.util.ClassUtil;
 /**
  * Load, initialize and delegate to the DiffProvider that will actually do the work.
  */
-public class DifferenceManager
-{
+public class DifferenceManager {
     private static final Logger log = Logger.getLogger(DifferenceManager.class);
 
-    /** Property value for storing a diff provider.  Value is {@value}. */
+    /**
+     * Property value for storing a diff provider.  Value is {@value}.
+     */
     public static final String PROP_DIFF_PROVIDER = "jspwiki.diffProvider";
 
     private DiffProvider m_provider;
 
     /**
-     *  Creates a new DifferenceManager for the given engine.
-     *  
-     *  @param engine The WikiEngine.
-     *  @param props A set of properties.
+     * Creates a new DifferenceManager for the given engine.
+     *
+     * @param engine The WikiEngine.
+     * @param props  A set of properties.
      */
-    public DifferenceManager(WikiEngine engine, Properties props)
-    {
+    public DifferenceManager(WikiEngine engine, Properties props) {
         loadProvider(props);
 
         initializeProvider(engine, props);
@@ -56,76 +56,58 @@ public class DifferenceManager
         log.info("Using difference provider: " + m_provider.getProviderInfo());
     }
 
-    private void loadProvider(Properties props)
-    {
-        String providerClassName = props.getProperty( PROP_DIFF_PROVIDER,
-                                                      TraditionalDiffProvider.class.getName() );
-
-        try
-        {
-            Class< ? > providerClass = ClassUtil.findClass( "org.apache.wiki.diff", providerClassName );
-            m_provider = (DiffProvider)providerClass.newInstance();
-        }
-        catch( ClassNotFoundException e )
-        {
+    private void loadProvider(Properties props) {
+        String providerClassName = props.getProperty(PROP_DIFF_PROVIDER,
+                TraditionalDiffProvider.class.getName());
+
+        try {
+            Class<?> providerClass = ClassUtil.findClass("org.apache.wiki.diff", providerClassName);
+            m_provider = (DiffProvider) providerClass.newInstance();
+        } catch (ClassNotFoundException e) {
             log.warn("Failed loading DiffProvider, will use NullDiffProvider.", e);
-        }
-        catch( InstantiationException e )
-        {
+        } catch (InstantiationException e) {
             log.warn("Failed loading DiffProvider, will use NullDiffProvider.", e);
-        }
-        catch( IllegalAccessException e )
-        {
+        } catch (IllegalAccessException e) {
             log.warn("Failed loading DiffProvider, will use NullDiffProvider.", e);
         }
 
-        if( null == m_provider )
-        {
+        if (null == m_provider) {
             m_provider = new DiffProvider.NullDiffProvider();
         }
     }
 
 
-    private void initializeProvider(WikiEngine engine, Properties props)
-    {
-        try
-        {
-            m_provider.initialize( engine, props);
-        }
-        catch (NoRequiredPropertyException e1)
-        {
+    private void initializeProvider(WikiEngine engine, Properties props) {
+        try {
+            m_provider.initialize(engine, props);
+        } catch (NoRequiredPropertyException e1) {
             log.warn("Failed initializing DiffProvider, will use NullDiffProvider.", e1);
             m_provider = new DiffProvider.NullDiffProvider(); //doesn't need init'd
-        }
-        catch (IOException e1)
-        {
+        } catch (IOException e1) {
             log.warn("Failed initializing DiffProvider, will use NullDiffProvider.", e1);
             m_provider = new DiffProvider.NullDiffProvider(); //doesn't need init'd
         }
     }
 
     /**
-     *   Returns valid XHTML string to be used in any way you please.
+     * Returns valid XHTML string to be used in any way you please.
      *
-     *   @param context The Wiki Context
-     *   @param firstWikiText The old text
-     *   @param secondWikiText the new text
-     *   @return XHTML, or empty string, if no difference detected.
+     * @param context        The Wiki Context
+     * @param firstWikiText  The old text
+     * @param secondWikiText the new text
+     * @return XHTML, or empty string, if no difference detected.
      */
-    public String makeDiff(WikiContext context, String firstWikiText, String secondWikiText)
-    {
+    public String makeDiff(WikiContext context, String firstWikiText, String secondWikiText) {
         String diff = null;
-        try
-        {
-            diff = m_provider.makeDiffHtml( context, firstWikiText, secondWikiText);
+        try {
+            diff = m_provider.makeDiffHtml(context, firstWikiText, secondWikiText);
 
-            if( diff == null )
+            if (diff == null) {
                 diff = "";
-        }
-        catch(Exception e)
-        {
+            }
+        } catch (Exception e) {
             diff = "Failed to create a diff, check the logs.";
-            log.warn( diff, e);
+            log.warn(diff, e);
         }
         return diff;
     }

Modified: jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/forms/FormInfo.java
URL: http://svn.apache.org/viewvc/jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/forms/FormInfo.java?rev=1554363&r1=1554362&r2=1554363&view=diff
==============================================================================
--- jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/forms/FormInfo.java (original)
+++ jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/forms/FormInfo.java Tue Dec 31 03:37:41 2013
@@ -25,23 +25,26 @@ import java.util.Map;
 /**
  * Container for carrying HTTP FORM information between
  * WikiPlugin invocations in the Session.
- *
  */
-public class FormInfo
-    implements Serializable
-{
+public class FormInfo implements Serializable {
     private static final long serialVersionUID = 0L;
 
-    /** State: Form is executed. */
-    public static final int EXECUTED =  1;
-    
-    /** State: Form is OK. */
-    public static final int OK       =  0;
-    
-    /** State: There was an error. */
-    public static final int ERROR    = -1;
+    /**
+     * State: Form is executed.
+     */
+    public static final int EXECUTED = 1;
 
-    private int    m_status;
+    /**
+     * State: Form is OK.
+     */
+    public static final int OK = 0;
+
+    /**
+     * State: There was an error.
+     */
+    public static final int ERROR = -1;
+
+    private int m_status;
     private boolean m_hide;
     private String m_action;
     private String m_name;
@@ -51,173 +54,158 @@ public class FormInfo
     private Map<String, String> m_submission;
 
     /**
-     *  Creates a new FormInfo with status == OK.
-     *
+     * Creates a new FormInfo with status == OK.
      */
-    public FormInfo()
-    {
+    public FormInfo() {
         m_status = OK;
     }
 
     /**
-     *  Set the status of the Form processing.
-     *  
-     *  @param val EXECUTED, OK or ERROR.
+     * Set the status of the Form processing.
+     *
+     * @param val EXECUTED, OK or ERROR.
      */
-    public void setStatus( int val )
-    {
+    public void setStatus(int val) {
         m_status = val;
     }
 
     /**
-     *  Return the status.
-     *  
-     *  @return The status.
+     * Return the status.
+     *
+     * @return The status.
      */
-    public int getStatus()
-    {
+    public int getStatus() {
         return m_status;
     }
 
     /**
-     *  Set the hide parameter.
-     *  
-     *  @param val True or false.
+     * Set the hide parameter.
+     *
+     * @param val True or false.
      */
-    public void setHide( boolean val )
-    {
+    public void setHide(boolean val) {
         m_hide = val;
     }
 
     /**
-     *  Returns true, if the form is supposed to be hidden.
-     *  
-     *  @return True or false.
+     * Returns true, if the form is supposed to be hidden.
+     *
+     * @return True or false.
      */
-    public boolean hide()
-    {
+    public boolean hide() {
         return m_hide;
     }
 
     /**
-     *  Set the value of the action parameter.
-     *  
-     *  @param val A value parameter.
+     * Set the value of the action parameter.
+     *
+     * @param val A value parameter.
      */
-    public void setAction( String val )
-    {
+    public void setAction(String val) {
         m_action = val;
     }
 
     /**
-     *  Get the action set in {@link #setAction(String)}.
-     *  
-     *  @return An Action.
+     * Get the action set in {@link #setAction(String)}.
+     *
+     * @return An Action.
      */
-    public String getAction()
-    {
+    public String getAction() {
         return m_action;
     }
 
     /**
-     *  Sets the name of the form.
-     *  
-     *  @param val The name of the form.
+     * Sets the name of the form.
+     *
+     * @param val The name of the form.
      */
-    public void setName( String val )
-    {
+    public void setName(String val) {
         m_name = val;
     }
 
     /**
-     *  Return the name of the form.
-     *  
-     *  @return The name of the form.
+     * Return the name of the form.
+     *
+     * @return The name of the form.
      */
-    public String getName()
-    {
+    public String getName() {
         return m_name;
     }
 
     /**
-     *  Set the name of the handler class.
-     *  
-     *  @param val The name of the class.
+     * Set the name of the handler class.
+     *
+     * @param val The name of the class.
      */
-    public void setHandler( String val )
-    {
+    public void setHandler(String val) {
         m_handler = val;
     }
 
     /**
-     *  Return the name of the handler class.
-     *  
-     *  @return The name of the class.
+     * Return the name of the handler class.
+     *
+     * @return The name of the class.
      */
-    public String getHandler()
-    {
+    public String getHandler() {
         return m_handler;
     }
 
     /**
-     *  Set the result.
-     *  
-     *  @param val The result.
+     * Set the result.
+     *
+     * @param val The result.
      */
-    public void setResult( String val )
-    {
+    public void setResult(String val) {
         m_result = val;
     }
 
     /**
-     *  Return the result.
-     *  
-     *  @return The result.
+     * Return the result.
+     *
+     * @return The result.
      */
-    public String getResult()
-    {
+    public String getResult() {
         return m_result;
     }
 
     /**
-     *  Set an error string.
-     *  
-     *  @param val An error string.
+     * Set an error string.
+     *
+     * @param val An error string.
      */
-    public void setError( String val )
-    {
+    public void setError(String val) {
         m_error = val;
     }
 
     /**
-     *  Return the error.
-     *  
-     *  @return The error.
+     * Return the error.
+     *
+     * @return The error.
      */
-    public String getError()
-    {
+    public String getError() {
         return m_error;
     }
 
     /**
      * Copies the given values into the handler parameter map using Map.putAll().
+     *
      * @param val parameter name-value pairs for a Form handler WikiPlugin
      */
-    public void setSubmission( Map< String, String > val )
-    {
-        m_submission = new HashMap< String, String >();
-        m_submission.putAll( val );
+    public void setSubmission(Map<String, String> val) {
+        m_submission = new HashMap<String, String>();
+        m_submission.putAll(val);
     }
 
     /**
      * Adds the given values into the handler parameter map.
+     *
      * @param val parameter name-value pairs for a Form handler WikiPlugin
      */
-    public void addSubmission( Map< String, String > val )
-    {
-        if( m_submission == null )
-            m_submission = new HashMap< String, String >();
-        m_submission.putAll( val );
+    public void addSubmission(Map<String, String> val) {
+        if (m_submission == null) {
+            m_submission = new HashMap<String, String>();
+        }
+        m_submission.putAll(val);
     }
 
     /**
@@ -228,8 +216,7 @@ public class FormInfo
      *
      * @return Handler parameter name-value pairs.
      */
-    public Map< String, String > getSubmission()
-    {
+    public Map<String, String> getSubmission() {
         return m_submission;
     }
 }