I really hope an IA developer is listening because I have run across what looks like a bug in Ignition: When opening a window in the designer, I get a division by zero ArithmeticException and the window DOES NOT OPEN. When opening this window in the client, I get no error and the window opens correctly.
How am I going to investigate the error or implement a workaround if I cannot get the window to open in the designer?
Here are the errors I get in the designer:
Exception: Error setting property to 'java.awt.Color[r=0,g=0,b=0]' for binding on
Answer View.Root Container.Chart Panel.SingleChart.plotBackground
caused by ArithmeticException: / by zero
Ignition v7.7.8 (b2016040703)
Java: Oracle Corporation 1.8.0_161
Exception in thread "AWT-EventQueue-2" java.lang.ArithmeticException: / by zero
at com.inductiveautomation.factorypmi.application.components.chart.easychart.ConstantPenDatasource.createTimeColumn(ConstantPenDatasource.java:123)
at com.inductiveautomation.factorypmi.application.components.chart.easychart.ConstantPenDatasource.updateData(ConstantPenDatasource.java:107)
at com.inductiveautomation.factorypmi.application.components.chart.easychart.ConstantPenDatasource.startup(ConstantPenDatasource.java:79)
at com.inductiveautomation.factorypmi.application.components.PMIEasyChart$EasyChart.startup(PMIEasyChart.java:2264)
at com.inductiveautomation.factorypmi.application.components.PMIEasyChart$EasyChart.createChartImpl(PMIEasyChart.java:2876)
at com.inductiveautomation.factorypmi.application.components.chart.PMILineChartPanel.createChart(PMILineChartPanel.java:126)
at com.inductiveautomation.factorypmi.application.components.PMIEasyChart$ChartUpdater.run(PMIEasyChart.java:715)
at com.inductiveautomation.ignition.client.util.EDTUtil$ProcessQueue.run(EDTUtil.java:113)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
I have heard of a similar error in the past, where a project was modified and now the windows can’t be opened again in the Designer. Let me see if I can get my coworker to replicate…
Without opening the window, right click on it in the designer tree while holding a shift key. That’ll give you the option to “Copy XML To Clipboard”. You can then edit the (rather complex) serializable form of the window to find and fix your binding error. Then use the right-click with shift option to “Set XML From Clipboard” with your attempted fixes.
I have the exported XML (~90000 lines), but am wary of modifying it myself. Is there someone who could look at it and recommend what I would need to delete to get the window to open in the designer?
If it was recent change to window that caused error. You can try rolling back to earlier version where it were if opens in designer correctly. (i think designer can go back 10 revisions)
After looking in the designer console, I noticed that the first error to appear is as follows:
ERROR [AbstractPropertyAdapter-AWT-EventQueue-2]
java.lang.Exception: Error setting property to 'java.awt.Color[r=0,g=0,b=0]' for binding on
Answer View.Root Container.Chart Panel.SingleChart.plotBackground
at com.inductiveautomation.factorypmi.application.binding.AbstractPropertyAdapter.updateTarget(AbstractPropertyAdapter.java:329)
at com.inductiveautomation.factorypmi.application.binding.AbstractPropertyAdapter.updateValue(AbstractPropertyAdapter.java:266)
at com.inductiveautomation.factorypmi.application.binding.ExpressionPropertyAdapter.runExpression(ExpressionPropertyAdapter.java:88)
at com.inductiveautomation.factorypmi.application.binding.ExpressionPropertyAdapter.startup(ExpressionPropertyAdapter.java:112)
at com.inductiveautomation.factorypmi.application.binding.DefaultInteractionController.startupAdapters(DefaultInteractionController.java:313)
at com.inductiveautomation.factorypmi.application.FPMIWindow.startup(FPMIWindow.java:342)
at com.inductiveautomation.factorypmi.designer.workspace.WindowWorkspace$DesigntimeWindowOpener.openWindow(WindowWorkspace.java:3540)
at com.inductiveautomation.factorypmi.designer.workspace.WindowWorkspace.openWindow(WindowWorkspace.java:1305)
at com.inductiveautomation.factorypmi.designer.model.navtree.WindowNode.onDoubleClick(WindowNode.java:248)
at com.inductiveautomation.ignition.designer.navtree.NavTreePanel$MouseListener$1.run(NavTreePanel.java:598)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.ArithmeticException: / by zero
at com.inductiveautomation.factorypmi.application.components.chart.easychart.ConstantPenDatasource.createTimeColumn(ConstantPenDatasource.java:123)
at com.inductiveautomation.factorypmi.application.components.chart.easychart.ConstantPenDatasource.updateData(ConstantPenDatasource.java:107)
at com.inductiveautomation.factorypmi.application.components.chart.easychart.ConstantPenDatasource.startup(ConstantPenDatasource.java:79)
at com.inductiveautomation.factorypmi.application.components.PMIEasyChart$EasyChart.startup(PMIEasyChart.java:2264)
at com.inductiveautomation.factorypmi.application.components.PMIEasyChart$EasyChart.createChartImpl(PMIEasyChart.java:2876)
at com.inductiveautomation.factorypmi.application.components.chart.PMILineChartPanel.createChart(PMILineChartPanel.java:126)
at com.inductiveautomation.factorypmi.application.components.chart.PMILineChartPanel.setPlotBackground(PMILineChartPanel.java:333)
at com.inductiveautomation.factorypmi.application.components.PMIEasyChart.setPlotBackground(PMIEasyChart.java:1191)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.inductiveautomation.factorypmi.application.binding.AbstractPropertyAdapter.updateTarget(AbstractPropertyAdapter.java:322)
... 23 more
I wonder if editing the XML to remove the binding on Answer View.Root Container.Chart Panel.SingleChart.plotBackground would allow the window to open in the designer? If so, could someone show me how to alter the above XML?
I made one slight change in the file where I thought you were pulling the users custom configured plotBackground preference and setting it to the component property. I just changed it to a static color(77, 77, 77). You can search for that and see the change between the two files. I will try to look again later.
Wow, this window is really a poster child for why we stopped serializing most datasets.
Anyhow, removing the binding on the plotBackground should fix it - it’s getting into a situation where it’s trying to use the width of the chart as the horizontal resolution - but the chart is width zero for some reason. I’m surprised nobody has hit this before.
I’m walking into a meeting but I can take a look when I get out.
Try this guy instead. Same instructions as @bfuson stated. You should be able to verify the new file by searching for color(22,22,22)
Side note, it looks like the binding was orignally being populated by app.ctrl.getChartBackgroundColor(), so you could alternativly hardcode that function to return a static color, open the window, and manually set the property.
Regardless, looks like the app script may be the item giving you grief right now.
Using the XML in replacedExpression.zip results in the same error on window open in the designer. Funny though that it doesn’t refer to color(22,22,22) in the error:
ERROR [AbstractPropertyAdapter-AWT-EventQueue-2]
java.lang.Exception: Error setting property to 'java.awt.Color[r=0,g=0,b=0]' for binding on
Answer View.Root Container.Chart Panel.SingleChart.plotBackground
at com.inductiveautomation.factorypmi.application.binding.AbstractPropertyAdapter.updateTarget(AbstractPropertyAdapter.java:329)
at com.inductiveautomation.factorypmi.application.binding.AbstractPropertyAdapter.updateValue(AbstractPropertyAdapter.java:266)
at com.inductiveautomation.factorypmi.application.binding.ExpressionPropertyAdapter.runExpression(ExpressionPropertyAdapter.java:88)
Yes! That did it. I was about to try that, but was afraid to remove so many lines. Thanks for the tip.
It would be nice to know if there is a bug, or if I introduced some circular logic of some kind to cause this (so I won’t do it again in the future).
The reason for the plotBackground binding was as a solution to the problem I encountered in this post.