Project

General

Profile

Bug #5574

exception from gui in java 7

Added by Daniel Crawl over 7 years ago. Updated over 7 years ago.

Status:
Resolved
Priority:
Normal
Category:
interface
Target version:
Start date:
02/15/2012
Due date:
% Done:

0%

Estimated time:
Bugzilla-Id:
5574

Description

Using java 7, the following exception is generated when choosing "Listen to Actor" from the context menu, or double-clicking on a python actor:

java.lang.NullPointerException
at ptolemy.actor.gui.TextEditor.getBackground(TextEditor.java:144)
at java.awt.Window.setBackground(Unknown Source)
at java.awt.Frame.setBackground(Unknown Source)
at ptolemy.gui.Top.access$1001(Top.java:141)
at ptolemy.gui.Top$SetBackgroundRunnable.run(Top.java:1889)
at ptolemy.gui.Top.deferIfNecessary(Top.java:247)
at ptolemy.gui.Top.setBackground(Top.java:501)
at ptolemy.actor.gui.TextEditor.setBackground(TextEditor.java:238)
at javax.swing.JFrame.frameInit(Unknown Source)
at javax.swing.JFrame.<init>(Unknown Source)
at ptolemy.gui.Top.<init>(Top.java:162)
at ptolemy.actor.gui.TableauFrame.<init>(TableauFrame.java:133)
at ptolemy.actor.gui.TableauFrame.<init>(TableauFrame.java:168)
at ptolemy.actor.gui.TextEditor.<init>(TextEditor.java:104)
at ptolemy.actor.gui.TextEditor.<init>(TextEditor.java:91)
at ptolemy.actor.gui.TextEditor.<init>(TextEditor.java:81)
at ptolemy.vergil.toolbox.TextEditorForStringAttributes.<init>(TextEditorForStringAttributes.java:59)
at ptolemy.vergil.toolbox.TextEditorConfigureFactory.createEditor(TextEditorConfigureFactory.java:135)
at ptolemy.vergil.toolbox.ConfigureAction._openDialog(ConfigureAction.java:143)
at ptolemy.vergil.toolbox.ConfigureAction.actionPerformed(ConfigureAction.java:99)
at diva.canvas.interactor.ActionInteractor.mousePressed(ActionInteractor.java:74)
at diva.canvas.interactor.CompositeInteractor.mousePressed(CompositeInteractor.java:199)
at diva.canvas.interactor.SelectionInteractor.mousePressed(SelectionInteractor.java:202)
at diva.canvas.FigureLayer.dispatchEventUpTree(FigureLayer.java:551)
at diva.canvas.FigureLayer.grabPointer(FigureLayer.java:319)
at diva.canvas.FigureLayer.processLayerEvent(FigureLayer.java:673)
at diva.canvas.FigureLayer.dispatchEvent(FigureLayer.java:203)
at diva.canvas.CanvasPane.processLayerEvent(CanvasPane.java:280)
at diva.canvas.CanvasPane.dispatchEvent(CanvasPane.java:89)
...

History

#1 Updated by Christopher Brooks over 7 years ago

I can reproduce this under Mac OS X 10.7.2 with the Kepler devel tree

bash-3.2$ "${JAVA_HOME}/bin/java" -version
openjdk version "1.7.0-ea"
OpenJDK Runtime Environment (build 1.7.0-ea-b217)
OpenJDK 64-Bit Server VM (build 21.0-b17, mixed mode)
bash-3.2$

export JAVA_HOME=/Library/Java/JavaVirtualMachines/JDK\ 1.7.0\ Developer\ Preview.jdk/Contents/Home

ant run-only

I can also reproduce it in the Ptolemy II Devel tree with Java 1.7 by
exporting JAVA_HOME as above and then doing
cd $PTII
ant run

