Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   "Write once, test everywhere" - Win2K / XP (http://www.velocityreviews.com/forums/t143406-write-once-test-everywhere-win2k-xp.html)

Tim Ward 05-11-2005 09:30 AM

"Write once, test everywhere" - Win2K / XP
 
I've got this Swing application developed, and working in the field, on
Win2k which I'm told crashes on XP.

I've been sent a backtrace which seems to indicate that it falls over in:

com.sun.java.swing.plaf.windows.WindowsTableHeader UI$XPDefaultRenderer

so this looks like a problem to do with incompatibilities between the XP
look and feel and the Win2k one.

Have I got this right so far?

If so, then given that my development box is running Win2k, how do I find
out what parameter to pass to UIManager.setLookAndFeel() to make it run the
XP look and feel so I can debug the problem? Or is this impossible because
the XP UI code will only run on XP so I'll need to acquire an XP box?

--
Tim Ward
Brett Ward Limited - www.brettward.co.uk



Daniel Dyer 05-11-2005 09:44 AM

Re: "Write once, test everywhere" - Win2K / XP
 
On Wed, 11 May 2005 10:30:50 +0100, Tim Ward <tw2@ipaccess.com> wrote:

> I've got this Swing application developed, and working in the field, on
> Win2k which I'm told crashes on XP.
>
> I've been sent a backtrace which seems to indicate that it falls over in:
>
> com.sun.java.swing.plaf.windows.WindowsTableHeader UI$XPDefaultRenderer
>
> so this looks like a problem to do with incompatibilities between the XP
> look and feel and the Win2k one.
>
> Have I got this right so far?
>
> If so, then given that my development box is running Win2k, how do I find
> out what parameter to pass to UIManager.setLookAndFeel() to make it run
> the
> XP look and feel so I can debug the problem? Or is this impossible
> because
> the XP UI code will only run on XP so I'll need to acquire an XP box?


You could try using System.setProperty() to change the value of "os.name"
and/or "os.version" as required before setting the look-and-feel. I seem
to remember getting the Windows look-and-feel to work under Linux this way
(although in that case it was a bit more involved than that).

Dan.


--
Daniel Dyer
http://www.footballpredictions.net

Tim Ward 05-11-2005 09:59 AM

Re: "Write once, test everywhere" - Win2K / XP
 
"Daniel Dyer" <dan@footballnospamformepleasepredictions.net> wrote in
message news:op.sqluotqb3rnoah@cgl0517.chaucer.co.uk...
>
> You could try using System.setProperty() to change the value of "os.name"
> and/or "os.version" as required before setting the look-and-feel. I seem
> to remember getting the Windows look-and-feel to work under Linux this way
> (although in that case it was a bit more involved than that).


Further research, searching for the last bits of the backtrace:

Exception in thread "main" java.lang.NullPointerException
at javax.swing.border.EmptyBorder.<init>(Unknown Source)
at
com.sun.java.swing.plaf.windows.WindowsTableHeader UI$XPDefaultRenderer.getTa
bleCellRendererComponent(Unknown Source)

shows that lots of people think this is a bug in the JRE but I can't find
any suggested solution or workaround.

(Other than reverting to an earlier JRE ... which has bugs in the socket
handling that would stop my application working anyway.)

--
Tim Ward
Brett Ward Limited - www.brettward.co.uk



John 05-11-2005 11:05 AM

Re: "Write once, test everywhere" - Win2K / XP
 
Tim Ward wrote:
> "Daniel Dyer" <dan@footballnospamformepleasepredictions.net> wrote in
> message news:op.sqluotqb3rnoah@cgl0517.chaucer.co.uk...
>
>>You could try using System.setProperty() to change the value of "os.name"
>>and/or "os.version" as required before setting the look-and-feel. I seem
>>to remember getting the Windows look-and-feel to work under Linux this way
>>(although in that case it was a bit more involved than that).

>
>
> Further research, searching for the last bits of the backtrace:
>
> Exception in thread "main" java.lang.NullPointerException
> at javax.swing.border.EmptyBorder.<init>(Unknown Source)
> at
> com.sun.java.swing.plaf.windows.WindowsTableHeader UI$XPDefaultRenderer.getTa
> bleCellRendererComponent(Unknown Source)
>
> shows that lots of people think this is a bug in the JRE but I can't find
> any suggested solution or workaround.
>
> (Other than reverting to an earlier JRE ... which has bugs in the socket
> handling that would stop my application working anyway.)
>
> --
> Tim Ward
> Brett Ward Limited - www.brettward.co.uk
>
>


Get an XP box and refactor the code such that it works (there is
probably something slightly quirky (though probably quite valid) in your
original code that is causing this error). Once you have it sorted in a
non-hacky fashion then there it is highly unlikely to break on the win2k
machine(s).

John

Tim Ward 05-11-2005 12:06 PM

Re: "Write once, test everywhere" - Win2K / XP
 
"John" <no@email> wrote in message
news:4281e6de$0$2601$da0feed9@news.zen.co.uk...
>
> Get an XP box and refactor the code such that it works (there is
> probably something slightly quirky (though probably quite valid) in your
> original code that is causing this error). Once you have it sorted in a
> non-hacky fashion then there it is highly unlikely to break on the win2k
> machine(s).


I've acquired an XP box and it works fine, so this bug in the JRE depends
on some XP setting that I haven't identified yet. (Just as well it works,
mind, because NetBeans won't install on the XP box, so I couldn't fix it
anyway.)

