Skip to content

Commit

Permalink
update Jackson to 2.17.1
Browse files Browse the repository at this point in the history
Signed-off-by: Maxim Nesen <[email protected]>
  • Loading branch information
senivam committed May 31, 2024
1 parent 63506be commit 2ee39d5
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 46 deletions.
2 changes: 1 addition & 1 deletion NOTICE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion examples/NOTICE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,31 @@
* well as accessing it.
*/
public abstract class MapperConfiguratorBase<IMPL extends MapperConfiguratorBase<IMPL,MAPPER>,
MAPPER extends ObjectMapper
>
MAPPER extends ObjectMapper
>
{
/**
* Mapper provider was constructed with if any, or that was constructed
* due to a call to explicitly configure mapper.
* If defined (explicitly or implicitly) it will be used, instead
* of using provider-based lookup.
*/
protected MAPPER _mapper;
protected volatile MAPPER _mapper;

/**
* If no mapper was specified when constructed, and no configuration
* calls are made, a default mapper is constructed. The difference
* between default mapper and regular one is that default mapper
* is only used if no mapper is found via provider lookup.
*/
protected MAPPER _defaultMapper;
protected volatile MAPPER _defaultMapper;

/**
* Annotations set to use by default; overridden by explicit call
* to {@link #setAnnotationsToUse}
* to {@link #setAnnotationsToUse}. Marked final in v2.17.1.
*/
protected Annotations[] _defaultAnnotationsToUse;
protected final Annotations[] _defaultAnnotationsToUse;

/**
* To support optional dependency to Jackson JAXB annotations module
* (needed iff JAXB annotations are used for configuration)
Expand All @@ -49,7 +49,7 @@ public abstract class MapperConfiguratorBase<IMPL extends MapperConfiguratorBase
/* Construction
/**********************************************************
*/

public MapperConfiguratorBase(MAPPER mapper, Annotations[] defaultAnnotations)
{
_mapper = mapper;
Expand All @@ -61,7 +61,7 @@ public MapperConfiguratorBase(MAPPER mapper, Annotations[] defaultAnnotations)
/* Abstract methods to implement
/***********************************************************
*/

/**
* Method that locates, configures and returns {@link ObjectMapper} to use
*/
Expand All @@ -84,27 +84,27 @@ public MapperConfiguratorBase(MAPPER mapper, Annotations[] defaultAnnotations)
/***********************************************************
*/

public synchronized final void setMapper(MAPPER m) {
public final void setMapper(MAPPER m) {
_mapper = m;
}

public synchronized final void setAnnotationsToUse(Annotations[] annotationsToUse) {
public final void setAnnotationsToUse(Annotations[] annotationsToUse) {
_setAnnotations(mapper(), annotationsToUse);
}

public synchronized final void configure(DeserializationFeature f, boolean state) {
public final void configure(DeserializationFeature f, boolean state) {
mapper().configure(f, state);
}

public synchronized final void configure(SerializationFeature f, boolean state) {
public final void configure(SerializationFeature f, boolean state) {
mapper().configure(f, state);
}

public synchronized final void configure(JsonParser.Feature f, boolean state) {
public final void configure(JsonParser.Feature f, boolean state) {
mapper().configure(f, state);
}

public synchronized final void configure(JsonGenerator.Feature f, boolean state) {
public final void configure(JsonGenerator.Feature f, boolean state) {
mapper().configure(f, state);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.glassfish.jersey.jackson.internal.jackson.jaxrs.json;

import java.util.ArrayList;
import java.util.concurrent.locks.ReentrantLock;

import org.glassfish.jersey.jackson.internal.jackson.jaxrs.cfg.Annotations;
import org.glassfish.jersey.jackson.internal.jackson.jaxrs.cfg.MapperConfiguratorBase;
Expand All @@ -16,14 +17,17 @@
* well as accessing it.
*/
public class JsonMapperConfigurator
extends MapperConfiguratorBase<JsonMapperConfigurator, ObjectMapper>
extends MapperConfiguratorBase<JsonMapperConfigurator, ObjectMapper>
{
// @since 2.17.1
private final ReentrantLock _lock = new ReentrantLock();

/*
/**********************************************************
/* Construction
/**********************************************************
*/

public JsonMapperConfigurator(ObjectMapper mapper, Annotations[] defAnnotations)
{
super(mapper, defAnnotations);
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -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();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2217,7 +2217,7 @@
<xmlunit.version>2.10.0</xmlunit.version>
<httpclient.version>4.5.14</httpclient.version>
<httpclient5.version>5.3.1</httpclient5.version>
<jackson.version>2.17.0</jackson.version>
<jackson.version>2.17.1</jackson.version>
<jackson1.version>1.9.13</jackson1.version>
<javassist.version>3.30.2-GA</javassist.version>
<jersey1.version>1.19.3</jersey1.version>
Expand Down

0 comments on commit 2ee39d5

Please sign in to comment.