The full stack trace is
java.lang.NullPointerException
at ptolemy.actor.gui.TextEditor.getBackground(TextEditor.java:145)
at java.awt.Window.setBackground(Window.java:3786)
at java.awt.Frame.setBackground(Frame.java:986)
at ptolemy.gui.Top.access$11(Top.java:1)
at ptolemy.gui.Top$SetBackgroundRunnable.run(Top.java:1897)
at ptolemy.gui.Top.deferIfNecessary(Top.java:246)
at ptolemy.gui.Top.setBackground(Top.java:509)
at ptolemy.actor.gui.TextEditor.setBackground(TextEditor.java:239)
at javax.swing.JFrame.frameInit(JFrame.java:259)
at javax.swing.JFrame.<init>(JFrame.java:181)
at ptolemy.gui.Top.<init>(Top.java:161)
at ptolemy.actor.gui.TableauFrame.<init>(TableauFrame.java:134)
at ptolemy.actor.gui.TableauFrame.<init>(TableauFrame.java:169)
at ptolemy.actor.gui.TextEditor.<init>(TextEditor.java:105)
at ptolemy.actor.gui.TextEditor.<init>(TextEditor.java:92)
at ptolemy.actor.gui.TextEditor.<init>(TextEditor.java:82)
at ptolemy.vergil.toolbox.TextEditorForStringAttributes.<init>(TextEditorForStringAttributes.java:59)
at ptolemy.vergil.toolbox.TextEditorConfigureFactory.createEditor(TextEditorConfigureFactory.java:137)
at ptolemy.vergil.toolbox.ConfigureAction._openDialog(ConfigureAction.java:144)
at ptolemy.vergil.toolbox.ConfigureAction.actionPerformed(ConfigureAction.java:99)
at diva.canvas.interactor.ActionInteractor.mousePressed(ActionInteractor.java:74)
at diva.canvas.interactor.CompositeInteractor.mousePressed(CompositeInteractor.java:199)
at diva.canvas.interactor.SelectionInteractor.mousePressed(SelectionInteractor.java:202)
at diva.canvas.FigureLayer.dispatchEventUpTree(FigureLayer.java:551)
at diva.canvas.FigureLayer.grabPointer(FigureLayer.java:319)
at diva.canvas.FigureLayer.processLayerEvent(FigureLayer.java:673)
at diva.canvas.FigureLayer.dispatchEvent(FigureLayer.java:203)
at diva.canvas.CanvasPane.processLayerEvent(CanvasPane.java:280)
at diva.canvas.CanvasPane.dispatchEvent(CanvasPane.java:89)
at diva.canvas.JCanvas.internalProcessMouseEvent(JCanvas.java:520)
at diva.canvas.JCanvas.processMouseEvent(JCanvas.java:474)
at java.awt.Component.processEvent(Component.java:6269)
at java.awt.Container.processEvent(Container.java:2227)
at java.awt.Component.dispatchEventImpl(Component.java:4860)
at java.awt.Container.dispatchEventImpl(Container.java:2285)
at java.awt.Component.dispatchEvent(Component.java:4686)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4830)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4487)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4420)
at java.awt.Container.dispatchEventImpl(Container.java:2271)
at java.awt.Window.dispatchEventImpl(Window.java:2711)
at java.awt.Component.dispatchEvent(Component.java:4686)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:707)
at java.awt.EventQueue.access$000(EventQueue.java:101)
at java.awt.EventQueue$3.run(EventQueue.java:666)
at java.awt.EventQueue$3.run(EventQueue.java:664)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
at java.awt.EventQueue$4.run(EventQueue.java:680)
at java.awt.EventQueue$4.run(EventQueue.java:678)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:677)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:240)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:142)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:134)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)

I downloaded a new version of Java1.7 and it had a similar problem.
The fix is to check if _scrollbar is null:

public Color getBackground() {
// Under Java 1.7 on the Mac, the _scrollbar is sometimes null.
// See http://bugzilla.ecoinformatics.org/show_bug.cgi?id=5574
if (_scrollPane != null) {
return _scrollPane.getBackground();
} else {
return null;
}
}

I'm not sure why this is happening, but I suspect the problem is that in Java 1.7
setBackground is calling getBackground on subcomponents and the TextEditor
subcomponent is not completely instantiated

#2 Updated by Redmine Admin over 6 years ago

Original Bugzilla ID was 5574

Also available in: Atom PDF