Sign In Register

How can we help you today?

Start a new topic

SparkGameDataService allows creating items with invalid names

Let's say that I create a Data type named "SimpleObjectStorage".


I can then use SparkGameDataService to create an item in it, named "SimpleObjectStorage_Test".


This name is technically invalid (in that it includes an underscore) but the API does not throw any error.


However, if I try to query for the item in the UI, I get an error:


image
Also, if I try to look up such an instance via Cloud Code, I get a nonsensical error: "java.lang.ClassCastException: com.gamesparks.scripting.data.impl.SparkDataResultImpl cannot be cast to com.gamesparks.scripting.data.SparkDataGetResult"

Now that I know what the problem is, I can work around it... but the previous hour has been quite frustrating. I would have expected to either A) be disallowed from creating the object or B) get a JavaScript-level error when reading, which I can handle.

1 Comment

Wait - thinking a bit more about it, I am no longer certain that createItem() allowed me to create objects with disallowed names. I am certain, however, that getItem() with a disallowed key results in a Java-level cast error as shown above.
Login to post a comment