Category: | Bug report |
Priority: | Normal |
Status: | Feedback Requested |
Project: | Severity: | Major |
Resolution: | Reopened |
|
Component: | Reproducibility: | Always |
Assigned to: |
On Fedora 10(64bit) with Sun JVM build 1.6.0_14-b08 I'm just getting an 'empty' Detail-Panel.
After consulting the iReport-NB-IDE-Log it seems that the JSpinner-Component throws the following exception through Double.compareTo():
java.lang.ClassCastException: java.lang.Float cannot be cast to java.lang.Double
at java.lang.Double.compareTo(Double.java:32)
at javax.swing.SpinnerNumberModel.incrValue(SpinnerNumberModel.java:332)
at javax.swing.SpinnerNumberModel.getPreviousValue(SpinnerNumberModel.java:371)
at javax.swing.plaf.basic.BasicSpinnerUI.updateEnabledState(BasicSpinnerUI.java:489)
at javax.swing.plaf.basic.BasicSpinnerUI.updateEnabledState(BasicSpinnerUI.java:470)
at javax.swing.plaf.basic.BasicSpinnerUI.access$200(BasicSpinnerUI.java:33)
at javax.swing.plaf.basic.BasicSpinnerUI$Handler.stateChanged(BasicSpinnerUI.java:1047)
at javax.swing.JSpinner.fireStateChanged(JSpinner.java:434)
at javax.swing.JSpinner$ModelListener.stateChanged(JSpinner.java:361)
at javax.swing.AbstractSpinnerModel.fireStateChanged(AbstractSpinnerModel.java:102)
at javax.swing.SpinnerNumberModel.setValue(SpinnerNumberModel.java:430)
at javax.swing.JSpinner.setValue(JSpinner.java:329)
at com.jaspersoft.ireport.designer.charts.datasets.PieDatasetPanel.setPieDataset(PieDatasetPanel.java:188)
at com.jaspersoft.ireport.designer.charts.ChartPropertiesDialog.setDatasetPanel(ChartPropertiesDialog.java:1637)
at com.jaspersoft.ireport.designer.charts.ChartPropertiesDialog.setChartElement(ChartPropertiesDialog.java:307)
at com.jaspersoft.ireport.designer.charts.ChartDataAction.performAction(ChartDataAction.java:75)
at org.openide.util.actions.NodeAction$DelegateAction$1.run(NodeAction.java:581)
at org.netbeans.modules.openide.util.ActionsBridge.doPerformAction(ActionsBridge.java:77)
at org.openide.util.actions.NodeAction$DelegateAction.actionPerformed(NodeAction.java:577)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1225)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1266)
at java.awt.Component.processMouseEvent(Component.java:6263)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6028)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4630)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2475)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
5 Comments:
I checked the line pointed by the exception but I'm not able to reproduce it. Do you have a JRXML or a step by step way to reproduce the problem? It would help a lot. Thanks
Giulio
Sorry, just read your comment. I think it may be a JVM problem
Closing the bug, since there is nothing I can do about it :-(
Feel you free to reopen if you find more information about how to fix it.
Thanks a lot
Giulio
While its true that this issues doesn't occur in a Windows environment, it does occur in Ubuntu on both 32 and 64 bit OS'es as well with both 1.5 and 1.6 JDK. I don't believe the different OS and/or JDK is the reason why it works in Windows, but rather may have something to do with windows using a different set of default/startup parameters.
The Exception is:
java.lang.ClassCastException: java.lang.Float cannot be cast to java.lang.Double
and occurs at
com.jaspersoft.ireport.designer.charts.datasets.PieDatasetPanel.setPieDataset(PieDatasetPanel.java:188) (iReports 3.5.2)
or
iReport-nb-3.6.0-src/ireport-designer/src/com/jaspersoft/ireport/designer/charts/datasets/PieDatasetPaPieDatasetPanel.javanel.java : 179 (iReports 3.6.0).
Looking at the code at this line, it reads:
jSpinnerMinPercentage.setValue( pieDataset.getMinPercentage() == null ? new Float(0) : pieDataset.getMinPercentage());
If jSpinner is really a Double and not a float, like other code in iReports suggests such as in
./ireport-designer/src/com/jaspersoft/ireport/designer/sheet/editors/box/PenEditorPanel.java:
jSpinnerLineWidth.setValue(new Double(0));
Then it would make sense that trying to set a Float(0) object to a Double would generate this exception. It appears that by changing the line to
jSpinnerMinPercentage.setValue( pieDataset.getMinPercentage() == null ? new Double(0) : pieDataset.getMinPercentage());
would keep this exception from occurring.
Since this code is only executed when the value is null, it seems that in the Windows environment (possibly in the different startup script), this value could be initialized to some non null value. If that is true, that initialization, if added to the bin/ireport shell script, could solve this problem for us linux users before a new version of the application is released.
I have implemented this workaround:
try {
SpinnerNumberModel model = (SpinnerNumberModel)jSpinnerMaxCount.getModel();
if (pieDataset.getMinPercentage() == null)
{
model.setValue(new Double(0));
}
else
{
model.setValue(pieDataset.getMinPercentage());
}
} catch (Exception ex)
{
ex.printStackTrace();
}
To be released in iR 3.6.1.
Hopefully it will fix the problem. I currently don't have a Linux box to try :-(