Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 28780 - [Preferences] Fonts and Colors unavailable in Window->Preferences
Summary: [Preferences] Fonts and Colors unavailable in Window->Preferences
Status: CLOSED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.1   Edit
Hardware: Sun Solaris
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Tod Creasey CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 29290
Blocks:
  Show dependency tree
 
Reported: 2002-12-20 18:20 EST by Andrew Hobson CLA
Modified: 2005-05-10 14:56 EDT (History)
0 users

See Also:


Attachments
A test case that reproduces the getFontMetrics bug (1.19 KB, text/plain)
2003-01-10 09:21 EST, Andrew Hobson CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Hobson CLA 2002-12-20 18:20:28 EST
I've had this problem since at least 2.0.  I'm running M4 now.  I did a bugzilla
search and a search on the web page but I didn't find anything that would fix
the problem.

This error seems to manifest itself in several ways.  I start eclipse from the
command line by running "./eclipse".  When I go to
Window->Preferences->Java->Editor for the first time, eclipse prints the
following message

Unhandled exception caught in event loop.
Reason:
Failed to execute runnable (java.lang.NumberFormatException: [9.00 0.00 0.00 9.00])

*** Stack trace of contained exception ***
Reason:
[9.00 0.00 0.00 9.00]

Editor is highlighted in the frame to the left, but the frame to the right still
displays the information from the previous tab that I visited.

I then select another tab in the left frame, and then Editor again.  This time
it does display the Editor information; however the Text font is completely
blank and the Appearance color options box is completely empty.

If I select the button next to color, nothing happens.

If I select the Change button for the text font, eclipse prints out:

Unhandled exception caught in event loop.
Reason:
java.lang.NullPointerException

If I then click the OK button, eclipse again prints out

Unhandled exception caught in event loop.
Reason:
java.lang.NullPointerException

I have to click cancel to close the screen.

This makes it impossible to save changes on that screen, even if I don't want to
change the font or colors.  Naturally I would like for all the options to be
available, but in the worst case I'd like to be able to change the non color or
font related options.

$ uname -a
SunOS vaus 5.8 Generic_108528-15 sun4u sparc SUNW,Sun-Blade-100

If I can provide any assistance in tracking down this bug, please let me know.
Comment 1 Tod Creasey CLA 2003-01-08 16:09:24 EST
I can't replicate myself using M4 but NumberFormatExceptions sound like they
might be VM related to me. Whose VM are you using and what version?
Comment 2 Tod Creasey CLA 2003-01-08 16:17:44 EST
I am using the Sun 1.3.1 Solaris JDK from Aug 08, 2001 on Sun OS 5.8
Comment 3 Andrew Hobson CLA 2003-01-09 10:07:48 EST
$JAVA_HOME/bin/java -version
java version "1.3.1_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_02-b02)
Java HotSpot(TM) Client VM (build 1.3.1_02-b02, mixed mode)


Maybe something about how I've configured my machine is causing the problem, but
I just don't know what it could be.  Maybe I've disabled some process that
eclipse is trying to talk to.

I should have included the log entry in my original bug report. I'm sorry I
didn't.  Here it is now.


!ENTRY org.eclipse.ui 4 0 Jan 09, 2003 10:20:17.181
!MESSAGE [9.00 0.00 0.00 9.00]
!STACK 0
java.lang.NumberFormatException: [9.00 0.00 0.00 9.00]
        at java.lang.Integer.parseInt(Integer.java:414)
        at java.lang.Integer.parseInt(Integer.java:463)
        at org.eclipse.swt.graphics.FontData.setXlfd(FontData.java:477)
        at org.eclipse.swt.graphics.FontData.motif_new(FontData.java:337)
        at org.eclipse.swt.graphics.GC.getFontMetrics(GC.java:1922)
        at org.eclipse.jdt.internal.ui.preferences.ColorEditor.computeImageSize(
ColorEditor.java:111)
        at org.eclipse.jdt.internal.ui.preferences.ColorEditor.<init>(ColorEdito
r.java:40)
        at org.eclipse.jdt.internal.ui.preferences.JavaEditorPreferencePage.crea
teAppearancePage(JavaEditorPreferencePage.java:652)
        at org.eclipse.jdt.internal.ui.preferences.JavaEditorPreferencePage.crea
teContents(JavaEditorPreferencePage.java:938)
        at org.eclipse.jface.preference.PreferencePage.createControl(PreferenceP
age.java:209)
        at org.eclipse.jdt.internal.ui.preferences.JavaEditorPreferencePage.crea