--
Tim Ward
Brett Ward Limited - www.brettward.co.uk



Roland 05-11-2005 12:27 PM

Re: "Write once, test everywhere" - Win2K / XP
 
On 11-5-2005 14:06, Tim Ward wrote:

> "John" <no@email> wrote in message
> news:4281e6de$0$2601$da0feed9@news.zen.co.uk...
>
>>Get an XP box and refactor the code such that it works (there is
>>probably something slightly quirky (though probably quite valid) in your
>>original code that is causing this error). Once you have it sorted in a
>>non-hacky fashion then there it is highly unlikely to break on the win2k
>>machine(s).

>
>
> I've acquired an XP box and it works fine, so this bug in the JRE depends
> on some XP setting that I haven't identified yet. (Just as well it works,
> mind, because NetBeans won't install on the XP box, so I couldn't fix it
> anyway.)
>
> --
> Tim Ward
> Brett Ward Limited - www.brettward.co.uk
>
>

Maybe something to do with XP themes?
If you look at the source of the nested class XPDefaultRenderer in
com.sun.java.swing.plaf.windows.WindowsTableHeader UI and class
com.sun.java.swing.plaf.windows.XPStyle.
--
Regards,

Roland de Ruiter
___ ___
/__/ w_/ /__/
/ \ /_/ / \

Tim Ward 05-11-2005 12:36 PM

Re: "Write once, test everywhere" - Win2K / XP
 
"Roland" <roland@phony.biz> wrote in message
news:4281fa1f$0$61568$e4fe514c@news.xs4all.nl...
> On 11-5-2005 14:06, Tim Ward wrote:
>
> > "John" <no@email> wrote in message
> > news:4281e6de$0$2601$da0feed9@news.zen.co.uk...
> >
> >>Get an XP box and refactor the code such that it works (there is
> >>probably something slightly quirky (though probably quite valid) in your
> >>original code that is causing this error). Once you have it sorted in a
> >>non-hacky fashion then there it is highly unlikely to break on the win2k
> >>machine(s).

> >
> > I've acquired an XP box and it works fine, so this bug in the JRE

depends
> > on some XP setting that I haven't identified yet. (Just as well it

works,
> > mind, because NetBeans won't install on the XP box, so I couldn't fix it
> > anyway.)
> >

> Maybe something to do with XP themes?


Yes, I assume so. But I can't break it by playing around with themes on my
box, and my customer can't make it work by playing around with themes on his
....

> If you look at the source of the nested class XPDefaultRenderer in
> com.sun.java.swing.plaf.windows.WindowsTableHeader UI and class
> com.sun.java.swing.plaf.windows.XPStyle.


Yes. My copies of that source code are empty (probably 1.4.1 vintage). I'm
having difficulty summoning up the energy to find and download later
versions. I think I'll do some C++ for the rest of the afternoon ...

--
Tim Ward
Brett Ward Limited - www.brettward.co.uk



Larry Barowski 05-12-2005 08:12 PM

Re: "Write once, test everywhere" - Win2K / XP
 

"Tim Ward" <tw2@ipaccess.com> wrote in message
news:3ee3boF2k9vuU1@individual.net...
> "Daniel Dyer" <dan@footballnospamformepleasepredictions.net> wrote in
> message news:op.sqluotqb3rnoah@cgl0517.chaucer.co.uk...
> >

> ...
> Further research, searching for the last bits of the backtrace:
>
> Exception in thread "main" java.lang.NullPointerException
> at javax.swing.border.EmptyBorder.<init>(Unknown Source)
> at
>

com.sun.java.swing.plaf.windows.WindowsTableHeader UI$XPDefaultRenderer.getTa
> bleCellRendererComponent(Unknown Source)


We get this occasionally. With a few tens of thousands of users,
probably 1/3 of those using Windows L&F, and automatic uncaught
exception reporting (with user approval), we probably see one or two
per month. So for our software at least, it seems to be random and quite
rare - less than 1/100,000 runs. It always happens when the gui is first
made visible, and we haven't seen any similar bugs for other L&Fs. It
seems to happen under all Java 1.4 and 1.5 versions, and not in 1.3.

