package com.ecyrd.jspwiki.plugin;

import com.ecyrd.jspwiki.*;
import java.util.*;

/**
 *  Implements a simple plugin that just returns its text.
 *  <P>
 *  Parameters: text - text to return.
 *  Any _body content gets appended between brackets.
 *
 *  @author Janne Jalkanen
 */
public class SamplePlugin
    implements WikiPlugin
{
    public void initialize( WikiEngine engine )
        throws PluginException
    {
    }

    public String execute( WikiContext context, Map params )
        throws PluginException
    {
        StringBuffer sb = new StringBuffer();

        sb.append( (String)params.get("text") );

        String body = (String)params.get("_body");
        if( body != null )
        {
            sb.append( " ("+body.replace('\n','+')+")" );
        }

        return sb.toString();
    }

}

@@ -574,26 +574,29 @@
         
-sb.append(
+String text =
  (String
@@ -588,32 +588,33 @@
  text = (String)
+ 
 params.get(%22text
@@ -615,19 +615,96 @@
 (%22text%22)
- );
+;%0A%0A        if( text != null )%0A        %7B%0A            sb.append( text );%0A        %7D
 %0A%0A      

Now handles missing text gracefully.