teControl(JavaEditorPreferencePage.java:322)
        at org.eclipse.jface.preference.PreferenceDialog.showPage(PreferenceDial
og.java:963)
        at org.eclipse.jface.preference.PreferenceDialog$7.run(PreferenceDialog.
java:456)
        at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:65)
        at org.eclipse.jface.preference.PreferenceDialog$6.widgetSelected(Prefer
enceDialog.java:449)
        at org.eclipse.jface.util.OpenStrategy.firePostSelectionEvent(OpenStrate
gy.java:192)
        at org.eclipse.jface.util.OpenStrategy.access$4(OpenStrategy.java:187)
        at org.eclipse.jface.util.OpenStrategy$3.run(OpenStrategy.java:327)
        at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:31)
        at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.ja
va:94)
        at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:1803)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1619)
        at org.eclipse.jface.window.Window.runEventLoop(Window.java:561)
        at org.eclipse.jface.window.Window.open(Window.java:541)
        at org.eclipse.ui.internal.OpenPreferencesAction.run(OpenPreferencesActi
on.java:47)
        at org.eclipse.jface.action.Action.runWithEvent(Action.java:769)
        at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection
(ActionContributionItem.java:411)
        at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent(Act
ionContributionItem.java:365)
        at org.eclipse.jface.action.ActionContributionItem.access$0(ActionContri
butionItem.java:356)
        at org.eclipse.jface.action.ActionContributionItem$ActionListener.handle
Event(ActionContributionItem.java:48)
        at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:855)
        at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1825)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1616)
        at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1446)
        at org.eclipse.ui.internal.Workbench.run(Workbench.java:1429)
        at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoa
der.java:845)
        at org.eclipse.core.boot.BootLoader.run(BootLoader.java:462)
        at java.lang.reflect.Method.invoke(Native Method)
        at org.eclipse.core.launcher.Main.basicRun(Main.java:247)
        at org.eclipse.core.launcher.Main.run(Main.java:703)
        at org.eclipse.core.launcher.Main.main(Main.java:539)
Comment 4 Andrew Hobson CLA 2003-01-10 09:21:13 EST
Created attachment 2946 [details]
A test case that reproduces the getFontMetrics bug

I'm not an SWT programmer, but I looked at the sample SWT app in one of the
articles and was able to reproduct the problem.
Comment 5 Andrew Hobson CLA 2003-01-10 09:26:11 EST
*sigh*.  I guess I should include what happens when I run the test program.

f:Font {2393592}
java.lang.NumberFormatException: [9.00 0.00 0.00 9.00]
        at java.lang.Integer.parseInt(Integer.java:414)
        at java.lang.Integer.parseInt(Integer.java:463)
        at org.eclipse.swt.graphics.FontData.setXlfd(FontData.java:477)
        at org.eclipse.swt.graphics.FontData.motif_new(FontData.java:337)
        at org.eclipse.swt.graphics.GC.getFontMetrics(GC.java:1922)
        at test.FontTest.test(FontTest.java:26)
        at test.FontTest.main(FontTest.java:40)
Comment 6 Tod Creasey CLA 2003-01-22 09:56:53 EST
Reducing to P3 as this seems to be VM related
Comment 7 Andrew Hobson CLA 2003-01-22 14:13:43 EST
I disagree.

/usr/j2sdk1.4.1/bin/java -classpath
eclipse/plugins/org.eclipse.swt.motif_2.1.0/ws/motif/swt.jar:eclipse/plugins/org.eclipse.jface_2.1.0/jface.jar:classes
test.FontTest
f:Font {2008368}
java.lang.NumberFormatException: For input string: "[9.00 0.00 0.00 9.00]"
        at
java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
        at java.lang.Integer.parseInt(Integer.java:426)
        at java.lang.Integer.parseInt(Integer.java:476)
        at org.eclipse.swt.graphics.FontData.setXlfd(FontData.java:477)
        at org.eclipse.swt.graphics.FontData.motif_new(FontData.java:337)
        at org.eclipse.swt.graphics.GC.getFontMetrics(GC.java:1922)
        at test.FontTest.test(FontTest.java:26)
        at test.FontTest.main(FontTest.java:40)


Comment 8 Tod Creasey CLA 2003-01-22 15:38:06 EST
What is the timestamp on your VM? We don't have that one here and testing using
the August 2001 1.3.1.01 does not mmake this happen.

Also which version of Solaris are you running? This may also be OS related.
Comment 9 Tod Creasey CLA 2003-01-22 15:57:16 EST
I think the issue is that we have a bogus font in our definition file.

Would you mind replacing the line

JFaceResources.getFontRegistry().get(JFaceResources.DEFAULT_FONT);

with

JFaceResources.getDefaultFont()

and letting me know if you still get the problem? If not then the default we 
put into the jfacefonts.properties is at fault.
Comment 10 Andrew Hobson CLA 2003-01-22 16:21:48 EST
That fixes the problem in the test case!  Woo hoo!
Comment 11 Tod Creasey CLA 2003-04-02 11:49:39 EST
This font was removed for 2.1.
Comment 12 Tod Creasey CLA 2005-05-10 14:56:25 EDT
Marking closed