Every JSPWiki plugin is free to throw a WikiException in case of internal problems. The sole purpose of the "throwException" plugin is to do just that - illustrating how such an exception will look like within a wiki page.

!!Compilation

Save the source code shown at the bottom of this page into a file called {{throwException.java}}. Then invoke the Java compiler as follows
{{{
  javac throwException.java
}}}
(or similar - depending on the development environment you are using)

!!Installation

Create a JAR archive containing the Java class file for the plugin. You may use the command
{{{
  jar cvf throwException.jar throwException.class
}}}
for that purpose.

Then move that file into any directory within your wiki's class path - preferrably into the {{WEB-INF/lib/}} folder within your web server's ''web application directory'' for the JSPWiki.

Finally restart the Wiki for the plugin to be recognized.

!!Usage

Within wiki markup, invoke the plugin as follows
{{{
  [{throwException}]
}}}
without any parameters (they would be ignored anyway). As the class resides in the default directory, there is no need neither to prefix the plugin name with a package path nor to modify the plugin search path within the JSPWiki configuration file. 

In the final wiki output, you will notice an error message similar to

Plugin insertion failed: throwException: do you notice the exception?

at the place where the plugin was invoked in the original markup

!!Source Code

{{{
import java.util.*;                  // Java utility classes and data structures

import com.ecyrd.jspwiki.*;
import com.ecyrd.jspwiki.plugin.*;

public class throwException implements WikiPlugin {
  public String execute (WikiContext Context, Map ParameterMap) throws PluginException {
    throw new PluginException("throwException: do you notice the exception?");
  }
}
}}}

[Andreas Rozek|http://www.Andreas-Rozek.de] (EMail: [Andreas.Rozek@GMX.De|mailto:Andreas.Rozek@GMX.De])