Modified: 
jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/parser/PluginContent.java
URL: 
http://svn.apache.org/viewvc/jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/parser/PluginContent.java?rev=1554363&r1=1554362&r2=1554363&view=diff
==============================================================================
--- 
jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/parser/PluginContent.java
 (original)
+++ 
jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/parser/PluginContent.java
 Tue Dec 31 03:37:41 2013
@@ -42,20 +42,20 @@ import org.jdom2.Text;
 
 
 /**
- *  Stores the contents of a plugin in a WikiDocument DOM tree.
- *  <p>
- *  If the RenderingManager.WYSIWYG_EDITOR_MODE is set to Boolean.TRUE in the 
context, 
- *  then the plugin
- *  is rendered as WikiMarkup.  This allows an HTML editor to work without
- *  rendering the plugin each time as well. 
- *  <p>
- *  If RenderingManager.VAR_EXECUTE_PLUGINS is set to Boolean.FALSE, then
- *  the plugin is not executed.
- *  
- *  @since  2.4
+ * Stores the contents of a plugin in a WikiDocument DOM tree.
+ * <p/>
+ * If the RenderingManager.WYSIWYG_EDITOR_MODE is set to Boolean.TRUE in the 
context,
+ * then the plugin
+ * is rendered as WikiMarkup.  This allows an HTML editor to work without
+ * rendering the plugin each time as well.
+ * <p/>
+ * If RenderingManager.VAR_EXECUTE_PLUGINS is set to Boolean.FALSE, then
+ * the plugin is not executed.
+ *
+ * @since 2.4
  */
 public class PluginContent extends Text {
-       
+
     private static final String BLANK = "";
     private static final String CMDLINE = "_cmdline";
     private static final String ELEMENT_BR = "<br/>";
@@ -66,73 +66,74 @@ public class PluginContent extends Text 
     private static final String SPACE = " ";
 
     private static final long serialVersionUID = 1L;
-    
-    private static Logger log = Logger.getLogger( PluginContent.class );
 
-    private String                   m_pluginName;
-    private Map< String, String >    m_params;
-    
-    /**
-     *  Creates a new DOM element with the given plugin name and a map of 
parameters.
-     *  
-     *  @param pluginName The FQN of a plugin.
-     *  @param parameters A Map of parameters.
+    private static Logger log = Logger.getLogger(PluginContent.class);
+
+    private String m_pluginName;
+    private Map<String, String> m_params;
+
+    /**
+     * Creates a new DOM element with the given plugin name and a map of 
parameters.
+     *
+     * @param pluginName The FQN of a plugin.
+     * @param parameters A Map of parameters.
      */
-    public PluginContent( String pluginName, Map<String, String> parameters ) {
+    public PluginContent(String pluginName, Map<String, String> parameters) {
         m_pluginName = pluginName;
-        m_params     = parameters;
+        m_params = parameters;
     }
+
     /**
-     *  Returns the name of the plugin invoked by the DOM element.
-     *  
-     *  @return Name of the plugin
-     *  @since 2.5.7
+     * Returns the name of the plugin invoked by the DOM element.
+     *
+     * @return Name of the plugin
+     * @since 2.5.7
      */
     public String getPluginName() {
         return m_pluginName;
     }
-    
+
     /**
-     *  Returns a parameter value from the parameter map.
-     *  
-     *  @param name the name of the parameter.
-     *  @return The value from the map, or null, if no such parameter exists.
+     * Returns a parameter value from the parameter map.
+     *
+     * @param name the name of the parameter.
+     * @return The value from the map, or null, if no such parameter exists.
      */
-    public String getParameter( String name ) {
+    public String getParameter(String name) {
         return m_params.get(name);
     }
-    
+
     /**
-     *  Returns the parameter map given in the constructor.
-     *  
-     *  @return The parameter map.
+     * Returns the parameter map given in the constructor.
+     *
+     * @return The parameter map.
      */
-    public Map< String, String > getParameters() {
+    public Map<String, String> getParameters() {
         return m_params;
     }
-    
+
     /**
-     *  Returns the rendered plugin.  Only calls getText().
-     *  
-     *  @return HTML
+     * Returns the rendered plugin.  Only calls getText().
+     *
+     * @return HTML
      */
     public String getValue() {
         return getText();
     }
-    
+
     /**
-     *  The main invocation for the plugin.  When the getText() is called, it
-     *  invokes the plugin and returns its contents.  If there is no Document
-     *  yet, only returns the plugin name itself.
-     *  
-     *  @return The plugin rendered according to the options set in the 
WikiContext.
+     * The main invocation for the plugin.  When the getText() is called, it
+     * invokes the plugin and returns its contents.  If there is no Document
+     * yet, only returns the plugin name itself.
+     *
+     * @return The plugin rendered according to the options set in the 
WikiContext.
      */
     public String getText() {
         String result;
-        
-        WikiDocument doc = ( WikiDocument )getDocument();
 
-        if( doc == null ) {
+        WikiDocument doc = (WikiDocument) getDocument();
+
+        if (doc == null) {
             //
             // This element has not yet been attached anywhere, so we simply 
assume there is
             // no rendering and return the plugin name.  This is required e.g. 
when the 
@@ -140,15 +141,15 @@ public class PluginContent extends Text 
             // know whether the rendering would result in an empty string or 
not, but let us
             // assume it does not.
             //
-            
+
             return getPluginName();
         }
-               
+
         WikiContext context = doc.getContext();
-        
-        Boolean wysiwygVariable = ( Boolean )context.getVariable( 
RenderingManager.WYSIWYG_EDITOR_MODE );
+
+        Boolean wysiwygVariable = (Boolean) 
context.getVariable(RenderingManager.WYSIWYG_EDITOR_MODE);
         boolean wysiwygEditorMode = false;
-        if( wysiwygVariable != null ) {
+        if (wysiwygVariable != null) {
             wysiwygEditorMode = wysiwygVariable.booleanValue();
         }
 
@@ -159,116 +160,118 @@ public class PluginContent extends Text 
             //  since they can be edited visually.
             //
             // FIXME: The plugin name matching should not be done here, but in 
a per-editor resource
-            if( wysiwygEditorMode && !m_pluginName.matches( EMITTABLE_PLUGINS 
) ) {        
-                result = PLUGIN_START + m_pluginName + SPACE;            
-            
+            if (wysiwygEditorMode && !m_pluginName.matches(EMITTABLE_PLUGINS)) 
{
+                result = PLUGIN_START + m_pluginName + SPACE;
+
                 // convert newlines to <br> in case the plugin has a body.
-                String cmdLine = ( m_params.get( CMDLINE ) ).replaceAll( 
LINEBREAK, ELEMENT_BR );
-            
+                String cmdLine = (m_params.get(CMDLINE)).replaceAll(LINEBREAK, 
ELEMENT_BR);
+
                 result = result + cmdLine + PLUGIN_END;
             } else {
-                Boolean b = (Boolean)context.getVariable( 
RenderingManager.VAR_EXECUTE_PLUGINS );
-                if( b != null && !b.booleanValue() ) return BLANK;
+                Boolean b = (Boolean) 
context.getVariable(RenderingManager.VAR_EXECUTE_PLUGINS);
+                if (b != null && !b.booleanValue()) {
+                    return BLANK;
+                }
 
                 WikiEngine engine = context.getEngine();
-            
-                Map<String,String> parsedParams = new HashMap<String,String>();
-            
+
+                Map<String, String> parsedParams = new HashMap<String, 
String>();
+
                 //
                 //  Parse any variable instances from the string
                 //
-                for( Map.Entry<String, String> e : m_params.entrySet() ) {
+                for (Map.Entry<String, String> e : m_params.entrySet()) {
                     String val = e.getValue();
-                    val = engine.getVariableManager().expandVariables( 
context, val );
-                    parsedParams.put( e.getKey(), val );
+                    val = engine.getVariableManager().expandVariables(context, 
val);
+                    parsedParams.put(e.getKey(), val);
                 }
                 PluginManager pm = engine.getPluginManager();
-                result = pm.execute( context, m_pluginName, parsedParams );
+                result = pm.execute(context, m_pluginName, parsedParams);
             }
-        } catch( Exception e ) {
-            if( wysiwygEditorMode )  {
+        } catch (Exception e) {
+            if (wysiwygEditorMode) {
                 result = "";
             } else {
                 // log.info("Failed to execute plugin",e);
-                ResourceBundle rb = Preferences.getBundle( context, 
WikiPlugin.CORE_PLUGINS_RESOURCEBUNDLE);
-                result = JSPWikiMarkupParser.makeError( 
-                                 MessageFormat.format( rb.getString( 
"plugin.error.insertionfailed" ), e.getMessage() ) ).getText();
+                ResourceBundle rb = Preferences.getBundle(context, 
WikiPlugin.CORE_PLUGINS_RESOURCEBUNDLE);
+                result = JSPWikiMarkupParser.makeError(
+                        
MessageFormat.format(rb.getString("plugin.error.insertionfailed"), 
e.getMessage())).getText();
             }
         }
-        
-        
+
+
         return result;
     }
-    
+
     /**
-     *  Executes the executeParse() method.
-     *  
-     *  @param context The WikiContext
-     *  @throws PluginException If something goes wrong.
+     * Executes the executeParse() method.
+     *
+     * @param context The WikiContext
+     * @throws PluginException If something goes wrong.
      */
-    public void executeParse( WikiContext context ) throws PluginException {
+    public void executeParse(WikiContext context) throws PluginException {
         PluginManager pm = context.getEngine().getPluginManager();
-        if( pm.pluginsEnabled() ) {
-            ResourceBundle rb = Preferences.getBundle( context, 
WikiPlugin.CORE_PLUGINS_RESOURCEBUNDLE );
+        if (pm.pluginsEnabled()) {
+            ResourceBundle rb = Preferences.getBundle(context, 
WikiPlugin.CORE_PLUGINS_RESOURCEBUNDLE);
             Map<String, String> params = getParameters();
-            WikiPlugin plugin = pm.newWikiPlugin( getPluginName(), rb );
+            WikiPlugin plugin = pm.newWikiPlugin(getPluginName(), rb);
             try {
-                if( plugin != null && plugin instanceof ParserStagePlugin ) {
-                    ( ( ParserStagePlugin )plugin ).executeParser( this, 
context, params );
+                if (plugin != null && plugin instanceof ParserStagePlugin) {
+                    ((ParserStagePlugin) plugin).executeParser(this, context, 
params);
                 }
-            } catch( ClassCastException e ) {
-                throw new PluginException( MessageFormat.format( rb.getString( 
"plugin.error.notawikiplugin" ), getPluginName() ), e );
+            } catch (ClassCastException e) {
+                throw new 
PluginException(MessageFormat.format(rb.getString("plugin.error.notawikiplugin"),
 getPluginName()), e);
             }
         }
     }
-    
+
     /**
      * Parses a plugin invocation and returns a DOM element.
-     * 
-     * @param context The WikiContext
+     *
+     * @param context     The WikiContext
      * @param commandline The line to parse
-     * @param pos The position in the stream parsing.
+     * @param pos         The position in the stream parsing.
      * @return A DOM element
      * @throws PluginException If plugin invocation is faulty
      * @since 2.10.0
      */
-    public static PluginContent parsePluginLine( WikiContext context, String 
commandline, int pos ) throws PluginException {
-        PatternMatcher  matcher  = new Perl5Matcher();
+    public static PluginContent parsePluginLine(WikiContext context, String 
commandline, int pos) throws PluginException {
+        PatternMatcher matcher = new Perl5Matcher();
 
         try {
-               PluginManager pm = context.getEngine().getPluginManager();
-            if( matcher.contains( commandline, pm.getPluginPattern() ) ) {
-               
+            PluginManager pm = context.getEngine().getPluginManager();
+            if (matcher.contains(commandline, pm.getPluginPattern())) {
+
                 MatchResult res = matcher.getMatch();
 
-                String plugin   = res.group(2);
-                String args     = commandline.substring(res.endOffset(0),
-                                                        commandline.length() -
-                                                        
(commandline.charAt(commandline.length()-1) == '}' ? 1 : 0 ) );
-                Map<String, String> arglist = pm.parseArgs( args );
+                String plugin = res.group(2);
+                String args = commandline.substring(res.endOffset(0),
+                        commandline.length() -
+                                (commandline.charAt(commandline.length() - 1) 
== '}' ? 1 : 0));
+                Map<String, String> arglist = pm.parseArgs(args);
 
                 // set wikitext bounds of plugin as '_bounds' parameter, e.g., 
[345,396]
-                if ( pos != -1 ) {
+                if (pos != -1) {
                     int end = pos + commandline.length() + 2;
                     String bounds = pos + "|" + end;
-                    arglist.put( PluginManager.PARAM_BOUNDS, bounds );
+                    arglist.put(PluginManager.PARAM_BOUNDS, bounds);
                 }
 
-                PluginContent result = new PluginContent( plugin, arglist );
+                PluginContent result = new PluginContent(plugin, arglist);
 
                 return result;
             }
-        } catch( ClassCastException e ) {
-            log.error( "Invalid type offered in parsing plugin arguments.", e 
);
-            throw new InternalWikiException( "Oops, someone offered !String!" 
);
-        } catch( NoSuchElementException e ) {
-            String msg =  "Missing parameter in plugin definition: " + 
commandline;
-            log.warn( msg, e );
-            throw new PluginException( msg );
-        } catch( IOException e ) {
+        } catch (ClassCastException e) {
+            log.error("Invalid type offered in parsing plugin arguments.", e);
+            throw new InternalWikiException("Oops, someone offered !String!");
+        } catch (NoSuchElementException e) {
+            String msg = "Missing parameter in plugin definition: " + 
commandline;
+            log.warn(msg, e);
+            throw new PluginException(msg);
+        } catch (IOException e) {
             String msg = "Zyrf.  Problems with parsing arguments: " + 
commandline;
-            log.warn( msg, e );
-            throw new PluginException( msg );
+            log.warn(msg, e);
+            throw new PluginException(msg);
         }
 
         return null;

Modified: 
jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/plugin/WeblogEntryPlugin.java
URL: 
http://svn.apache.org/viewvc/jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/plugin/WeblogEntryPlugin.java?rev=1554363&r1=1554362&r2=1554363&view=diff
==============================================================================
--- 
jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/plugin/WeblogEntryPlugin.java
 (original)
+++ 
jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/plugin/WeblogEntryPlugin.java
 Tue Dec 31 03:37:41 2013
@@ -29,118 +29,112 @@ import org.apache.wiki.api.plugin.WikiPl
 import org.apache.wiki.preferences.Preferences;
 
 /**
- *  Builds a simple weblog.
+ * Builds a simple weblog.
+ * <p/>
+ * <p>Parameters : </p>
+ * <ul>
+ * <li><b>entrytext</b> - text of the link </li>
+ * <li><b>page</b> - if set, the entry is added to the named blog page. The 
default is the current page. </li>
+ * </ul>
  *
- *  <p>Parameters : </p>
- *  <ul>
- *  <li><b>entrytext</b> - text of the link </li>
- *  <li><b>page</b> - if set, the entry is added to the named blog page. The 
default is the current page. </li>
- *  </ul>
- *  
- *  @since 1.9.21
+ * @since 1.9.21
  */
-public class WeblogEntryPlugin implements WikiPlugin
-{
-    private static Logger     log = Logger.getLogger(WeblogEntryPlugin.class);
+public class WeblogEntryPlugin implements WikiPlugin {
+    private static Logger log = Logger.getLogger(WeblogEntryPlugin.class);
 
     private static final int MAX_BLOG_ENTRIES = 10000; // Just a precaution.
 
-    /** Parameter name for setting the entrytext  Value is <tt>{@value}</tt>. 
*/
+    /**
+     * Parameter name for setting the entrytext  Value is <tt>{@value}</tt>.
+     */
     public static final String PARAM_ENTRYTEXT = "entrytext";
-    /** 
+    /**
      * Optional parameter: page that actually contains the blog.
      * This lets us provide a "new entry" link for a blog page 
      * somewhere else than on the page itself.
      */
     // "page" for uniform naming with WeblogPlugin...
-    /** Parameter name for setting the page Value is <tt>{@value}</tt>. */
-    public static final String PARAM_BLOGNAME = "page"; 
+    /**
+     * Parameter name for setting the page Value is <tt>{@value}</tt>.
+     */
+    public static final String PARAM_BLOGNAME = "page";
 
     /**
-     *  Returns a new page name for entries.  It goes through the list of
-     *  all blog pages, and finds out the next in line.
-     *  
-     *  @param engine A WikiEngine
-     *  @param blogName The page (or blog) name.
-     *  @return A new name.
-     *  @throws ProviderException If something goes wrong.
+     * Returns a new page name for entries.  It goes through the list of
+     * all blog pages, and finds out the next in line.
+     *
+     * @param engine   A WikiEngine
+     * @param blogName The page (or blog) name.
+     * @return A new name.
+     * @throws ProviderException If something goes wrong.
      */
-    public String getNewEntryPage( WikiEngine engine, String blogName )
-        throws ProviderException
-    {
+    public String getNewEntryPage(WikiEngine engine, String blogName)
+            throws ProviderException {
         SimpleDateFormat fmt = new 
SimpleDateFormat(WeblogPlugin.DEFAULT_DATEFORMAT);
-        String today = fmt.format( new Date() );
-            
-        int entryNum = findFreeEntry( engine.getPageManager(),
-                                      blogName,
-                                      today );
-
-                        
-        String blogPage = WeblogPlugin.makeEntryPage( blogName,
-                                                      today,
-                                                      ""+entryNum );
+        String today = fmt.format(new Date());
+
+        int entryNum = findFreeEntry(engine.getPageManager(),
+                blogName,
+                today);
+
+
+        String blogPage = WeblogPlugin.makeEntryPage(blogName,
+                today,
+                "" + entryNum);
 
         return blogPage;
     }
 
     /**
-     *  {@inheritDoc}
+     * {@inheritDoc}
      */
-    public String execute( WikiContext context, Map<String, String> params )
-        throws PluginException
-    {
-        ResourceBundle rb = Preferences.getBundle( context, 
WikiPlugin.CORE_PLUGINS_RESOURCEBUNDLE );
-        
-        String weblogName = params.get( PARAM_BLOGNAME );
-        if( weblogName == null )
-        {
+    public String execute(WikiContext context, Map<String, String> params)
+            throws PluginException {
+        ResourceBundle rb = Preferences.getBundle(context, 
WikiPlugin.CORE_PLUGINS_RESOURCEBUNDLE);
+
+        String weblogName = params.get(PARAM_BLOGNAME);
+        if (weblogName == null) {
             weblogName = context.getPage().getName();
         }
         WikiEngine engine = context.getEngine();
-        
+
         StringBuffer sb = new StringBuffer();
 
         String entryText = params.get(PARAM_ENTRYTEXT);
-        if( entryText == null ) 
+        if (entryText == null) {
             entryText = rb.getString("weblogentryplugin.newentry");
-        
-        String url = context.getURL( WikiContext.NONE, "NewBlogEntry.jsp", 
"page="+engine.encodeName(weblogName) );
-            
-        sb.append("<a href=\""+url+"\">"+entryText+"</a>");
+        }
+
+        String url = context.getURL(WikiContext.NONE, "NewBlogEntry.jsp", 
"page=" + engine.encodeName(weblogName));
+
+        sb.append("<a href=\"" + url + "\">" + entryText + "</a>");
 
         return sb.toString();
     }
 
-    private int findFreeEntry( PageManager mgr,
-                               String baseName,
-                               String date )
-        throws ProviderException
-    {
+    private int findFreeEntry(PageManager mgr,
+                              String baseName,
+                              String date)
+            throws ProviderException {
         Collection everyone = mgr.getAllPages();
         int max = 0;
 
-        String startString = WeblogPlugin.makeEntryPage( baseName, date, "" );
-        
-        for( Iterator i = everyone.iterator(); i.hasNext(); )
-        {
-            WikiPage p = (WikiPage)i.next();
-
-            if( p.getName().startsWith(startString) )
-            {
-                try
-                {
-                    String probableId = p.getName().substring( 
startString.length() );
+        String startString = WeblogPlugin.makeEntryPage(baseName, date, "");
+
+        for (Iterator i = everyone.iterator(); i.hasNext(); ) {
+            WikiPage p = (WikiPage) i.next();
+
+            if (p.getName().startsWith(startString)) {
+                try {
+                    String probableId = 
p.getName().substring(startString.length());
 
                     int id = Integer.parseInt(probableId);
 
-                    if( id > max )
-                    {
+                    if (id > max) {
                         max = id;
                     }
-                }
-                catch( NumberFormatException e )
-                {
-                    log.debug("Was not a log entry: "+p.getName() );
+                } catch (NumberFormatException e) {
+                    log.debug("Was not a log entry: " + p.getName());
                 }
             }
         }
@@ -148,25 +142,23 @@ public class WeblogEntryPlugin implement
         //
         //  Find the first page that has no page lock.
         //
-        int idx = max+1;
+        int idx = max + 1;
 
-        while( idx < MAX_BLOG_ENTRIES )
-        {
-            WikiPage page = new WikiPage( mgr.getEngine(),
-                                          WeblogPlugin.makeEntryPage( 
baseName, 
-                                                                      date, 
-                                                                      
Integer.toString(idx) ) );
-            PageLock lock = mgr.getCurrentLock( page );
+        while (idx < MAX_BLOG_ENTRIES) {
+            WikiPage page = new WikiPage(mgr.getEngine(),
+                    WeblogPlugin.makeEntryPage(baseName,
+                            date,
+                            Integer.toString(idx)));
+            PageLock lock = mgr.getCurrentLock(page);
 
-            if( lock == null )
-            {
+            if (lock == null) {
                 break;
             }
 
             idx++;
         }
-        
+
         return idx;
     }
-    
+
 }

Modified: 
jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/rpc/json/JSONRPCManager.java
URL: 
http://svn.apache.org/viewvc/jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/rpc/json/JSONRPCManager.java?rev=1554363&r1=1554362&r2=1554363&view=diff
==============================================================================
--- 
jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/rpc/json/JSONRPCManager.java
 (original)
+++ 
jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/rpc/json/JSONRPCManager.java
 Tue Dec 31 03:37:41 2013
@@ -40,263 +40,244 @@ import com.metaparadigm.jsonrpc.Invocati
 import com.metaparadigm.jsonrpc.JSONRPCBridge;
 
 /**
- *  Provides an easy-to-use interface for different modules to AJAX-enable
- *  themselves.  This class is a static class, so it cannot be instantiated,
- *  but it easily available from anywhere (including JSP pages).
- *  <p>
- *  Any object which wants to expose its methods through JSON calls, needs
- *  to implement the RPCCallable interface.  JSONRPCManager will expose
- *  <i>all</i> methods, so be careful which you want to expose.
- *  <p>
- *  Due to some limitations of the JSON-RPC library, we do not use the
- *  Global bridge object. 
- *  @see org.apache.wiki.rpc.RPCCallable
- *  @since 2.5.4
+ * Provides an easy-to-use interface for different modules to AJAX-enable
+ * themselves.  This class is a static class, so it cannot be instantiated,
+ * but it easily available from anywhere (including JSP pages).
+ * <p/>
+ * Any object which wants to expose its methods through JSON calls, needs
+ * to implement the RPCCallable interface.  JSONRPCManager will expose
+ * <i>all</i> methods, so be careful which you want to expose.
+ * <p/>
+ * Due to some limitations of the JSON-RPC library, we do not use the
+ * Global bridge object.
+ *
+ * @see org.apache.wiki.rpc.RPCCallable
+ * @since 2.5.4
  */
 // FIXME: Must be mootool-ified.
-public final class JSONRPCManager extends RPCManager
-{
+public final class JSONRPCManager extends RPCManager {
     private static final String JSONRPCBRIDGE = "JSONRPCBridge";
     private static HashMap<String, CallbackContainer> c_globalObjects = new 
HashMap<String, CallbackContainer>();
-    
-    /** Prevent instantiation */
-    private JSONRPCManager()
-    {
+
+    /**
+     * Prevent instantiation
+     */
+    private JSONRPCManager() {
         super();
     }
-    
+
     /**
-     *  Emits JavaScript to do a JSON RPC Call.  You would use this method e.g.
-     *  in your plugin generation code to embed an AJAX call to your object.
-     *  
-     *  @param context The Wiki Context
-     *  @param c An RPCCallable object
-     *  @param function Name of the method to call
-     *  @param params Parameters to pass to the method
-     *  @return generated JavasSript code snippet that calls the method
+     * Emits JavaScript to do a JSON RPC Call.  You would use this method e.g.
+     * in your plugin generation code to embed an AJAX call to your object.
+     *
+     * @param context  The Wiki Context
+     * @param c        An RPCCallable object
+     * @param function Name of the method to call
+     * @param params   Parameters to pass to the method
+     * @return generated JavasSript code snippet that calls the method
      */
-    public static String emitJSONCall( WikiContext context, RPCCallable c, 
String function, String params )
-    {
+    public static String emitJSONCall(WikiContext context, RPCCallable c, 
String function, String params) {
         StringBuffer sb = new StringBuffer();
         sb.append("<script>");
-        sb.append("var result = 
jsonrpc."+getId(c)+"."+function+"("+params+");\r\n");
+        sb.append("var result = jsonrpc." + getId(c) + "." + function + "(" + 
params + ");\r\n");
         sb.append("document.write(result);\r\n");
         sb.append("</script>");
-        
-        return sb.toString();        
+
+        return sb.toString();
     }
-    
+
     /**
-     *  Finds this user's personal RPC Bridge.  If it does not exist, will
-     *  create one and put it in the context.  If there is no HTTP Request 
included,
-     *  returns the global bridge.
-     *  
-     *  @param context WikiContext to find the bridge in
-     *  @return A JSON RPC Bridge
+     * Finds this user's personal RPC Bridge.  If it does not exist, will
+     * create one and put it in the context.  If there is no HTTP Request 
included,
+     * returns the global bridge.
+     *
+     * @param context WikiContext to find the bridge in
+     * @return A JSON RPC Bridge
      */
     // FIXME: Is returning the global bridge a potential security threat?
-    private static JSONRPCBridge getBridge( WikiContext context )
-    {
+    private static JSONRPCBridge getBridge(WikiContext context) {
         JSONRPCBridge bridge = null;
         HttpServletRequest req = context.getHttpRequest();
-        
-        if( req != null )
-        {
+
+        if (req != null) {
             HttpSession hs = req.getSession();
-            
-            if( hs != null )
-            {
-                bridge = (JSONRPCBridge)hs.getAttribute(JSONRPCBRIDGE);
-                
-                if( bridge == null )
-                {
+
+            if (hs != null) {
+                bridge = (JSONRPCBridge) hs.getAttribute(JSONRPCBRIDGE);
+
+                if (bridge == null) {
                     bridge = new JSONRPCBridge();
-                
+
                     hs.setAttribute(JSONRPCBRIDGE, bridge);
                 }
             }
         }
-        
-        if( bridge == null) bridge = JSONRPCBridge.getGlobalBridge();
+
+        if (bridge == null) {
+            bridge = JSONRPCBridge.getGlobalBridge();
+        }
         bridge.setDebug(false);
-        
+
         return bridge;
     }
-    
+
     /**
-     *  Registers a callable to JSON global bridge and requests JSON libraries 
to be added
-     *  to the page.  
-     *  
-     *  @param context The WikiContext.
-     *  @param c The RPCCallable to register
-     *  @return the ID of the registered callable object
+     * Registers a callable to JSON global bridge and requests JSON libraries 
to be added
+     * to the page.
+     *
+     * @param context The WikiContext.
+     * @param c       The RPCCallable to register
+     * @return the ID of the registered callable object
      */
-    public static String registerJSONObject( WikiContext context, RPCCallable 
c )
-    {
+    public static String registerJSONObject(WikiContext context, RPCCallable 
c) {
         String id = getId(c);
-        getBridge(context).registerObject( id, c );
+        getBridge(context).registerObject(id, c);
 
-        requestJSON( context );
+        requestJSON(context);
         return id;
     }
-    
+
     /**
-     *  Requests the JSON Javascript and object to be generated in the HTML.
-     *  @param context The WikiContext.
+     * Requests the JSON Javascript and object to be generated in the HTML.
+     *
+     * @param context The WikiContext.
      */
-    public static void requestJSON( WikiContext context )
-    {
-        TemplateManager.addResourceRequest(context, 
-                                           TemplateManager.RESOURCE_SCRIPT, 
-                                           
context.getURL(WikiContext.NONE,"scripts/json-rpc/jsonrpc.js"));        
-        
-        String jsonurl = context.getURL( WikiContext.NONE, "JSON-RPC" );
-        TemplateManager.addResourceRequest(context, 
-                                           
TemplateManager.RESOURCE_JSFUNCTION, 
-                                           "jsonrpc = new 
JSONRpcClient(\""+jsonurl+"\");");
-        
+    public static void requestJSON(WikiContext context) {
+        TemplateManager.addResourceRequest(context,
+                TemplateManager.RESOURCE_SCRIPT,
+                context.getURL(WikiContext.NONE, 
"scripts/json-rpc/jsonrpc.js"));
+
+        String jsonurl = context.getURL(WikiContext.NONE, "JSON-RPC");
+        TemplateManager.addResourceRequest(context,
+                TemplateManager.RESOURCE_JSFUNCTION,
+                "jsonrpc = new JSONRpcClient(\"" + jsonurl + "\");");
+
         getBridge(context).registerCallback(new WikiJSONAccessor(), 
HttpServletRequest.class);
     }
-    
+
     /**
-     *  Provides access control to the JSON calls.  Rather private.
-     *  Unfortunately we have to check the permission every single time, 
because
-     *  the user can log in and we would need to reset the permissions at that 
time.
-     *  Note that this is an obvious optimization piece if this becomes
-     *  a bottleneck.
-     *  
+     * Provides access control to the JSON calls.  Rather private.
+     * Unfortunately we have to check the permission every single time, because
+     * the user can log in and we would need to reset the permissions at that 
time.
+     * Note that this is an obvious optimization piece if this becomes
+     * a bottleneck.
      */
-    static class WikiJSONAccessor implements InvocationCallback
-    {
+    static class WikiJSONAccessor implements InvocationCallback {
         private static final long serialVersionUID = 1L;
-        private static final Logger log = Logger.getLogger( 
WikiJSONAccessor.class );
-        
+        private static final Logger log = 
Logger.getLogger(WikiJSONAccessor.class);
+
         /**
-         *  Create an accessor.
+         * Create an accessor.
          */
-        public WikiJSONAccessor()
-        {}
-        
+        public WikiJSONAccessor() {
+        }
+
         /**
-         *  Does not do anything.
-         * 
-         *  {@inheritDoc}
+         * Does not do anything.
+         * <p/>
+         * {@inheritDoc}
          */
-        public void postInvoke(Object context, Object instance, Method method, 
Object result) throws Exception
-        {
+        public void postInvoke(Object context, Object instance, Method method, 
Object result) throws Exception {
         }
 
         /**
-         *  Checks access against the permission given.
-         *  
-         *  {@inheritDoc}
+         * Checks access against the permission given.
+         * <p/>
+         * {@inheritDoc}
          */
-        public void preInvoke(Object context, Object instance, Method method, 
Object[] arguments) throws Exception
-        {
-            if( context instanceof HttpServletRequest )
-            {
+        public void preInvoke(Object context, Object instance, Method method, 
Object[] arguments) throws Exception {
+            if (context instanceof HttpServletRequest) {
                 boolean canDo = false;
                 HttpServletRequest req = (HttpServletRequest) context;
-                
-                WikiEngine e = WikiEngine.getInstance( 
req.getSession().getServletContext(), null );
-               
-                for( Iterator i = c_globalObjects.values().iterator(); 
i.hasNext(); )
-                {
+
+                WikiEngine e = 
WikiEngine.getInstance(req.getSession().getServletContext(), null);
+
+                for (Iterator i = c_globalObjects.values().iterator(); 
i.hasNext(); ) {
                     CallbackContainer cc = (CallbackContainer) i.next();
-                    
-                    if( cc.m_object == instance )
-                    {
-                        canDo = e.getAuthorizationManager().checkPermission( 
WikiSession.getWikiSession(e, req), 
-                                                                             
cc.m_permission );
+
+                    if (cc.m_object == instance) {
+                        canDo = 
e.getAuthorizationManager().checkPermission(WikiSession.getWikiSession(e, req),
+                                cc.m_permission);
 
                         break;
                     }
                 }
-                                    
-                if( canDo )
-                {
+
+                if (canDo) {
                     return;
                 }
             }
 
-            log.debug("Failed JSON permission check: "+instance);
+            log.debug("Failed JSON permission check: " + instance);
             throw new WikiSecurityException("No permission to access this AJAX 
method!");
         }
-        
+
     }
 
     /**
-     *  Registers a global object (i.e. something which can be called by any
-     *  JSP page).  Typical examples is e.g. "search".  By default, the 
RPCCallable
-     *  shall need a "view" permission to access.
-     *  
-     *  @param id     The name under which this shall be registered (e.g. 
"search")
-     *  @param object The RPCCallable which shall be associated to this id.
+     * Registers a global object (i.e. something which can be called by any
+     * JSP page).  Typical examples is e.g. "search".  By default, the 
RPCCallable
+     * shall need a "view" permission to access.
+     *
+     * @param id     The name under which this shall be registered (e.g. 
"search")
+     * @param object The RPCCallable which shall be associated to this id.
      */
-    public static void registerGlobalObject(String id, RPCCallable object)
-    {
-        registerGlobalObject(id, object, PagePermission.VIEW);    
+    public static void registerGlobalObject(String id, RPCCallable object) {
+        registerGlobalObject(id, object, PagePermission.VIEW);
     }
-    
+
     /**
-     *  Registers a global object (i.e. something which can be called by any
-     *  JSP page) with a specific permission.  
-     *  
-     *  @param id     The name under which this shall be registered (e.g. 
"search")
-     *  @param object The RPCCallable which shall be associated to this id.
-     *  @param perm   The permission which is required to access this object.
+     * Registers a global object (i.e. something which can be called by any
+     * JSP page) with a specific permission.
+     *
+     * @param id     The name under which this shall be registered (e.g. 
"search")
+     * @param object The RPCCallable which shall be associated to this id.
+     * @param perm   The permission which is required to access this object.
      */
-    public static void registerGlobalObject(String id, RPCCallable object, 
Permission perm )
-    {
+    public static void registerGlobalObject(String id, RPCCallable object, 
Permission perm) {
         CallbackContainer cc = new CallbackContainer();
         cc.m_permission = perm;
         cc.m_id = id;
         cc.m_object = object;
-        
-        c_globalObjects.put( id, cc );
+
+        c_globalObjects.put(id, cc);
     }
 
     /**
-     *  Is called whenever a session is created.  This method creates a new 
JSONRPCBridge
-     *  and adds it to the user session.  This is done because the global 
JSONRPCBridge
-     *  InvocationCallbacks are not called; only session locals.  This may be 
a bug
-     *  in JSON-RPC, or it may be a design feature...
-     *  <p>
-     *  The JSONRPCBridge object will go away once the session expires.
-     *  
-     *  @param session The HttpSession which was created.
+     * Is called whenever a session is created.  This method creates a new 
JSONRPCBridge
+     * and adds it to the user session.  This is done because the global 
JSONRPCBridge
+     * InvocationCallbacks are not called; only session locals.  This may be a 
bug
+     * in JSON-RPC, or it may be a design feature...
+     * <p/>
+     * The JSONRPCBridge object will go away once the session expires.
+     *
+     * @param session The HttpSession which was created.
      */
-    public static void sessionCreated( HttpSession session )
-    {
-        JSONRPCBridge bridge = 
(JSONRPCBridge)session.getAttribute(JSONRPCBRIDGE);
-        
-        if( bridge == null )
-        {
+    public static void sessionCreated(HttpSession session) {
+        JSONRPCBridge bridge = (JSONRPCBridge) 
session.getAttribute(JSONRPCBRIDGE);
+
+        if (bridge == null) {
             bridge = new JSONRPCBridge();
-        
-            session.setAttribute( JSONRPCBRIDGE, bridge );
+
+            session.setAttribute(JSONRPCBRIDGE, bridge);
         }
 
         WikiJSONAccessor acc = new WikiJSONAccessor();
-        
-        bridge.registerCallback( acc, HttpServletRequest.class );
-        
-        for( Iterator i = c_globalObjects.values().iterator(); i.hasNext(); )
-        {
+
+        bridge.registerCallback(acc, HttpServletRequest.class);
+
+        for (Iterator i = c_globalObjects.values().iterator(); i.hasNext(); ) {
             CallbackContainer cc = (CallbackContainer) i.next();
-       
-            bridge.registerObject( cc.m_id, cc.m_object );
+
+            bridge.registerObject(cc.m_id, cc.m_object);
         }
 
     }
-     
+
     /**
-     *  Just stores the registered global method.
-     *  
-     *
+     * Just stores the registered global method.
      */
-    private static class CallbackContainer
-    {
+    private static class CallbackContainer {
         String m_id;
         RPCCallable m_object;
         Permission m_permission;

Modified: jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/rss/Feed.java
URL: 
http://svn.apache.org/viewvc/jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/rss/Feed.java?rev=1554363&r1=1554362&r2=1554363&view=diff
==============================================================================
--- jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/rss/Feed.java 
(original)
+++ jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/rss/Feed.java Tue 
Dec 31 03:37:41 2013
@@ -29,11 +29,9 @@ import org.apache.wiki.api.exceptions.No
 import org.apache.wiki.util.TextUtil;
 
 /**
- *  Represents an abstract feed.
- *
+ * Represents an abstract feed.
  */
-public abstract class Feed
-{
+public abstract class Feed {
     protected List<Entry> m_entries = new ArrayList<Entry>();
 
     protected String m_feedURL;
@@ -44,167 +42,161 @@ public abstract class Feed
     protected WikiContext m_wikiContext;
 
     protected String m_mode = RSSGenerator.MODE_WIKI;
-    
-    /** Wiki variable storing the blog's name. */
+
+    /**
+     * Wiki variable storing the blog's name.
+     */
     public static final String VAR_BLOGNAME = "blogname";
 
     /**
      * Figure out a site name for a feed.
+     *
      * @param context the wiki context
      * @return the site name
      */
-    public static String getSiteName( WikiContext context )
-    {
+    public static String getSiteName(WikiContext context) {
         WikiEngine engine = context.getEngine();
 
         String blogname = null;
 
-        try
-        {
-            blogname = engine.getVariableManager().getValue( context, 
VAR_BLOGNAME );
+        try {
+            blogname = engine.getVariableManager().getValue(context, 
VAR_BLOGNAME);
+        } catch (NoSuchVariableException e) {
         }
-        catch( NoSuchVariableException e ) {}
 
-        if( blogname == null )
-        {
-            blogname = engine.getApplicationName()+": 
"+context.getPage().getName();
+        if (blogname == null) {
+            blogname = engine.getApplicationName() + ": " + 
context.getPage().getName();
         }
 
         return blogname;
     }
 
     /**
-     *  Create a new Feed for a particular WikiContext.
-     *  
-     *  @param context The WikiContext.
+     * Create a new Feed for a particular WikiContext.
+     *
+     * @param context The WikiContext.
      */
-    public Feed( WikiContext context )
-    {
+    public Feed(WikiContext context) {
         m_wikiContext = context;
     }
 
     /**
-     *  Set the mode of the Feed.  It can be any of the following:
-     *  <ul>
-     *  <li>{@link RSSGenerator#MODE_WIKI} - to create a wiki diff list per 
page.</li>
-     *  <li>{@link RSSGenerator#MODE_BLOG} - to assume that the Entries are 
blog entries.</li>
-     *  <li>{@link RSSGenerator#MODE_FULL} - to create a wiki diff list for 
the entire blog.</li>
-     *  </ul>
-     *  As the Entry list itself is generated elsewhere, this mostly just 
affects the way
-     *  that the layout and metadata for each entry is generated.
-     * 
-     *  @param mode As defined in RSSGenerator.
+     * Set the mode of the Feed.  It can be any of the following:
+     * <ul>
+     * <li>{@link RSSGenerator#MODE_WIKI} - to create a wiki diff list per 
page.</li>
+     * <li>{@link RSSGenerator#MODE_BLOG} - to assume that the Entries are 
blog entries.</li>
+     * <li>{@link RSSGenerator#MODE_FULL} - to create a wiki diff list for the 
entire blog.</li>
+     * </ul>
+     * As the Entry list itself is generated elsewhere, this mostly just 
affects the way
+     * that the layout and metadata for each entry is generated.
+     *
+     * @param mode As defined in RSSGenerator.
      */
-    public void setMode( String mode )
-    {
+    public void setMode(String mode) {
         m_mode = mode;
     }
 
     /**
-     *  Adds a new Entry to the Feed, at the end of the list.
-     *  
-     *  @param e The Entry to add.
+     * Adds a new Entry to the Feed, at the end of the list.
+     *
+     * @param e The Entry to add.
      */
-    public void addEntry( Entry e )
-    {
-        m_entries.add( e );
+    public void addEntry(Entry e) {
+        m_entries.add(e);
     }
 
     /**
-     *  Returns the XML for the feed contents in a String format.  All 
subclasses must implement.
-     *  
-     *  @return valid XML, ready to be shoved out.
+     * Returns the XML for the feed contents in a String format.  All 
subclasses must implement.
+     *
+     * @return valid XML, ready to be shoved out.
      */
     public abstract String getString();
-    
+
     /**
      * @return Returns the m_channelDescription.
      */
-    public String getChannelDescription()
-    {
+    public String getChannelDescription() {
         return m_channelDescription;
     }
+
     /**
      * @param description The m_channelDescription to set.
      */
-    public void setChannelDescription( String description )
-    {
+    public void setChannelDescription(String description) {
         m_channelDescription = description;
     }
+
     /**
      * @return Returns the m_channelLanguage.
      */
-    public String getChannelLanguage()
-    {
+    public String getChannelLanguage() {
         return m_channelLanguage;
     }
+
     /**
      * @param language The m_channelLanguage to set.
      */
-    public void setChannelLanguage( String language )
-    {
+    public void setChannelLanguage(String language) {
         m_channelLanguage = language;
     }
+
     /**
      * @return Returns the m_channelTitle.
      */
-    public String getChannelTitle()
-    {
+    public String getChannelTitle() {
         return m_channelTitle;
     }
+
     /**
      * @param title The m_channelTitle to set.
      */
-    public void setChannelTitle( String title )
-    {
+    public void setChannelTitle(String title) {
         m_channelTitle = title;
     }
 
     /**
      * @return Returns the m_feedURL.
      */
-    public String getFeedURL()
-    {
+    public String getFeedURL() {
         return m_feedURL;
     }
+
     /**
      * @param feedurl The m_feedURL to set.
      */
-    public void setFeedURL( String feedurl )
-    {
+    public void setFeedURL(String feedurl) {
         m_feedURL = feedurl;
     }
 
     /**
-     *  A helper method for figuring out the MIME type for an enclosure.
-     *  
-     *  @param c A ServletContext
-     *  @param name The filename
-     *  @return Something sane for a MIME type.
+     * A helper method for figuring out the MIME type for an enclosure.
+     *
+     * @param c    A ServletContext
+     * @param name The filename
+     * @return Something sane for a MIME type.
      */
-    protected String getMimeType(ServletContext c, String name)
-    {
+    protected String getMimeType(ServletContext c, String name) {
         String type = c.getMimeType(name);
 
-        if( type == null ) type = "application/octet-stream";
+        if (type == null) {
+            type = "application/octet-stream";
+        }
 
         return type;
     }
 
     /**
-     *  Does the required formatting and entity replacement for XML.
-     *  
-     *  @param s The String to format. Null is safe.
-     *  @return A formatted string.
+     * Does the required formatting and entity replacement for XML.
+     *
+     * @param s The String to format. Null is safe.
+     * @return A formatted string.
      */
     // FIXME: Should probably be replaced by a library method.
-    public static String format( String s )
-    {
-        if( s != null )
-        {
-            s = TextUtil.replaceString( s, "&", "&amp;" );
-            s = TextUtil.replaceString( s, "<", "&lt;" );
-            s = TextUtil.replaceString( s, ">", "&gt;" );
+    public static String format(String s) {
+        if (s != null) {
+            s = TextUtil.replaceString(s, "&", "&amp;");
+            s = TextUtil.replaceString(s, "<", "&lt;");
+            s = TextUtil.replaceString(s, ">", "&gt;");
 
             return s.trim();
         }

Modified: 
jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/rss/RSS10Feed.java
URL: 
http://svn.apache.org/viewvc/jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/rss/RSS10Feed.java?rev=1554363&r1=1554362&r2=1554363&view=diff
==============================================================================
--- jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/rss/RSS10Feed.java 
(original)
+++ jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/rss/RSS10Feed.java 
Tue Dec 31 03:37:41 2013
@@ -29,103 +29,97 @@ import org.apache.wiki.WikiEngine;
 import org.apache.wiki.WikiPage;
 
 /**
- *  Provides an implementation of an RSS 1.0 feed.  In addition, this class is
- *  capable of adding RSS 1.0 Wiki Extensions to the Feed, as defined in
- *  <A HREF="http://usemod.com/cgi-bin/mb.pl?ModWiki";>UseMod:ModWiki</A>.
+ * Provides an implementation of an RSS 1.0 feed.  In addition, this class is
+ * capable of adding RSS 1.0 Wiki Extensions to the Feed, as defined in
+ * <A HREF="http://usemod.com/cgi-bin/mb.pl?ModWiki";>UseMod:ModWiki</A>.
  */
-public class RSS10Feed extends Feed
-{
+public class RSS10Feed extends Feed {
     /**
-     *  Create an RSS 1.0 feed for a given context.
-     *  
-     *  @param context {@inheritDoc}
+     * Create an RSS 1.0 feed for a given context.
+     *
+     * @param context {@inheritDoc}
      */
-    public RSS10Feed( WikiContext context )
-    {
+    public RSS10Feed(WikiContext context) {
         super(context);
     }
-    
-    private XML getRDFItems()
-    {
-        XML items = new XML( "items" );
-        
-        XML rdfseq = new XML( "rdf:Seq" );
-        
-        for( Iterator i = m_entries.iterator(); i.hasNext(); )
-        {
-            Entry e = (Entry)i.next();
+
+    private XML getRDFItems() {
+        XML items = new XML("items");
+
+        XML rdfseq = new XML("rdf:Seq");
+
+        for (Iterator i = m_entries.iterator(); i.hasNext(); ) {
+            Entry e = (Entry) i.next();
 
             String url = e.getURL();
 
-            rdfseq.addElement( new XML("rdf:li").addAttribute( "rdf:resource", 
url ) );
+            rdfseq.addElement(new XML("rdf:li").addAttribute("rdf:resource", 
url));
         }
-        
-        items.addElement( rdfseq );
-        
+
+        items.addElement(rdfseq);
+
         return items;
     }
-    
-    private void addItemList( XML root )
-    {
+
+    private void addItemList(XML root) {
         SimpleDateFormat iso8601fmt = new 
SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
-        
+
         WikiEngine engine = m_wikiContext.getEngine();
-        
-        for( Iterator i = m_entries.iterator(); i.hasNext(); )
-        {
-            Entry e = (Entry)i.next();
-            
+
+        for (Iterator i = m_entries.iterator(); i.hasNext(); ) {
+            Entry e = (Entry) i.next();
+
             String url = e.getURL();
-            
-            XML item = new XML( "item" );
-            item.addAttribute( "rdf:about", url );
-            
-            item.addElement( new XML("title").addElement( format(e.getTitle()) 
) );
 
-            item.addElement( new XML("link").addElement( url ) );
+            XML item = new XML("item");
+            item.addAttribute("rdf:about", url);
+
+            item.addElement(new XML("title").addElement(format(e.getTitle())));
+
+            item.addElement(new XML("link").addElement(url));
 
             XML content = new XML("description");
-            
+
             // TODO: Add a size limiter here
-            content.addElement( format(e.getContent()) );
+            content.addElement(format(e.getContent()));
 
-            item.addElement( content );
+            item.addElement(content);
 
             WikiPage p = e.getPage();
-            
-            if( p.getVersion() != -1 )
-            {
-                item.addElement( new XML("wiki:version").addElement( 
Integer.toString(p.getVersion()) ) );
+
+            if (p.getVersion() != -1) {
+                item.addElement(new 
XML("wiki:version").addElement(Integer.toString(p.getVersion())));
             }
 
-            if( p.getVersion() > 1 )
-            {
-                item.addElement( new XML("wiki:diff").addElement( 
engine.getURL( WikiContext.DIFF,
-                                                                               
  p.getName(),
-                                                                               
  "r1=-1",
-                                                                               
  true) ) );
+            if (p.getVersion() > 1) {
+                item.addElement(new 
XML("wiki:diff").addElement(engine.getURL(WikiContext.DIFF,
+                        p.getName(),
+                        "r1=-1",
+                        true)));
             }
 
-           
+
             //
             //  Modification date.
             //
             Calendar cal = Calendar.getInstance();
-            cal.setTime( p.getLastModified() );
-            cal.add( Calendar.MILLISECOND, 
-                     - (cal.get( Calendar.ZONE_OFFSET ) + 
-                        (cal.getTimeZone().inDaylightTime( p.getLastModified() 
) ? cal.get( Calendar.DST_OFFSET ) : 0 )) );
+            cal.setTime(p.getLastModified());
+            cal.add(Calendar.MILLISECOND,
+                    -(cal.get(Calendar.ZONE_OFFSET) +
+                            
(cal.getTimeZone().inDaylightTime(p.getLastModified()) ? 
cal.get(Calendar.DST_OFFSET) : 0)));
+
+            item.addElement(new 
XML("dc:date").addElement(iso8601fmt.format(cal.getTime())));
 
-            item.addElement( new XML("dc:date").addElement( iso8601fmt.format( 
cal.getTime() )));
-           
             //
             //  Author
             String author = e.getAuthor();
-            if( author == null ) author = "unknown";
+            if (author == null) {
+                author = "unknown";
+            }
 
             XML contributor = new XML("dc:creator");
-            
-            item.addElement( contributor );
+
+            item.addElement(contributor);
 
             /*
             XML description = new XML("rdf:Description");
@@ -140,70 +134,71 @@ public class RSS10Feed extends Feed
             description.addElement( new XML("value").addElement( 
format(author) ) );
             contributor.addElement( description );
            */
-            
+
             // Not too many aggregators seem to like this.  Therefore we're
             // just adding the name here.
-            
-            contributor.addElement( format(author) );
-            
+
+            contributor.addElement(format(author));
+
             //  PageHistory
 
-            item.addElement( new XML("wiki:history").addElement( 
engine.getURL( WikiContext.INFO,
-                                                                               
 p.getName(),
-                                                                               
 null,
-                                                                               
 true ) ) );
-            
+            item.addElement(new 
XML("wiki:history").addElement(engine.getURL(WikiContext.INFO,
+                    p.getName(),
+                    null,
+                    true)));
+
             //
             //  Add to root
             //
-            
-            root.addElement( item );
+
+            root.addElement(item);
         }
     }
-    
-    private XML getChannelElement()
-    {
-        XML channel = new XML( "channel" );
-
-        channel.addAttribute("rdf:about", m_feedURL );
-        
-        channel.addElement( new XML("link").addElement( m_feedURL ) );
-        
-        if( m_channelTitle != null )
-            channel.addElement( new XML("title").addElement( 
format(m_channelTitle)) );
-        
-        if( m_channelDescription != null )
-            channel.addElement( new XML("description").addElement( 
format(m_channelDescription)) );
-        
-        if( m_channelLanguage != null )
-            channel.addElement( new 
XML("dc:language").addElement(m_channelLanguage) );
-
-        channel.setPrettyPrint( true );
-        
-        channel.addElement( getRDFItems() );
-        
+
+    private XML getChannelElement() {
+        XML channel = new XML("channel");
+
+        channel.addAttribute("rdf:about", m_feedURL);
+
+        channel.addElement(new XML("link").addElement(m_feedURL));
+
+        if (m_channelTitle != null) {
+            channel.addElement(new 
XML("title").addElement(format(m_channelTitle)));
+        }
+
+        if (m_channelDescription != null) {
+            channel.addElement(new 
XML("description").addElement(format(m_channelDescription)));
+        }
+
+        if (m_channelLanguage != null) {
+            channel.addElement(new 
XML("dc:language").addElement(m_channelLanguage));
+        }
+
+        channel.setPrettyPrint(true);
+
+        channel.addElement(getRDFItems());
+
         return channel;
     }
-    
+
     /**
-     *  {@inheritDoc}
+     * {@inheritDoc}
      */
     @Override
-    public String getString()
-    {
+    public String getString() {
         XML root = new XML("rdf:RDF");
-        
-        root.addAttribute( "xmlns:rdf", 
"http://www.w3.org/1999/02/22-rdf-syntax-ns#"; );
-        root.addAttribute( "xmlns", "http://purl.org/rss/1.0/"; );
-        root.addAttribute( "xmlns:dc", "http://purl.org/dc/elements/1.1/"; );
-        root.addAttribute( "xmlns:wiki", 
"http://purl.org/rss/1.0/modules/wiki/"; );
-        
-        root.addElement( getChannelElement() );
-        
-        addItemList( root );
-        
-        root.setPrettyPrint( true );
-                
+
+        root.addAttribute("xmlns:rdf", 
"http://www.w3.org/1999/02/22-rdf-syntax-ns#";);
+        root.addAttribute("xmlns", "http://purl.org/rss/1.0/";);
+        root.addAttribute("xmlns:dc", "http://purl.org/dc/elements/1.1/";);
+        root.addAttribute("xmlns:wiki", 
"http://purl.org/rss/1.0/modules/wiki/";);
+
+        root.addElement(getChannelElement());
+
+        addItemList(root);
+
+        root.setPrettyPrint(true);
+
         return root.toString();
     }
 


Reply via email to