From 989c0170a26e4bbb897ffae93a990e703beca044 Mon Sep 17 00:00:00 2001 From: Tom Schindl Date: Tue, 18 May 2021 13:56:15 +0200 Subject: [PATCH 1/3] require java.xml directly so that java.desktop must not be available Signed-off-by: Tom Schindl --- src/main/java/module-info.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index 37a0cfab7..da422cfe7 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -14,6 +14,7 @@ requires jakarta.json; requires jakarta.json.bind; requires java.logging; + requires java.xml; requires static java.naming; requires static java.sql; requires static java.desktop; From 6a502e86ec221875115dac7e598de9761999bc46 Mon Sep 17 00:00:00 2001 From: Tom Schindl Date: Wed, 9 Jun 2021 11:47:00 +0200 Subject: [PATCH 2/3] require javax.xml as static/optional dependency and fix copyright Signed-off-by: Tom Schindl --- src/main/java/module-info.java | 4 ++-- .../yasson/internal/serializer/DefaultSerializers.java | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index da422cfe7..9abbd12f6 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2021 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at @@ -14,7 +14,7 @@ requires jakarta.json; requires jakarta.json.bind; requires java.logging; - requires java.xml; + requires static java.xml; requires static java.naming; requires static java.sql; requires static java.desktop; diff --git a/src/main/java/org/eclipse/yasson/internal/serializer/DefaultSerializers.java b/src/main/java/org/eclipse/yasson/internal/serializer/DefaultSerializers.java index 86876dede..238ead245 100644 --- a/src/main/java/org/eclipse/yasson/internal/serializer/DefaultSerializers.java +++ b/src/main/java/org/eclipse/yasson/internal/serializer/DefaultSerializers.java @@ -142,9 +142,11 @@ private static Map, SerializerProviderWrapper> initSerializers() { new SerializerProviderWrapper(BigDecimalTypeSerializer::new, BigDecimalTypeDeserializer::new)); serializers.put(ZoneOffset.class, new SerializerProviderWrapper(ZoneOffsetTypeSerializer::new, ZoneOffsetTypeDeserializer::new)); - serializers.put(XMLGregorianCalendar.class, - new SerializerProviderWrapper(XMLGregorianCalendarTypeSerializer::new, - XMLGregorianCalendarTypeDeserializer::new)); + if(isClassAvailable("javax.xml.datatype.XMLGregorianCalendar")) { + serializers.put(XMLGregorianCalendar.class, + new SerializerProviderWrapper(XMLGregorianCalendarTypeSerializer::new, + XMLGregorianCalendarTypeDeserializer::new)); + } serializers.put(YearMonth.class, new SerializerProviderWrapper(YearMonthTypeSerializer::new, YearMonthTypeDeserializer::new)); serializers.put(MonthDay.class, From 0b6d72e9d6362105401f8666b694877cbbfcae62 Mon Sep 17 00:00:00 2001 From: Tom Schindl Date: Wed, 9 Jun 2021 12:06:30 +0200 Subject: [PATCH 3/3] fixed checkstyle issues --- .../yasson/internal/serializer/DefaultSerializers.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/eclipse/yasson/internal/serializer/DefaultSerializers.java b/src/main/java/org/eclipse/yasson/internal/serializer/DefaultSerializers.java index 238ead245..5d08e79e0 100644 --- a/src/main/java/org/eclipse/yasson/internal/serializer/DefaultSerializers.java +++ b/src/main/java/org/eclipse/yasson/internal/serializer/DefaultSerializers.java @@ -142,11 +142,13 @@ private static Map, SerializerProviderWrapper> initSerializers() { new SerializerProviderWrapper(BigDecimalTypeSerializer::new, BigDecimalTypeDeserializer::new)); serializers.put(ZoneOffset.class, new SerializerProviderWrapper(ZoneOffsetTypeSerializer::new, ZoneOffsetTypeDeserializer::new)); - if(isClassAvailable("javax.xml.datatype.XMLGregorianCalendar")) { + + if (isClassAvailable("javax.xml.datatype.XMLGregorianCalendar")) { serializers.put(XMLGregorianCalendar.class, new SerializerProviderWrapper(XMLGregorianCalendarTypeSerializer::new, - XMLGregorianCalendarTypeDeserializer::new)); + XMLGregorianCalendarTypeDeserializer::new)); } + serializers.put(YearMonth.class, new SerializerProviderWrapper(YearMonthTypeSerializer::new, YearMonthTypeDeserializer::new)); serializers.put(MonthDay.class,