But, if they are created as beans, then they need an empty constructor.  I
can do it differently though.  If I find a plugin with null for a name, I
can just set the name to "".  And in my plugin skeleton, I can set the name
to "" to start with.

thanks,
-Mark

> -----Original Message-----
> From: Ceki Gulcu [mailto:[EMAIL PROTECTED]]
> Sent: Friday, November 22, 2002 1:39 AM
> To: Log4J Developers List
> Subject: Re: cvs commit: jakarta-log4j/src/java/org/apache/log4j
> PluginRegistry.java
>
>
>
> Instead of
>
>   String name = plugin.getName();
>   if (name == null) {
>     name = "";
>   }
>
> you could prevent the creation of plugins with no names.
>
>
>
> At 04:52 22.11.2002 +0000, you wrote:
> >mwomack     2002/11/21 20:52:19
> >
> >   Modified:    src/java/org/apache/log4j PluginRegistry.java
> >   Log:
> >   Fix trivial bug with null plugin names.
> >
> >   Revision  Changes    Path
> >   1.2       +11
> > -3     jakarta-log4j/src/java/org/apache/log4j/PluginRegistry.java
> >
> >   Index: PluginRegistry.java
> >   ===================================================================
> >   RCS file:
> > /home/cvs/jakarta-log4j/src/java/org/apache/log4j/PluginRegistry.java,v
> >   retrieving revision 1.1
> >   retrieving revision 1.2
> >   diff -u -r1.1 -r1.2
> >   --- PluginRegistry.java       20 Sep 2002 05:30:01 -0000      1.1
> >   +++ PluginRegistry.java       22 Nov 2002 04:52:19 -0000      1.2
> >   @@ -47,8 +47,12 @@
> >            repositoryMap.put(repository, pluginMap);
> >          }
> >
> >   -      // existing plugin exists with the
> >   -      Plugin existingPlugin =
> (Plugin)pluginMap.get(plugin.getName());
> >   +      // existing plugin exists with the
> >   +      String name = plugin.getName();
> >   +      if (name == null) {
> >   +        name = "";
> >   +      }
> >   +      Plugin existingPlugin = (Plugin)pluginMap.get(name);
> >          if (existingPlugin != null) {
> >            boolean isEqual = existingPlugin.equals(plugin);
> >
> >   @@ -62,7 +66,7 @@
> >          }
> >
> >          // put the new plugin into the map
> >   -      pluginMap.put(plugin.getName(), plugin);
> >   +      pluginMap.put(name, plugin);
> >
> >          // start the new plugin
> >          plugin.activateOptions();
> >   @@ -96,6 +100,10 @@
> >        Stops a plugin in the given logger repository. */
> >      public static Plugin stopPlugin(String pluginName,
> >      LoggerRepository repository) {
> >   +    String name = pluginName;
> >   +    if (pluginName == null) {
> >   +      pluginName = "";
> >   +    }
> >        synchronized(repositoryMap) {
> >          Hashtable pluginMap = (Hashtable)repositoryMap.get(repository);
> >          if (pluginMap == null)
> >
> >
> >
> >
> >--
> >To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> >For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
> --
> Ceki
>
> TCP implementations will follow a general principle of robustness: be
> conservative in what you do, be liberal in what you accept from
> others. -- Jon Postel, RFC 793
>
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to