Java Snippet error with Knime 3.3

We have recently installed Knime on a new computer. When we imported a saved workflow, some of the Java Snippets weren't processed properly and showed up blank. Trying to rebuild the Java Snippet manually, I saw that the problem could be related to a column that has the type "PNG image" for Knime. This column can no longer be used as input since I cannot assign a Java Type to it (while in version 3.2 it was set as String in the Java Snippet).

Updating Knime from 3.2 to 3.3 on another computer resulted in the same nodes being "reset" losing all the code they used to contain. Everything still works on the computers still running Knime 3.2.

Is this a bug? I didn't originally write these Java Snippets, and I don't really know how Java works aside from the minimal knowledge I need to use the workflow. I'd be grateful if anyone can advise!

Hi iliberali!

I checked and it is indeed a bug, thank you for reporting it! Sorry for the inconvenience, since this worked in an earlier version, it will be handled with high priority.

As long as you don't save over the workflow the code does not get lost (possibly not even then). Once the bug has been fixed it will show up again.

I will let you know as soon as I have an eastimate how long it will take until it will fixed.

Kind regards, Jonathan.

Hello Jonathan, thank you for your response. We have a backup copy of the workflow as well as a machine still running an older version of Knime so the code is "safe", it's just an issue of not being able to use those nodes. I appreciate you looking into fixing it.

Hi iliberali!

I took a deeper look into this and it turns out this calls .toString() on the image content, which creates a String like: "org.knime.core.data.image.png.PNGImageContent@9e502169".

Since I am unsure how this could even be useful at all, it would be amazing if you could explain how you use it. If you are not allowed or don't want to talk about this work publicly, I'd be happy if you could drop me an email: jonathan.hale@knime.com

Regards, Jonathan.

Hi,

I have also problem with java snipped node in Knime 3.3.1. Problem is the string cells. when i try to compare to two string cells. the results return strange.

İmagine a dataset like that.

   Column1   Column2     IsEqual

    'apple'         'apple'          false

    'banana'      'apple'         false

 

my java code is clearly simple

if (column1==column2)

out_IsEqual='true'

else

outIsEqual='false'

this node was working previous version. when i copy to new version this works strange. (int operators works normal)

Never ever compare strings with == in Java! This compares the references but not the actual strings. Always use equals to compare any kind of object in Java. For strings it randomly works if you compare with == because common strings are "interned" and the references may point to the same constant object.

Thanks a lot thor.