diff --git a/NOTICE.md b/NOTICE.md index 6a4c169dd4..56231f8752 100644 --- a/NOTICE.md +++ b/NOTICE.md @@ -70,7 +70,7 @@ Javassist Version 3.30.2-GA * Project: http://www.javassist.org/ * Copyright (C) 1999- Shigeru Chiba. All Rights Reserved. -Jackson JAX-RS Providers Version 2.17.0 +Jackson JAX-RS Providers Version 2.17.1 * License: Apache License, 2.0 * Project: https://github.com/FasterXML/jackson-jaxrs-providers * Copyright: (c) 2009-2024 FasterXML, LLC. All rights reserved unless otherwise indicated. diff --git a/examples/NOTICE.md b/examples/NOTICE.md index 3e1e8f8f92..5724485fbf 100644 --- a/examples/NOTICE.md +++ b/examples/NOTICE.md @@ -66,7 +66,7 @@ Javassist Version 3.30.2-GA * Project: http://www.javassist.org/ * Copyright (C) 1999- Shigeru Chiba. All Rights Reserved. -Jackson JAX-RS Providers Version 2.17.0 +Jackson JAX-RS Providers Version 2.17.1 * License: Apache License, 2.0 * Project: https://github.com/FasterXML/jackson-jaxrs-providers * Copyright: (c) 2009-2023 FasterXML, LLC. All rights reserved unless otherwise indicated. diff --git a/media/json-jackson/src/main/java/org/glassfish/jersey/jackson/internal/jackson/jaxrs/cfg/MapperConfiguratorBase.java b/media/json-jackson/src/main/java/org/glassfish/jersey/jackson/internal/jackson/jaxrs/cfg/MapperConfiguratorBase.java index 75bc66eec7..bc280ccbfb 100644 --- a/media/json-jackson/src/main/java/org/glassfish/jersey/jackson/internal/jackson/jaxrs/cfg/MapperConfiguratorBase.java +++ b/media/json-jackson/src/main/java/org/glassfish/jersey/jackson/internal/jackson/jaxrs/cfg/MapperConfiguratorBase.java @@ -13,8 +13,8 @@ * well as accessing it. */ public abstract class MapperConfiguratorBase, - MAPPER extends ObjectMapper -> + MAPPER extends ObjectMapper + > { /** * Mapper provider was constructed with if any, or that was constructed @@ -22,7 +22,7 @@ public abstract class MapperConfiguratorBase + extends MapperConfiguratorBase { + // @since 2.17.1 + private final ReentrantLock _lock = new ReentrantLock(); + /* /********************************************************** /* Construction /********************************************************** */ - + public JsonMapperConfigurator(ObjectMapper mapper, Annotations[] defAnnotations) { super(mapper, defAnnotations); @@ -33,18 +37,24 @@ public JsonMapperConfigurator(ObjectMapper mapper, Annotations[] defAnnotations) * Method that locates, configures and returns {@link ObjectMapper} to use */ @Override - public synchronized ObjectMapper getConfiguredMapper() { - /* important: should NOT call mapper(); needs to return null - * if no instance has been passed or constructed - */ + public ObjectMapper getConfiguredMapper() { + // important: should NOT call mapper(); needs to return null + // if no instance has been passed or constructed return _mapper; } @Override - public synchronized ObjectMapper getDefaultMapper() { + public ObjectMapper getDefaultMapper() { if (_defaultMapper == null) { - _defaultMapper = new ObjectMapper(); - _setAnnotations(_defaultMapper, _defaultAnnotationsToUse); + _lock.lock(); + try { + if (_defaultMapper == null) { + _defaultMapper = new ObjectMapper(); + _setAnnotations(_defaultMapper, _defaultAnnotationsToUse); + } + } finally { + _lock.unlock(); + } } return _defaultMapper; } @@ -64,8 +74,15 @@ public synchronized ObjectMapper getDefaultMapper() { protected ObjectMapper mapper() { if (_mapper == null) { - _mapper = new ObjectMapper(); - _setAnnotations(_mapper, _defaultAnnotationsToUse); + _lock.lock(); + try { + if (_mapper == null) { + _mapper = new ObjectMapper(); + _setAnnotations(_mapper, _defaultAnnotationsToUse); + } + } finally { + _lock.unlock(); + } } return _mapper; } @@ -100,22 +117,22 @@ protected AnnotationIntrospector _resolveIntrospectors(Annotations[] annotations protected AnnotationIntrospector _resolveIntrospector(Annotations ann) { switch (ann) { - case JACKSON: - return new JacksonAnnotationIntrospector(); - case JAXB: - /* For this, need to use indirection just so that error occurs - * when we get here, and not when this class is being loaded - */ - try { - if (_jaxbIntrospectorClass == null) { - _jaxbIntrospectorClass = JaxbAnnotationIntrospector.class; + case JACKSON: + return new JacksonAnnotationIntrospector(); + case JAXB: + /* For this, need to use indirection just so that error occurs + * when we get here, and not when this class is being loaded + */ + try { + if (_jaxbIntrospectorClass == null) { + _jaxbIntrospectorClass = JaxbAnnotationIntrospector.class; + } + return _jaxbIntrospectorClass.newInstance(); + } catch (Exception e) { + throw new IllegalStateException("Failed to instantiate JaxbAnnotationIntrospector: "+e.getMessage(), e); } - return _jaxbIntrospectorClass.newInstance(); - } catch (Exception e) { - throw new IllegalStateException("Failed to instantiate JaxbAnnotationIntrospector: "+e.getMessage(), e); - } - default: - throw new IllegalStateException(); + default: + throw new IllegalStateException(); } } } diff --git a/media/json-jackson/src/main/java/org/glassfish/jersey/jackson/internal/jackson/jaxrs/json/PackageVersion.java b/media/json-jackson/src/main/java/org/glassfish/jersey/jackson/internal/jackson/jaxrs/json/PackageVersion.java index 88e31680b8..5d328da992 100644 --- a/media/json-jackson/src/main/java/org/glassfish/jersey/jackson/internal/jackson/jaxrs/json/PackageVersion.java +++ b/media/json-jackson/src/main/java/org/glassfish/jersey/jackson/internal/jackson/jaxrs/json/PackageVersion.java @@ -11,7 +11,7 @@ */ public final class PackageVersion implements Versioned { public final static Version VERSION = VersionUtil.parseVersion( - "2.17.0", "com.fasterxml.jackson.jaxrs", "jackson-jaxrs-json-provider"); + "2.17.1", "com.fasterxml.jackson.jaxrs", "jackson-jaxrs-json-provider"); @Override public Version version() { diff --git a/media/json-jackson/src/main/resources/META-INF/NOTICE.markdown b/media/json-jackson/src/main/resources/META-INF/NOTICE.markdown index 6034c04d7c..4edecfc595 100644 --- a/media/json-jackson/src/main/resources/META-INF/NOTICE.markdown +++ b/media/json-jackson/src/main/resources/META-INF/NOTICE.markdown @@ -31,7 +31,7 @@ The project maintains the following source code repositories: ## Third-party Content -Jackson JAX-RS Providers version 2.17.0 +Jackson JAX-RS Providers version 2.17.1 * License: Apache License, 2.0 * Project: https://github.com/FasterXML/jackson-jaxrs-providers * Copyright: (c) 2009-2023 FasterXML, LLC. All rights reserved unless otherwise indicated. diff --git a/pom.xml b/pom.xml index c2a22c2a70..df7d3c39c0 100644 --- a/pom.xml +++ b/pom.xml @@ -2217,7 +2217,7 @@ 2.10.0 4.5.14 5.3.1 - 2.17.0 + 2.17.1 1.9.13 3.30.2-GA 1.19.3