MangoAutomation / ma-modules-public

Open source Mango Automation modules
Other
19 stars 33 forks source link

Fixing issue when trying to deserialize a Blob object. #318

Closed ManuelCalvo3Pillar closed 1 year ago

ManuelCalvo3Pillar commented 1 year ago

This is for this ticket https://radixiot.atlassian.net/browse/RAD-2620. The previous code was trying to recreate a Blob object from the content of a Blob object (not the serialized Blob object). That is why when it tries to recreate it it throws this error:

com.serotonin.ShouldNeverHappenException: java.io.StreamCorruptedException: invalid stream header: 73656C65 at com.serotonin.util.SerializationHelper.readObjectInContext(SerializationHelper.java:93) ~[mango-4.3.0.jar:?]

With the change, the code can now recreate a Blob object using the content stored in the database., and now it returns the result of toString() method of the object which is this:

javax.sql.rowset.serial.SerialBlob@c1ec5370

and the value that will be shown for that column will be something like:

Serialized data (javax.sql.rowset.serial.SerialBlob@c1ec5370)

I think that makes sense because Blobs are usually meant to store large content of bytes content and not readable values.

terrypacker commented 1 year ago

@ManuelCalvo3Pillar please discuss with Pier and in the standup so everyone knows. We are now requiring that all PRs have a passing Team City build. in order for that to happen you need to either have a branch that compiles against main OR a branch with the same name as yours in all the repositories of mango-root.