IndexOutOfBoundsException in PathImpl

Description

I'm usign Hibernate validator 6.0.14. I'm getting a IndexOutOfBoundsException in my application using Spring Boot 2, Spring Data REST.
Probably the bug comes from Spring but, PathImpl method

raises a IndexOutOfBoundsException.

Debugging I see the nodeList is empty and of course when you do

the exception is raised.

This is your source code just to point out better where the problem is (line 373 in HV 6.0.14):

This is the stack trace of the exception:

I opened a bug in Spring Data REST (https://jira.spring.io/projects/DATAREST/issues/DATAREST-1342) as well.

Environment

None

Activity

Show:
Guillaume Smet
February 11, 2019, 7:41 AM

Could you paste the stack trace here too?

From what I can see, the issue is that Spring tries to serialize the PathImpl in JSON whereas it's not really designed to allow that.

I suppose one possibility to work around the issue would be to register a specific Jackson serializer for PathImpl. There must be a way to do that in Spring.

Daniele Renda
February 11, 2019, 2:59 PM

Thanks for your reply. I'm sure your are right. I opened a bug here for completeness. I'll try the workaround you suggested. Oliver Drotbohm from Spring already asked me for more info though.

Thanks

Guillaume Smet
February 17, 2019, 4:43 PM

I will rename getPathWithoutLeafNode to createCopyWithoutLeafNode. It's definitely not a getter so it's better to not have a getter name.

Guillaume Smet
February 17, 2019, 4:46 PM

That won't solve your issue though as some getters of NodeImpl will fail as they should only be used for certain types.

PathImpl and NodeImpl are definitely not designed to be serialized by Jackson.

Daniele Renda
February 18, 2019, 10:55 AM

Thanks for your support

Fixed

Assignee

Guillaume Smet

Reporter

Daniele Renda

Labels

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Suitable for new contributors

None

backportDecision

None

backportReEvaluate

None

Components

Fix versions

Affects versions

Priority

Major
Configure