File tree Expand file tree Collapse file tree 1 file changed +17
-8
lines changed
gateway-ha/src/main/java/io/trino/gateway/ha/router Expand file tree Collapse file tree 1 file changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -267,14 +267,23 @@ public UserInfoJsonSerializer(Class<Optional<UserInfo>> t)
267267 public void serialize (Optional <UserInfo > userInfo , JsonGenerator jsonGenerator , SerializerProvider serializerProvider )
268268 throws IOException
269269 {
270- userInfo .ifPresent (u -> {
271- try {
272- jsonGenerator .writeString (u .toJSONString ());
273- }
274- catch (IOException e ) {
275- log .error (e , "Error serializing userInfo" );
276- }
277- });
270+ userInfo .ifPresentOrElse (
271+ u -> {
272+ try {
273+ jsonGenerator .writeString (u .toJSONString ());
274+ }
275+ catch (IOException e ) {
276+ log .error (e , "Error serializing userInfo" );
277+ }
278+ },
279+ () -> {
280+ try {
281+ jsonGenerator .writeNull ();
282+ }
283+ catch (IOException e ) {
284+ log .error (e , "Error writing null for absent userInfo" );
285+ }
286+ });
278287 }
279288 }
280289}
You can’t perform that action at this time.
0 commit comments