That's a good idea... the code would be similar, except we'd catch
SecurityException instead of ClassNotFoundException.

-Chris
----- Original Message -----
From: "Anders Kristensen" <[EMAIL PROTECTED]>
To: "LOG4J Developers Mailing List" <[EMAIL PROTECTED]>
Sent: Monday, June 18, 2001 9:39 AM
Subject: Re: [Update] source that handles classloading properly on Java 1.X
versus Java 2.X


> Alternatively, inspect the "java.specification.version" system property.
> For JDK 1.3 it's "1.3".
>
> Anders
>
>
> Michael McCauley wrote:
> >
> > 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: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


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

Reply via email to