In case someone wants to try to track down the problem, here is a trace
with line numbers under Java 1.4.2_05
at javax.swing.border.EmptyBorder.<init>(EmptyBorder. java:54)
at
com.sun.java.swing.plaf.windows.WindowsTableHeader UI$XPDefaultRenderer.getTa
bleCellRendererComponent(WindowsTableHeaderUI.java :63)
at
javax.swing.plaf.basic.BasicTableHeaderUI.getHeade rRenderer(BasicTableHeader
UI.java:394)
at
javax.swing.plaf.basic.BasicTableHeaderUI.getHeade rHeight(BasicTableHeaderUI
..java:428)
at
javax.swing.plaf.basic.BasicTableHeaderUI.createHe aderSize(BasicTableHeaderU
I.java:454)
at
javax.swing.plaf.basic.BasicTableHeaderUI.getPrefe rredSize(BasicTableHeaderU
I.java:485)
at javax.swing.JComponent.getPreferredSize(JComponent .java:1275)

This also shows up in Sun bug 5027059 for netbeans, but it is closed
as "not reproducible" with note "Not a problem on later versions of
JDK 1.4.2 (bug reported on b28)."




Tim Ward 05-13-2005 09:25 AM

Re: "Write once, test everywhere" - Win2K / XP
 
"Larry Barowski" <MElarrybar-AT-eng_DOT_auburnANOTHERDOTeduEND> wrote in
message news:V-SdnSKJ2M4_Nx7fRVn-hw@comcast.com...
>
> We get this occasionally. ....


Thanks for the info.

--
Tim Ward
Brett Ward Limited - www.brettward.co.uk



Nigel Wade 05-13-2005 10:36 AM

Re: "Write once, test everywhere" - Win2K / XP
 
"Larry Barowski" <MElarrybar-AT-eng_DOT_auburnANOTHERDOTeduEND> wrote:

>
> "Tim Ward" <tw2@ipaccess.com> wrote in message
> news:3ee3boF2k9vuU1@individual.net...
>> "Daniel Dyer" <dan@footballnospamformepleasepredictions.net> wrote in
>> message news:op.sqluotqb3rnoah@cgl0517.chaucer.co.uk...
>> >

>> ...
>> Further research, searching for the last bits of the backtrace:
>>
>> Exception in thread "main" java.lang.NullPointerException
>> at javax.swing.border.EmptyBorder.<init>(Unknown Source)
>> at
>>

>

com.sun.java.swing.plaf.windows.WindowsTableHeader UI$XPDefaultRenderer.getTa
>> bleCellRendererComponent(Unknown Source)

>
> We get this occasionally. With a few tens of thousands of users,
> probably 1/3 of those using Windows L&F, and automatic uncaught
> exception reporting (with user approval), we probably see one or two
> per month. So for our software at least, it seems to be random and quite
> rare - less than 1/100,000 runs. It always happens when the gui is first
> made visible, and we haven't seen any similar bugs for other L&Fs. It
> seems to happen under all Java 1.4 and 1.5 versions, and not in 1.3.
>
> In case someone wants to try to track down the problem, here is a trace
> with line numbers under Java 1.4.2_05
> at javax.swing.border.EmptyBorder.<init>(EmptyBorder. java:54)
> at
>

com.sun.java.swing.plaf.windows.WindowsTableHeader UI$XPDefaultRenderer.getTa
> bleCellRendererComponent(WindowsTableHeaderUI.java :63)
> at
>

javax.swing.plaf.basic.BasicTableHeaderUI.getHeade rRenderer(BasicTableHeader
> UI.java:394)
> at
>

javax.swing.plaf.basic.BasicTableHeaderUI.getHeade rHeight(BasicTableHeaderUI
> .java:428)
> at
>

javax.swing.plaf.basic.BasicTableHeaderUI.createHe aderSize(BasicTableHeaderU
> I.java:454)
> at
>

javax.swing.plaf.basic.BasicTableHeaderUI.getPrefe rredSize(BasicTableHeaderU
> I.java:485)
> at javax.swing.JComponent.getPreferredSize(JComponent .java:1275)
>
> This also shows up in Sun bug 5027059 for netbeans, but it is closed
> as "not reproducible" with note "Not a problem on later versions of
> JDK 1.4.2 (bug reported on b28)."


Is there any chance that this is a GUI initialization thread (EDT vs. main)
race condition? Do you at any stage initialize or modify any part of the
GUI in the main thread? The fact that it only occurs when the GUI is first
made visible might be a clue.

I've been hit by this GUI initialization thread race condition, but since I
changed to initializing everything in the EDT via
SwingUtilities.invoke_later() it's never recurred.

--
Nigel Wade, System Administrator, Space Plasma Physics Group,
University of Leicester, Leicester, LE1 7RH, UK
E-mail : nmw@ion.le.ac.uk
Phone : +44 (0)116 2523548, Fax : +44 (0)116 2523555


All times are GMT. The time now is 04:36 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.