In some of our other projects, we have run into cases where foobar.getClass().getClassLoader() returns null. I wonder if this has anything to do with the fact that we are setting the bootclasspath when we lauch the Java VM.
I would assume that whoever makes the fix in the official Log4J codeline will remove the commented section for FIX BEGIN and FIX END.. I just put that in there to clarify where I made the fix. Mark > -----Original Message----- > From: Michael A. McAngus [mailto:[EMAIL PROTECTED]] > Sent: Saturday, June 22, 2002 9:50 AM > To: Log4J Developers List > Subject: Re: Small Bug + Fix in LogBrokerMonitor.java > > > OK, now I'm confused [sarcastic gasps from the rest of the > list]. How > did the original code ever work? > LogBrokerMonitor is part of the lf5 contribution, and all the image > files are in org/apache/log4j/lf5/viewer/images. > > So, are ClassLoaders able to locate resources even when the URL is > incorrect? > > Also, I believe there is a typo in the "FIX BEGIN" comment block. > > -- > Cheers, > Mike McAngus > [EMAIL PROTECTED] > > Mark DeLaFranier wrote: > > >Just thought somebody might be interested. > > > >Thanks > >Mark > > > >protected JToolBar createToolBar() > >{ > > JToolBar tb = new JToolBar(); > > tb.putClientProperty("JToolBar.isRollover", Boolean.TRUE); > > JComboBox fontCombo = new JComboBox(); > > JComboBox fontSizeCombo = new JComboBox(); > > _fontSizeCombo = fontSizeCombo; > > > > ClassLoader cl = this.getClass().getClassLoader(); > > > > // > > // FIX BEGIN: > > // According to the JDK 1.3 docs: Class.getClass() can > return null > > // to indicate the bootstrap class loader. > > if (cl == null) > > { > > cl = ClassLoader.getSystemClassLoader(); > > } > > // > > // FIX END: > > // > > > > URL newIconURL = cl.getResource("org/apache/log4j/viewer/" + > > "images/channelexplorer_new.gif"); > > > > // The above line would generate a null pointer exception. > > > > > >-- > >To unsubscribe, e-mail: > <mailto:log4j-dev-> [EMAIL PROTECTED]> > >For > additional commands, > e-mail: <mailto:[EMAIL PROTECTED]> > > > > > > > > > > > > -- > To unsubscribe, e-mail: > <mailto:log4j-dev-> [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]>
