[Bug 2324] Error in binding prevents the opening of a window in the designer

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.

1 Like

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?

Sure, just attach it here.

Uploading the 90000 lines overwhelmed my browser. Is there an email address I can send it to?

Sure, let me just PM you

1 Like

AnswerView.zip (535.2 KB)

Try this:

  1. open document in a text editor
  2. select all
  3. copy
  4. shift+right click on the window in the project browser in the designer
  5. Click “Set XML from Clipboard”

Let me know if it works for you.

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)

1 Like

The AnswerView.zip file in your reply contains XML that is identical to what I sent you. Is that what you intended?

After using it to Set XML from clipboard and then attempting to open the window results in the same error and the window does not open.

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?

Thanks. I’m really stuck here.

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.

I cannot find color(77, 77, 77) anywhere in the attached XML. Did you accidently attach the original XML?

replacedExpression.zip (383.0 KB)

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.

I’ve already tried hardcoding app.ctrl.getChartBackgroundColor() without success.

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)

I would try getting rid of that whole binding. See the line that says:
<o-c m="setPropertyName" s="1;str"><str id="481">plotBackground</str></o-c>

and then 3 lines up from there it says <o-c m="put" s="2;O;O">

delete that whole element. Should be about 35 lines.

1 Like

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.