Skip to content

Commit

Permalink
Adopt Jackson 2.13
Browse files Browse the repository at this point in the history
Signed-off-by: jansupol <jan.supol@oracle.com>
  • Loading branch information
jansupol authored and senivam committed Dec 13, 2021
1 parent f7f4373 commit 9c8628a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ public abstract class ProviderBase<
*/
public final static String HEADER_CONTENT_TYPE_OPTIONS = "X-Content-Type-Options";

protected final static String CLASS_NAME_NO_CONTENT_EXCEPTION = "javax.ws.rs.core.NoContentException";

private final static String NO_CONTENT_MESSAGE = "No content (empty input stream)";

/**
* Looks like we need to worry about accidental
* data binding for types we shouldn't be handling. This is
Expand Down Expand Up @@ -192,9 +196,6 @@ public abstract class ProviderBase<
protected final LRUMap<AnnotationBundleKey, EP_CONFIG> _writers
= new LRUMap<AnnotationBundleKey, EP_CONFIG>(16, 120);

protected final AtomicReference<IOException> _noContentExceptionRef
= new AtomicReference<IOException>();

/*
/**********************************************************
/* Life-cycle
Expand All @@ -207,9 +208,8 @@ protected ProviderBase(MAPPER_CONFIG mconfig) {
}

/**
* Constructor that is only added to resolve
* issue #10; problems with combination of
* RESTeasy and CDI.
* Constructor that is only added to resolve [jaxrs-providers#10]; problems
* with combination of RESTeasy and CDI.
* Should NOT be used by any code explicitly; only exists
* for proxy support.
*/
Expand Down Expand Up @@ -554,9 +554,8 @@ public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotat
// negation: Boolean.TRUE means untouchable -> can not write
return !customUntouchable.booleanValue();
}
/* Ok: looks like we must weed out some core types here; ones that
* make no sense to try to bind from JSON:
*/
// Ok: looks like we must weed out some core types here; ones that
// make no sense to try to bind from JSON:
if (_isIgnorableForWriting(new ClassKey(type))) {
return false;
}
Expand Down Expand Up @@ -751,9 +750,8 @@ public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotati
// negation: Boolean.TRUE means untouchable -> can not write
return !customUntouchable.booleanValue();
}
/* Ok: looks like we must weed out some core types here; ones that
* make no sense to try to bind from JSON:
*/
// Ok: looks like we must weed out some core types here; ones that
// make no sense to try to bind from JSON:
if (_isIgnorableForReading(new ClassKey(type))) {
return false;
}
Expand Down Expand Up @@ -797,14 +795,11 @@ public Object readFrom(Class<Object> type, Type genericType, Annotation[] annota
if (JaxRSFeature.ALLOW_EMPTY_INPUT.enabledIn(_jaxRSFeatures)) {
return null;
}
/* 05-Apr-2014, tatu: Trick-ee. NoContentFoundException only available in JAX-RS 2.0...
* so need bit of obfuscated code to reach it.
*/
IOException fail = _noContentExceptionRef.get();
if (fail == null) {
fail = _createNoContentException();
}
throw fail;
// 05-Apr-2014, tatu: Trick-ee. NoContentFoundException only available in JAX-RS 2.0...
// so need bit of obfuscated code to reach it.

// 20-Jan-2021, tatu: as per [jaxrs-providers#134], simplify
throw _createNoContentException();
}
Class<?> rawType = type;
if (rawType == JsonParser.class) {
Expand Down Expand Up @@ -990,13 +985,9 @@ protected boolean _isIgnorableForWriting(ClassKey typeKey)
{
return _untouchables.contains(typeKey);
}

/**
* @since 2.4
*/
protected IOException _createNoContentException()
{
return new NoContentException("No content (empty input stream)");

protected IOException _createNoContentException() {
return new NoContentException(NO_CONTENT_MESSAGE);
}

/*
Expand Down
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.11.3", "com.fasterxml.jackson.jaxrs", "jackson-jaxrs-json-provider");
"2.13.0", "com.fasterxml.jackson.jaxrs", "jackson-jaxrs-json-provider");

@Override
public Version version() {
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2125,7 +2125,7 @@
<hk2.jvnet.osgi.version>org.jvnet.hk2.*;version="[2.5,4)"</hk2.jvnet.osgi.version>
<hk2.config.version>5.1.0</hk2.config.version>
<httpclient.version>4.5.13</httpclient.version>
<jackson.version>2.12.2</jackson.version>
<jackson.version>2.13.0</jackson.version>
<jackson1.version>1.9.13</jackson1.version>
<javassist.version>3.25.0-GA</javassist.version>
<jboss.logging.version>3.3.0.Final</jboss.logging.version>
Expand Down

0 comments on commit 9c8628a

Please sign in to comment.