Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adopt Jackson 2.10.1 #4339

Merged
merged 3 commits into from
Feb 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* Annotation that can be used enable and/or disable various
* features for <code>ObjectReader</code>s and <code>ObjectWriter</code>s.
*/
@Target({ElementType.ANNOTATION_TYPE, ElementType.METHOD })
@Target({ElementType.ANNOTATION_TYPE, ElementType.METHOD, ElementType.PARAMETER })
@Retention(RetentionPolicy.RUNTIME)
@com.fasterxml.jackson.annotation.JacksonAnnotation
public @interface JacksonFeatures
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package org.glassfish.jersey.jackson.internal.jackson.jaxrs.base;
import com.fasterxml.jackson.databind.JsonMappingException;

import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;

import com.fasterxml.jackson.databind.JsonMappingException;

/**
* Implementation if {@link ExceptionMapper} to send down a "400 Bad Request"
* response in the event that unmappable JSON is received.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package org.glassfish.jersey.jackson.internal.jackson.jaxrs.base;
import com.fasterxml.jackson.core.JsonParseException;

import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;

import com.fasterxml.jackson.core.JsonParseException;

/**
* Implementation of {@link ExceptionMapper} to send down a "400 Bad Request"
* in the event unparsable JSON is received.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,9 @@ public abstract class ProviderBase<
// then some primitive types
DEFAULT_UNTOUCHABLES.add(new ClassKey(char[].class));

/* 27-Apr-2012, tatu: Ugh. As per
* [https://github.com/FasterXML/jackson-jaxrs-json-provider/issues/12]
* better revert this back, to make them untouchable again.
*/
// 27-Apr-2012, tatu: Ugh. As per
// [https://github.com/FasterXML/jackson-jaxrs-json-provider/issues/12]
// better revert this back, to make them untouchable again.
DEFAULT_UNTOUCHABLES.add(new ClassKey(String.class));
DEFAULT_UNTOUCHABLES.add(new ClassKey(byte[].class));
}
Expand Down Expand Up @@ -997,9 +996,7 @@ protected boolean _isIgnorableForWriting(ClassKey typeKey)
*/
protected IOException _createNoContentException()
{
// 29-Jun-2016, tatu: With Jackson 2.8 we require JAX-RS 2.0 so this
// is fine; earlier had complicated Reflection-based access
return new NoContentException("No content (empty input stream)");
return new NoContentException("No content (empty input stream)");
}

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,39 @@ private final boolean _equals(Annotation[] otherAnn)
if (otherAnn.length != len) {
return false;
}
for (int i = 0; i < len; ++i) {
if (_annotations[i] != otherAnn[i]) {

// 05-May-2019, tatu: If we wanted to true equality of contents we should
// do order-insensitive check; however, our use case is not unifying all
// possible permutations but rather trying to ensure that caching of same
// method signature is likely to match. So false negatives are acceptable
// over having to do order-insensitive comparison.

switch (len) {
default:
for (int i = 0; i < len; ++i) {
if (!_annotations[i].equals(otherAnn[i])) {
return false;
}
}
return true;

case 3:
if (!_annotations[2].equals(otherAnn[2])) {
return false;
}
// fall through
case 2:
if (!_annotations[1].equals(otherAnn[1])) {
return false;
}
// fall through
case 1:
if (!_annotations[0].equals(otherAnn[0])) {
return false;
}
// fall through
case 0:
}
return true;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@ protected EndpointConfigBase(MapperConfig<?> config) {
_config = config;
}

@Deprecated // since 2.6
protected EndpointConfigBase() {
_config = null;
}

@SuppressWarnings("unchecked")
protected THIS add(Annotation[] annotations, boolean forWriting)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,12 +231,4 @@ protected JsonEndpointConfig _configForWriting(ObjectWriter writer,
return JsonEndpointConfig.forWriting(writer, annotations,
_jsonpFunctionName);
}

/**
* @deprecated Since 2.2 use {@link #hasMatchingMediaType(MediaType)} instead
*/
@Deprecated
protected boolean isJsonType(MediaType mediaType) {
return hasMatchingMediaType(mediaType);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import org.glassfish.jersey.jackson.internal.jackson.jaxrs.cfg.EndpointConfigBase;
import org.glassfish.jersey.jackson.internal.jackson.jaxrs.json.annotation.JSONP;
import org.glassfish.jersey.jackson.internal.jackson.jaxrs.json.annotation.JacksonFeatures;

import com.fasterxml.jackson.databind.ObjectReader;
import com.fasterxml.jackson.databind.ObjectWriter;
Expand Down Expand Up @@ -61,7 +60,6 @@ public static JsonEndpointConfig forWriting(ObjectWriter writer,
/**********************************************************
*/

@SuppressWarnings("deprecation")
@Override
protected void addAnnotation(Class<? extends Annotation> type,
Annotation annotation, boolean forWriting)
Expand All @@ -70,15 +68,6 @@ protected void addAnnotation(Class<? extends Annotation> type,
if (forWriting) {
_jsonp = new JSONP.Def((JSONP) annotation);
}
} else if (type == JacksonFeatures.class) {
JacksonFeatures feats = (JacksonFeatures) annotation;
if (forWriting) {
_serEnable = nullIfEmpty(feats.serializationEnable());
_serDisable = nullIfEmpty(feats.serializationDisable());
} else {
_deserEnable = nullIfEmpty(feats.deserializationEnable());
_deserDisable = nullIfEmpty(feats.deserializationDisable());
}
} else {
super.addAnnotation(type, annotation, forWriting);
}
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.8.4", "com.fasterxml.jackson.jaxrs", "jackson-jaxrs-json-provider");
"2.10.1", "com.fasterxml.jackson.jaxrs", "jackson-jaxrs-json-provider");

@Override
public Version version() {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@
* limitations, we are only given annotations associated, and that
* has to do.
*<p>
* NOTE: not yet used by JAX-RS provider, directly, as of Jackson 2.6.
* NOTE: not yet used by JAX-RS provider, directly, as of Jackson 2.9
*/
public class EndpointAsBeanProperty
extends BeanProperty.Std
{
private static final long serialVersionUID = 1L;
public final static PropertyName ENDPOINT_NAME = new PropertyName("JAX-RS/endpoint");

private final static AnnotationMap NO_ANNOTATIONS = new AnnotationMap();
Expand All @@ -33,7 +34,7 @@ public EndpointAsBeanProperty(PropertyName name, JavaType type, Annotation[] ann
{
// TODO: find and pass wrapper; isRequired marker?
super(name, type, /*PropertyName wrapperName*/ null,
null, null, PropertyMetadata.STD_OPTIONAL);
null, PropertyMetadata.STD_OPTIONAL);
_rawAnnotations = annotations;
_annotations = null;
}
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2082,7 +2082,7 @@
<hk2.config.version>5.1.0</hk2.config.version>
<httpclient.version>4.5.9</httpclient.version>
<istack.commons.runtime.version>3.0.8</istack.commons.runtime.version>
<jackson.version>2.9.9</jackson.version>
<jackson.version>2.10.1</jackson.version>
<jackson1.version>1.9.13</jackson1.version>
<jakarta.activation.version>1.2.1</jakarta.activation.version>
<javassist.version>3.25.0-GA</javassist.version>
Expand Down
13 changes: 7 additions & 6 deletions tests/osgi/functional/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -376,12 +376,13 @@
<artifactId>jakarta.xml.bind-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.activation</groupId>
<artifactId>jakarta.activation</artifactId>
<version>${jakarta.activation.version}</version>
<scope>test</scope>
</dependency>
<!-- <dependency>-->
<!-- Not needed since Jackson 2.10.1 -->
<!-- <groupId>com.sun.activation</groupId>-->
<!-- <artifactId>jakarta.activation</artifactId>-->
<!-- <version>${jakarta.activation.version}</version>-->
<!-- <scope>test</scope>-->
<!-- </dependency>-->

<!-- logging -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,10 @@ public static List<Option> getCommonOsgiOptions(final boolean includeJerseyJaxRs
mavenBundle().groupId("org.glassfish.jersey.core").artifactId("jersey-client").versionAsInProject(),

// Jersey Injection provider
mavenBundle().groupId("org.glassfish.jersey.inject").artifactId("jersey-hk2").versionAsInProject(),
mavenBundle().groupId("org.glassfish.jersey.inject").artifactId("jersey-hk2").versionAsInProject()
// Jaxb - api
mavenBundle().groupId("com.sun.activation").artifactId("jakarta.activation").versionAsInProject()
// not needed since Jackson 2.10.1
// mavenBundle().groupId("com.sun.activation").artifactId("jakarta.activation").versionAsInProject()
));
}

Expand Down