Type Conversion Error Due to java.awt.Paint on Dataset Tags

There was a previous discussion on this at Can't use Color Datatype in Dataset tag anymore, error: 'Invalid DataType for Dataset.'

Version: 8.1.44
Module: Vision

According to that post it was supposed to be fixed all the way back in 8.1.15 but I am still experiencing this issue in 8.1.44 but so far only on shapes. Specifically a Union shape overlay I am using for a motor to indicator status. If I copy the dataset from say a multistate indicator this is what I get:

"#NAMES"
"state","animationIndex","animationDuration","background","border","foreground","text"
"#TYPES"
"I","I","I","clr","str","clr","str"
"#ROWS","8"
"0","0","50","color(213,213,213,255)","border(line;color(0,0,0,255);1)","color(46,46,46,255)","STOPPED"
"1","0","50","color(71,255,71,255)","border(line;color(0,0,0,255);1)","color(0,0,0,255)","RUNNING"
"2","0","1000","color(255,140,0,255)","border(line;color(0,0,0,255);1)","color(0,0,0,255)","BYPASS"
"2","1","1000","color(255,140,0,255)","border(line;color(0,0,0,255);1)","color(46,46,46,255)","MANUAL"
"3","0","500","color(222,27,27,255)","border(line;color(0,0,0,255);2)","color(0,0,0,255)","FAULT"
"3","1","1000","color(213,213,213,255)","border(line;color(0,0,0,255);2)","color(0,0,0,255)","FAULT"
"4","0","1000","color(255,255,0,255)","border(line;color(0,0,0,255);1)","color(46,46,46,255)","STANDBY"
"5","0","1000","color(71,255,255,255)","border(line;color(0,0,0,255);1)","color(46,46,46,255)","INTERLOCK"

So the color is setup as a string which works and I pasted this to a dataset tag that I use for a style binding. When I take my shape and manually setup a customized style when I copy it I get this:

"#NAMES"
"state","animationIndex","animationDuration","fillPaint"
"#TYPES"
"I","I","I","java.awt.Paint"
"#ROWS","8"
"0","0","50","color(170,170,170,51)"
"1","0","50","color(71,255,71,128)"
"2","0","1000","color(255,140,0,128)"
"2","0","1000","color(170,170,170,51)"
"3","0","500","color(255,0,0,128)"
"3","1","1000","color(213,213,213,89)"
"4","0","1000","color(255,255,0,128)"
"5","0","1000","color(71,255,255,128)"

Which gives you a type conversion error due to java.awt.Paint under #TYPES. But if you change it to clr or java.awt.Color it fixes the issue as noted here: Can't use Color Datatype in Dataset tag anymore, error: 'Invalid DataType for Dataset.' - #11 by pturmel from the forum post I linked above.

Are there any plans to change this so that users don't have to do it manually? Or is there something I am doing wrong that still causes this on certain components which in my experience has only been shapes so far.

1 Like

Hmm. This is tricky. Paint is an interface that encompasses gradients and other types of "fill region with colors" Java classes that are, fundamentally, possibly not serializable [1]. So it's not incorrect to annotate the dataset in the shape group as accepting a Paint, and it's also not incorrect to require that the value in the dataset be a concrete type like Color rather than the interface...

You're not doing anything wrong, but it's likely you'll have to continue manually working around this behavior (essentially, opting in to a more restrictive set of possible fills for shapes) for the foreseeable future.


  1. outside of Java's built in magic serialization that's a persistent security issue â†Šī¸Ž

That makes sense. It is not to much of a hassle to make the change manually. Once I create the original I apply it to a dataset tag anyways to use in future styles so it is a one and done thing. I was more so just curious if there was a way I was going about it that wrong. Glad to know that is not the case.

2 Likes