not downloading a tag of Integer Array Datatype

Here’s a quick snip of what I have, and the title basically describes the problem. I have a file which I readasBytes() and then stored into this tag:

Then, when I try to dowload it again, I get this error in the logs:
Unknown data type: class [Ljava.lang.Integer;|

I don’t think the download function can serve up anything but byte[], String, or InputStream.

What approach is recommended when trying to download from a tag using that function, assuming that I am using the File Upload component function event.file.getBytes() to read the data and then write it to a memory tag. I though the integer array datatype was the appropriate format for this.

If you’re storing a file for later retrieval then I think you should be using event.file.copyTo and saving it to disk somewhere. You can later retrieve it when doing the download.

Storing it in a memory tag is bound to fail in some cases, types aside. What would happen if 2 users uploaded 2 different files? Whoever uploaded last would overwrite the value in the memory tag.

1 Like

We don’t want to store the file on the machine unless we have to. I find it interesting that when I the integer array, and then store that into the SQL database, I can retrieve it from the SQL database, and then open it with the function.

Somewhere in the many layers of code between reading the integer array and storing it into a DB it must be converted to a byte[] (BLOB column?), and then later retrieved as a byte[].

The Integer Array tag you configured stores an Integer[] and not a byte[], which shouldn’t be surprising.

So theoretically I should just change the datatype to a byte, and the upload component function event.file.getBytes() will have the data in the proper format to write it to that byte tag, and then that byte tag will be in the proper format for I can’t get this approach to work either. Datatype String doesn’t work either, but at least it does try to download.

You could try the Byte Array datatype for the memory tag.

Dang, that doesn’t seem to be working either:

Unknown data type: class [Ljava.lang.Byte;

On our side, we’re doing a strict check for a (primitive) byte[]; the tag’s datatype is Byte[] so that it can support nulls. We should probably fix it on our side, but try unboxing it before calling

from org.apache.commons.lang3 import ArrayUtils
data =
filename = "yourFile", ArrayUtils.toPrimitive(data), "file")
1 Like

This worked. Thanks a bunch.