You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Christopher Taylor <cs...@pacbell.net> on 2001/06/18 19:15:21 UTC

Re: [Update] source that handles classloading properly on Java 1. X versus Java 2.X

Doh! Thanks for pointing that out... the revised code is attached.

Late night coding... :)

-Chris

----- Original Message -----
From: "Michael McCauley" <Mi...@orbiscom.com>
To: "'LOG4J Developers Mailing List'" <lo...@jakarta.apache.org>
Sent: Monday, June 18, 2001 9:15 AM
Subject: RE: [Update] source that handles classloading properly on Java 1. X
versus Java 2.X


> Chris,
>
> In the source code for VersionHelper,  the getInstance method is as
follows.
>
> public static VersionHelper getInstance()
> {
>      if (helper == null)
>      {
>     try
>     {
>            // Try and load a class from JDK 1.2 or higher
>         Class.forName("java.util.List");
>         return
>
(VersionHelper)Class.forName("org.apache.log4j.helpers.VersionHelper11").new
> Instance();
>     }
>     catch (ClassNotFoundException oops)
>     {
>         return new VersionHelper11();
>     }
>      return helper;
>    }
>
> Are you sure this is correct? Should it not be the following?
>
>   public static VersionHelper getInstance()
>   {
>     if (helper == null)
>     {
> try
>       {
>   // Try and load a class from JDK 1.1 or higher // **** change to
> the comment 1.2 -> 1.1
>   Class.forName("java.util.List");
>   helper =
>
(VersionHelper)Class.forName("org.apache.log4j.VersionHelper11").newInstance
> ();
>       }
> catch (Exception oops)
>       {
>   helper = new VersionHelper20();                // **** this is the
> important change 11 -> 20
> }
>     }
>     return helper;
>   }
>
> Regards,
> Mick.
>
>
> **********************************************************************
> The information contained in this message is confidential and
> is intended for the addressee(s) only.  If you have received
> this message in error or there are any problems please notify
> the originator immediately.  The unauthorised use, disclosure,
> copying or alteration of this message is strictly forbidden. This
> message and any attachments have been scanned for viruses.
> Orbiscom Ltd. will not be liable for direct, special, indirect or
> consequential damages arising from alteration of the contents
> of this message by a third party or as a result of any virus being
> passed on.
>
>
> www.Orbiscom.com
> **************************************
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: log4j-dev-help@jakarta.apache.org
>