typhon-project / typhonql

Typhon Query Language
Eclipse Public License 2.0
4 stars 1 forks source link

[bug] error when trying to insert blob to mariadb entity via API #112

Closed CloudEntry closed 3 years ago

CloudEntry commented 3 years ago

error when trying to parse insert request to insert records with a blob field.

Caused by: java.lang.NullPointerException at java.io.ByteArrayInputStream.(ByteArrayInputStream.java:106) ~[?:1.8.0_275] at engineering.swat.typhonql.server.QLRestServer$Base64Deserializer.deserialize(QLRestServer.java:245) ~[classes/:?] at engineering.swat.typhonql.server.QLRestServer$Base64Deserializer.deserialize(QLRestServer.java:236) ~[classes/:?] at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:138) ~[jackson-databind-2.10.1.jar:2.10.1] at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288) ~[jackson-databind-2.10.1.jar:2.10.1] at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151) ~[jackson-databind-2.10.1.jar:2.10.1] at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4202) ~[jackson-databind-2.10.1.jar:2.10.1] at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3226) ~[jackson-databind-2.10.1.jar:2.10.1] at engineering.swat.typhonql.server.QLRestServer$RestArguments.parse(QLRestServer.java:197) ~[classes/:?]

DavyLandman commented 3 years ago

could you just to be sure share the json you send to the server?

CloudEntry commented 3 years ago

yes, so I got the same issue with the parameterized version:

{ 'query': 'insert IMG_DATA {granule:??granule, img_data_blob:??img_data_blob, mtd_msi:??mtd_msi}', 'parameterNames': ['granule', 'img_data_blob', 'mtd_msi'], 'parameterTypes': ['string', 'blob', 'uuid'], 'boundRows': [['granule', '#blob:5d3f2f95-cc3b-4e90-a7c8-7a28c4dac418', '5d3f2f95-cc3b-4e90-a7c8-7a28c4dac418']], 'blobs': {'5d3f2f95-cc3b-4e90-a7c8-7a28c4dac418': 'AAAADGpQICANCg=='} }

and inline version:

{ "query": "insert IMG_DATA { granule : \"granule\", img_data_blob : #blob:5d3f2f95-cc3b-4e90-a7c8-7a28c4dac418 , mtd_msi : \"5d3f2f95-cc3b-4e90-a7c8-7a28c4dac418\" }", "blobs": {"5d3f2f95-cc3b-4e90-a7c8-7a28c4dac418": "AAAADGpQICANCg=="} }

DavyLandman commented 3 years ago

The inline version is missing escapes around the quotes inside the query ;)

CloudEntry commented 3 years ago

That's github removing the backslash (for some reason..), sorry I didn't notice

DavyLandman commented 3 years ago

Next time, try a code block (3 back-ticks). but good to know that wasn't causing it.