From 163a806969bfd9fa2e9394a5d2e35f55f35245ee Mon Sep 17 00:00:00 2001 From: tvallin Date: Mon, 18 Sep 2023 13:40:48 +0200 Subject: [PATCH] backport changes from 4.x Signed-off-by: tvallin --- .../io/helidon/openapi/OpenAPISupport.java | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/openapi/src/main/java/io/helidon/openapi/OpenAPISupport.java b/openapi/src/main/java/io/helidon/openapi/OpenAPISupport.java index 5738e495bdc..401955c4c6e 100644 --- a/openapi/src/main/java/io/helidon/openapi/OpenAPISupport.java +++ b/openapi/src/main/java/io/helidon/openapi/OpenAPISupport.java @@ -562,12 +562,6 @@ private static class HelidonAnnotationScannerExtension implements AnnotationScan @Override public Object parseValue(String value) { - return parseExtension(null, value); - } - - @Override - public Object parseExtension(String key, String value) { - // Inspired by SmallRye's JsonUtil#parseValue method. if (value == null) { return null; @@ -599,10 +593,9 @@ public Object parseExtension(String key, String value) { JsonValue jsonValue = reader.readValue(); return convertJsonValue(jsonValue); } catch (Exception ex) { - LOGGER.log(Level.SEVERE, String.format("Error parsing extension key: %s, value: %s", key, value), ex); + LOGGER.log(Level.SEVERE, String.format("Error parsing value: %s", value), ex); + throw ex; } - break; - default: break; } @@ -611,6 +604,18 @@ public Object parseExtension(String key, String value) { return value; } + @Override + public Object parseExtension(String key, String value) { + try { + return parseValue(value); + } catch (Exception ex) { + LOGGER.log(Level.SEVERE, + String.format("Error parsing extension key: %s, value: %s", key, value), + ex); + return null; + } + } + private static Object convertJsonValue(JsonValue jsonValue) { switch (jsonValue.getValueType()) { case ARRAY: