ERROR when JSON Parsing with MS SQL Server

Description

We’ve had the task to migrate the DB from mySQL to MS SQL Server. After having invested quite some time on research of the subtle SQL dialect changes, the IdP will not work correctly in the end. Here is what happens:

  • After accepting Attribute Consent, the IdP spits out: Uncaught runtime exception javax.json.stream.JsonParsingException: Unexpected char 92 at (line no=1, column no=2, offset=1)

  • However, the Record with the accepted consent values will get saved to the database correctly, because…

  • …this does not happen upon second login, so obviously the IdP can read the consent record and skip the consent screen.

I am happy to provide the complete DEBUG log out-of-band, however, the error looks like there might be an issue with escaping the “quote” character: char 92 is the backslash, and the JSON to-be-saved-and-read starts with these characters:

[{"id":"bwidmOrgId"

Which in a database dump looks like:

[{\"id\":\"bwidmOrgId\"

Environment

IdP 4.2.1 on Ubuntu 22

Activity

Martin HitschelDecember 12, 2022 at 4:21 PM

actually today I wanted to close this, since I got feedback from the customer. We’ve tested and yes the plugin is working as intended.

One needs to ensure that the backslashes before quotes are removed before feeding the table data to the SQL Server.

Plus the table definitions and the JDBC url are quite different from mySQL as well, of course, but that is documented on the Web elsewhere.

Rod WiddowsonDecember 12, 2022 at 10:53 AM

Its been 6 weeks, so I'll close this for now.

Please do not hesitate to reopen if you think it is warranted

Rod WiddowsonSeptember 26, 2022 at 9:15 AM

So are you saying the backslash (or something else?) mariaDB creates during a dump will have produced the issue?

It seems as likely as any other.

I am currently fine with closing, but possibly will open another ticket when I’ll be able to work on this again.

I’m more than happy to leave this open if you think feel you will have more to add when you find time (a problem I fully appreciate). Ill just check in here from time to time.

Martin HitschelSeptember 26, 2022 at 6:46 AM

So are you saying the backslash (or something else?) mariaDB creates during a dump will have produced the issue? I’ve just grepped and cannot see why the dump needs to contain the backslashes before quotes \", since the quote occurs nowhere else. I think I can delete them safely in the next try.

Unfortunately I currently have real life (tm) issues slightly smiling face and will not be able to work on this during the next weeks. So I am currently fine with closing, but possibly will open another ticket when I’ll be able to work on this again.

Rod WiddowsonSeptember 24, 2022 at 4:17 PM

Sorry for the delay here - real life (tm) got in the way.

After playing with this a fair bit I cannot find any reason to not agree with Scott’s assessment

the dump process that corrupted it and this isn’t a code issue

, unless you disagree I’ll close this sometime in the next 7 days.

Incomplete

Details

Affects versions

Fix versions

Assignee

Reporter

Created August 31, 2022 at 2:01 PM
Updated September 15, 2023 at 3:13 PM
Resolved December 12, 2022 at 10:53 AM

Flag notifications