FULL PRODUCT VERSION :
jdk 1.8.0_05
ADDITIONAL OS VERSION INFORMATION :
Mac Os - 10.9.3 (Mavericks)
A DESCRIPTION OF THE PROBLEM :
I have a Java FX program which uses a SwingNode to wrap a JFreeChart. I'm getting a repeated hang in CCLGraphicsConfig.getMaxTextureSize().
ADDITIONAL REGRESSION INFORMATION:
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the enclosed code. Sorry - it uses a minimalist JFreeChart because i don't immediately know how to render stuff in Swing. The code hangs even before the full application starts up. Use a ide to suspend the AWT thread and you will see it stuck at CCLGraphicsConfig.getMaxTextureSize()
I note that hang bugs in this function for the mac have been reported before - notably:
JDK-8000794 : [macosx] Stuck in sun.java2d.opengl.CGLGraphicsConfig.getMaxTextureSize(Native Method)
and:
JDK-8000471 : [macosx] Stuck in sun.java2d.opengl.CGLGraphicsConfig.getMaxTextureSize(Native Method)
have the fixes not been ported over to JDK 8?
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The chart should display. This works fine on a PC.
ACTUAL -
Application fails to start up.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
No error message - hang inside getMaxTextureSize. Doesnt appear to be deadlock.
The stack items are:
CGLGraphicsConfig.getMaxTextureSize() line: not available [native method]
CGLGraphicsConfig.getMaxTextureWidth() line: 457 [local variables unavailable]
LWLightweightFramePeer(LWWindowPeer).updateMinimumSize() line: 434 [local variables unavailable]
LWLightweightFramePeer(LWWindowPeer).initializeImpl() line: 183 [local variables unavailable]
LWLightweightFramePeer(LWComponentPeer<T,D>).initialize() line: 313 [local variables unavailable]
LWCToolkit(LWToolkit).createDelegatedLwPeer(LightweightFrame, PlatformComponent, PlatformWindow) line: 221
LWCToolkit(LWToolkit).createLightweightFrame(LightweightFrame) line: 229
JLightweightFrame(LightweightFrame).addNotify() line: 87 [local variables unavailable]
JLightweightFrame(Window).show() line: 1031 [local variables unavailable]
JLightweightFrame(Component).show(boolean) line: 1656
JLightweightFrame(Component).setVisible(boolean) line: 1608
JLightweightFrame(Window).setVisible(boolean) line: 1014
SwingNode.setContentImpl(JComponent) line: 229
SwingNode.access$400(SwingNode, JComponent) line: 114
SwingNode$2.run() line: 174 [local variables unavailable]
SwingFXUtils.runOnEDT(Runnable) line: 221
SwingNode.setContent(JComponent) line: 171
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package demo;
import javafx.application.Application;
import javafx.embed.swing.SwingNode;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;
import javax.swing.SwingUtilities;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.chart.plot.XYPlot;
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
import org.jfree.data.xy.XYDataset;
import org.jfree.data.xy.XYSeries;
import org.jfree.data.xy.XYSeriesCollection;
public class AwtBugDemonstrator extends Application {
@Override
public void start(Stage primaryStage) {
try {
primaryStage.setTitle("Awt Bug Demonstrator");
BorderPane bp = new BorderPane();
Scene scene = new Scene(bp, 400, 400);
SwingNode sn = new SwingNode();
ChartPanel c = new ChartSample().getPanel();
try {
SwingUtilities.invokeAndWait(
()->{
// hangs inside here...
sn.setContent(c);
}
);
} catch (Exception ex) {
ex.printStackTrace();
}
bp.setCenter(sn);
primaryStage.setScene(scene);
primaryStage.show();
} catch(Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
launch(args);
}
//public class LineChartDemo6 extends ApplicationFrame {
public class ChartSample {
ChartPanel chartPanel;
public ChartSample() {
final XYDataset dataset = createDataset();
final JFreeChart chart = createChart(dataset);
chartPanel = new ChartPanel(chart);
chartPanel.setPreferredSize(new java.awt.Dimension(400, 400));
}
public ChartPanel getPanel() {
return chartPanel;
}
private XYDataset createDataset() {
final XYSeries series1 = new XYSeries("First");
series1.add(1.0, 1.0);
final XYSeriesCollection dataset = new XYSeriesCollection();
dataset.addSeries(series1);
return dataset;
}
private JFreeChart createChart(final XYDataset dataset) {
final JFreeChart chart = ChartFactory.createXYLineChart(
"Bug Demonstrator", "X", "Y", dataset,
PlotOrientation.VERTICAL,true, true, false
);
final XYPlot plot = chart.getXYPlot();
final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
plot.setRenderer(renderer);
return chart;
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
None that i'm aware of - i wish there were.