orientdb icon indicating copy to clipboard operation
orientdb copied to clipboard

error in import of OFunction class record ("parameters"=null)

Open andreiusmanov opened this issue 2 years ago • 3 comments

OrientDB Version: 3.2.5

Java Version: 17

OS: mx linux 21

Expected behavior

import of all functions from OFunction class as they were created in exported database.
Please fix it so that 'parameters' property is set to [] (empty array) by default if its value = null . workaround - click Parameters button - that will create a parameter entry/ delete the parameter entry.

Actual behavior

``` 2022-03-29 09:03:30:912 INFO {db=uat_right} Starting database import [OConnectionBinaryExecutor] 2022-03-29 09:03:56:268 WARNI {db=uat_right} Falling back to legacy JSON parser due to invalid JSON. [ORecordSerializerJSON]$ANSI{green {db=uat_right}} Falling back to fromString due to non-standard JSON:

com.fasterxml.jackson.core.JsonParseException: Illegal unquoted character ((CTRL-CHAR, code 10)): has to be escaped using backslash to be included in string value at [Source: (ByteArrayInputStream); line: 1, column: 308] at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:2337) at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:710) at com.fasterxml.jackson.core.base.ParserBase._throwUnquotedSpace(ParserBase.java:1094) at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._finishString2(UTF8StreamJsonParser.java:2542) at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._finishAndReturnString(UTF8StreamJsonParser.java:2471) at com.fasterxml.jackson.core.json.UTF8StreamJsonParser.getValueAsString(UTF8StreamJsonParser.java:345) at com.orientechnologies.orient.core.serialization.serializer.record.string.ORecordSerializerJSON.processRecord(ORecordSerializerJSON.java:277) at com.orientechnologies.orient.core.serialization.serializer.record.string.ORecordSerializerJSON.fromStream(ORecordSerializerJSON.java:223) at com.orientechnologies.orient.core.serialization.serializer.record.string.ORecordSerializerJSON.fromStream(ORecordSerializerJSON.java:292) at com.orientechnologies.orient.core.db.tool.ODatabaseImport.importRecord(ODatabaseImport.java:2240) at com.orientechnologies.orient.core.db.tool.ODatabaseImport.importRecords(ODatabaseImport.java:2588) at com.orientechnologies.orient.core.db.tool.ODatabaseImport.importDatabase(ODatabaseImport.java:544) at com.orientechnologies.orient.server.OConnectionBinaryExecutor.executeImport(OConnectionBinaryExecutor.java:995) at com.orientechnologies.orient.client.remote.message.OImportRequest.execute(OImportRequest.java:88) at com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary.sessionRequest(ONetworkProtocolBinary.java:355) at com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary.execute(ONetworkProtocolBinary.java:239) at com.orientechnologies.common.thread.OSoftThread.run(OSoftThread.java:68)

2022-03-29 09:03:56:285 WARNI {db=uat_right} Broken record was detected and will be skipped [ODatabaseImport]


the reason is that during creation of function in orient studio if 'Parameter' button was never clicked the value of "parameters" property is set to null. that creates error above. the function below will work properly in original database but will never be imported due to error.

{"@type":"d","@rid":"#7:3","@version":2,"@class":"OFunction","idempotent":true,"code":"select from OFunction","name":"select_function","language":"sql","parameters":null} <- !!!!

## Steps to reproduce  
1) create function using orient studio but never touch button 'Parameters'

e.g. {"@type":"d","@rid":"#7:3","@version":2,"@class":"OFunction","idempotent":true,"code":"select from OFunction","name":"select_function","language":"sql","parameters":null}

2) export database to file
3) import from exported file
<add here>  
<An SQL script to reproduce the problem or a JUnit test case will increase **A LOT** the chance to have a quick fix>

andreiusmanov avatar Mar 29 '22 05:03 andreiusmanov

same issue here @tglman

lfen21 avatar Mar 14 '23 15:03 lfen21

Hi,

This should be resolved from 3.2.11 or 3.2.13, so I would suggest to try this again with the last hotfix.

Regards

tglman avatar Mar 14 '23 15:03 tglman

same in 3.2.17, we can export from 3.2.4 but cannot import in 3.2.17. @tglman

2023-03-14 08:57:52:949 WARNI {db=orient} Falling back to legacy JSON parser due to invalid JSON. [ORecordSerializerJSON]$ANSI{green {db=orient}} Falling back to fromString due to non-standard JSON:

com.fasterxml.jackson.core.JsonParseException: Illegal unquoted character ((CTRL-CHAR, code 10)): has to be escaped using backslash to be included in string value at [Source: (ByteArrayInputStream); line: 1, column: 1016] at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:2337) at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:710) at com.fasterxml.jackson.core.base.ParserBase._throwUnquotedSpace(ParserBase.java:1094) at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._finishString2(UTF8StreamJsonParser.java:2542) at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._finishAndReturnString(UTF8StreamJsonParser.java:2471) at com.fasterxml.jackson.core.json.UTF8StreamJsonParser.getValueAsString(UTF8StreamJsonParser.java:345) at com.orientechnologies.orient.core.serialization.serializer.record.string.ORecordSerializerJSON.processRecord(ORecordSerializerJSON.java:277) at com.orientechnologies.orient.core.serialization.serializer.record.string.ORecordSerializerJSON.fromStream(ORecordSerializerJSON.java:223) at com.orientechnologies.orient.core.serialization.serializer.record.string.ORecordSerializerJSON.fromStream(ORecordSerializerJSON.java:292) at com.orientechnologies.orient.core.db.tool.ODatabaseImport.importRecord(ODatabaseImport.java:2240) at com.orientechnologies.orient.core.db.tool.ODatabaseImport.importRecords(ODatabaseImport.java:2588) at com.orientechnologies.orient.core.db.tool.ODatabaseImport.importDatabase(ODatabaseImport.java:544) at com.orientechnologies.orient.server.OConnectionBinaryExecutor.executeImport(OConnectionBinaryExecutor.java:991) at com.orientechnologies.orient.client.remote.message.OImportRequest.execute(OImportRequest.java:88) at com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary.sessionRequest(ONetworkProtocolBinary.java:355) at com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary.execute(ONetworkProtocolBinary.java:239) at com.orientechnologies.common.thread.OSoftThread.run(OSoftThread.java:68)

lfen21 avatar Mar 20 '23 11:03 lfen21