Fix jackson NPR assertion in JDK 17#14536
Conversation
| JvmUtils.majorVersion() >= 17 | ||
| ? "Cannot construct instance of `org.apache.druid.segment.column.ColumnSignature`, problem: Cannot invoke \"String.length()\" because \"s\" is null" | ||
| : | ||
| "Cannot construct instance of `org.apache.druid.segment.column.ColumnSignature`, problem: `java.lang.NullPointerException`" |
There was a problem hiding this comment.
Also can change this message contains to
Cannot construct instance of `org.apache.druid.segment.column.ColumnSignature
which I think would be same for all the JVM versions
There was a problem hiding this comment.
We can shorten the message as well. That will also work. I just want to highlight the fact that jackson is not bubbling up the generic NPR for jdk version >17 and giving specific root cause of the NPR exception.
0fbff5a to
a9575e5
Compare
| JvmUtils.majorVersion() >= 17 | ||
| ? "Cannot construct instance of `org.apache.druid.segment.column.ColumnSignature`, problem: Cannot invoke \"String.length()\" because \"s\" is null" | ||
| : |
There was a problem hiding this comment.
Can we change the source of the exception to do something that doesn't cause NPEs? There's no way that an end user woudl actually understand what s is and why it needs length called on it. Come to think of it, there's probably no reason to believe that they would even understand what an org.apache.druid.segment.column.ColumnSignature is...
Fixes #XXXX.
Description
fixing test in master, Looks like JsonProcessingException from jackson throws more specific assertion with reason in the case of the just null point exception. With older JDK, jackson throws generic NPR in deserialization. Adding the JDK conditional assertions.
Fixed the bug ...
Renamed the class ...
Added a forbidden-apis entry ...
Release note
Key changed/added classes in this PR
MyFooOurBarTheirBazThis PR has: