From 4b0ccb79261997000cfaf3e7e9977485ad2b481f Mon Sep 17 00:00:00 2001 From: Jan Supol Date: Mon, 9 Nov 2020 19:10:41 +0100 Subject: [PATCH 1/2] Make JAX-B API optional Signed-off-by: Jan Supol --- connectors/jetty-connector/pom.xml | 6 + core-common/pom.xml | 5 +- .../glassfish/jersey/CommonProperties.java | 6 +- .../internal/util/ReflectionHelper.java | 10 +- .../message/internal/MessagingBinders.java | 16 +- core-server/pom.xml | 23 +-- .../jersey/server/wadl/WadlFeature.java | 14 +- .../internal/WadlApplicationContextImpl.java | 9 + examples/bookstore-webapp/pom.xml | 4 + examples/https-clientserver-grizzly/pom.xml | 4 + examples/jaxb/pom.xml | 4 + examples/json-jackson1/pom.xml | 5 +- examples/multipart-webapp/pom.xml | 4 + ext/bean-validation/pom.xml | 5 + .../server/validation/ValidationError.java | 89 +--------- .../validation/ValidationErrorData.java | 155 ++++++++++++++++++ .../ValidationErrorMessageBodyWriter.java | 20 +-- .../internal/ValidationExceptionMapper.java | 8 +- .../validation/internal/ValidationHelper.java | 10 +- ext/entity-filtering/pom.xml | 5 + ext/wadl-doclet/pom.xml | 43 +---- incubator/declarative-linking/pom.xml | 8 +- test-framework/core/pom.xml | 21 ++- tests/e2e-server/pom.xml | 5 + tests/integration/jersey-2637/pom.xml | 3 +- tests/integration/servlet-2.5-mvc-1/pom.xml | 1 - tests/integration/servlet-2.5-mvc-2/pom.xml | 3 +- tests/integration/servlet-2.5-mvc-3/pom.xml | 1 - tests/integration/servlet-tests/pom.xml | 3 +- 29 files changed, 305 insertions(+), 185 deletions(-) create mode 100644 ext/bean-validation/src/main/java/org/glassfish/jersey/server/validation/ValidationErrorData.java diff --git a/connectors/jetty-connector/pom.xml b/connectors/jetty-connector/pom.xml index e05131b83c..a701faf59f 100644 --- a/connectors/jetty-connector/pom.xml +++ b/connectors/jetty-connector/pom.xml @@ -41,6 +41,12 @@ org.eclipse.jetty jetty-client + + org.glassfish.jersey.media + jersey-media-jaxb + ${project.version} + test + org.glassfish.jersey.containers diff --git a/core-common/pom.xml b/core-common/pom.xml index 6869ea7324..c33861b9ae 100644 --- a/core-common/pom.xml +++ b/core-common/pom.xml @@ -126,7 +126,7 @@ sun.misc.*;resolution:=optional, - javax.activation.*;version="!", + javax.activation.*;version="!";resolution:=optional, ${javax.annotation.osgi.version}, * @@ -297,6 +297,8 @@ com.sun.activation jakarta.activation + provided + true @@ -686,7 +688,6 @@ - diff --git a/core-common/src/main/java/org/glassfish/jersey/CommonProperties.java b/core-common/src/main/java/org/glassfish/jersey/CommonProperties.java index b6adbcc8e9..94c54ed37d 100644 --- a/core-common/src/main/java/org/glassfish/jersey/CommonProperties.java +++ b/core-common/src/main/java/org/glassfish/jersey/CommonProperties.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2019 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2020 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 @@ -230,13 +230,15 @@ public final class CommonProperties { * Disable some of the default providers from being loaded. The following providers extend application footprint * by XML dependencies, which is too heavy for native image, or by AWT which may possibly be not available by JDK 11 desktop: *
    + *
  • javax.activation.DataSource
  • *
  • java.awt.image.RenderedImage
  • *
  • javax.xml.transform.Source
  • *
  • javax.xml.transform.dom.DOMSource
  • *
  • javax.xml.transform.sax.SAXSource
  • *
  • javax.xml.transform.stream.StreamSource
  • *
- * The following are the options to disable the provides: {@code DOMSOURCE, RENDEREDIMAGE, SAXSOURCE, SOURCE, STREAMSOURCE}, + * The following are the options to disable the provides: + * {@code DATASOURCE, DOMSOURCE, RENDEREDIMAGE, SAXSOURCE, SOURCE, STREAMSOURCE}, * or to disable all: {@code ALL}. Multiple options can be disabled by adding multiple comma separated values. * * @since 2.30 diff --git a/core-common/src/main/java/org/glassfish/jersey/internal/util/ReflectionHelper.java b/core-common/src/main/java/org/glassfish/jersey/internal/util/ReflectionHelper.java index b0a04479a8..f36c3036eb 100644 --- a/core-common/src/main/java/org/glassfish/jersey/internal/util/ReflectionHelper.java +++ b/core-common/src/main/java/org/glassfish/jersey/internal/util/ReflectionHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2019 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2020 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 @@ -1557,4 +1557,12 @@ public static Class getRawClass(Type type) { return null; } + + /** + * Returns true iff JAX-B API is available on classpath. + */ + public static boolean isJaxbAvailable() { + final Class aClass = AccessController.doPrivileged(ReflectionHelper.classForNamePA("javax.xml.bind.JAXBException")); + return aClass != null; + } } diff --git a/core-common/src/main/java/org/glassfish/jersey/message/internal/MessagingBinders.java b/core-common/src/main/java/org/glassfish/jersey/message/internal/MessagingBinders.java index c01da3d6a6..8c5e67d0e9 100644 --- a/core-common/src/main/java/org/glassfish/jersey/message/internal/MessagingBinders.java +++ b/core-common/src/main/java/org/glassfish/jersey/message/internal/MessagingBinders.java @@ -80,7 +80,7 @@ protected void configure() { // Message body providers (both readers & writers) bindSingletonWorker(ByteArrayProvider.class); - bindSingletonWorker(DataSourceProvider.class); + // bindSingletonWorker(DataSourceProvider.class); bindSingletonWorker(FileProvider.class); bindSingletonWorker(FormMultivaluedMapProvider.class); bindSingletonWorker(FormProvider.class); @@ -158,6 +158,7 @@ public Set getHeaderDelegateProviders() { private static final class EnabledProvidersBinder { private enum Provider { + DATASOURCE("javax.activation.DataSource"), DOMSOURCE("javax.xml.transform.dom.DOMSource"), RENDEREDIMAGE("java.awt.image.RenderedImage"), SAXSOURCE("javax.xml.transform.sax.SAXSource"), @@ -200,6 +201,9 @@ private void bindToBinder(AbstractBinder binder) { for (Provider provider : enabledProviders) { if (isClass(provider.className)) { switch (provider) { + case DATASOURCE: + providerBinder = new DataSourceBinder(); + break; case DOMSOURCE: providerBinder = new DomSourceBinder(); break; @@ -226,6 +230,7 @@ private void bindToBinder(AbstractBinder binder) { "MessageBodyReader<" + provider.className + ">") ); break; + case DATASOURCE: case RENDEREDIMAGE: case SOURCE: LOGGER.warning(LocalizationMessages.DEPENDENT_CLASS_OF_DEFAULT_PROVIDER_NOT_FOUND(provider.className, @@ -241,11 +246,18 @@ private static boolean isClass(String className) { return null != AccessController.doPrivileged(ReflectionHelper.classForNamePA(className)); } - private interface ProviderBinder { void bind(AbstractBinder binder, Provider provider); } + private static class DataSourceBinder implements ProviderBinder { + @Override + public void bind(AbstractBinder binder, Provider provider) { + binder.bind(DataSourceProvider.class) + .to(MessageBodyReader.class).to(MessageBodyWriter.class).in(Singleton.class); + } + } + private static class DomSourceBinder implements ProviderBinder { @Override public void bind(AbstractBinder binder, Provider provider) { diff --git a/core-server/pom.xml b/core-server/pom.xml index 277307b69d..3ae2cf4b6a 100644 --- a/core-server/pom.xml +++ b/core-server/pom.xml @@ -172,12 +172,6 @@ jakarta.ws.rs-api
- - org.glassfish.jersey.media - jersey-media-jaxb - ${project.version} - - jakarta.annotation jakarta.annotation-api @@ -198,7 +192,18 @@ org.osgi.core provided - + + jakarta.xml.bind + jakarta.xml.bind-api + provided + true + + + org.glassfish.jersey.media + jersey-media-jaxb + ${project.version} + test + junit junit @@ -232,10 +237,6 @@ [11,) - - jakarta.xml.bind - jakarta.xml.bind-api - com.sun.xml.bind jaxb-osgi diff --git a/core-server/src/main/java/org/glassfish/jersey/server/wadl/WadlFeature.java b/core-server/src/main/java/org/glassfish/jersey/server/wadl/WadlFeature.java index 1afb644dce..649a998096 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/wadl/WadlFeature.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/wadl/WadlFeature.java @@ -20,17 +20,17 @@ import javax.ws.rs.core.FeatureContext; import javax.inject.Singleton; -import javax.xml.bind.JAXBException; import org.glassfish.jersey.internal.inject.AbstractBinder; import org.glassfish.jersey.internal.util.PropertiesHelper; +import org.glassfish.jersey.internal.util.ReflectionHelper; import org.glassfish.jersey.server.ServerProperties; import org.glassfish.jersey.server.internal.LocalizationMessages; import org.glassfish.jersey.server.model.ModelProcessor; import org.glassfish.jersey.server.wadl.internal.WadlApplicationContextImpl; -import org.glassfish.jersey.server.wadl.internal.generators.WadlGeneratorJAXBGrammarGenerator; import org.glassfish.jersey.server.wadl.processor.WadlModelProcessor; +import java.security.AccessController; import java.util.logging.Logger; @@ -53,7 +53,7 @@ public boolean configure(FeatureContext context) { return false; } - if (!isJaxB()) { + if (!ReflectionHelper.isJaxbAvailable() || !WadlApplicationContextImpl.isJaxbImplAvailable()) { LOGGER.warning(LocalizationMessages.WADL_FEATURE_DISABLED()); return false; } @@ -68,12 +68,4 @@ protected void configure() { return true; } - - private static boolean isJaxB() { - try { - return null != WadlApplicationContextImpl.getJAXBContextFromWadlGenerator(new WadlGeneratorJAXBGrammarGenerator()); - } catch (JAXBException je) { - return false; - } - } } diff --git a/core-server/src/main/java/org/glassfish/jersey/server/wadl/internal/WadlApplicationContextImpl.java b/core-server/src/main/java/org/glassfish/jersey/server/wadl/internal/WadlApplicationContextImpl.java index 462edec200..9f31dd85d6 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/wadl/internal/WadlApplicationContextImpl.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/wadl/internal/WadlApplicationContextImpl.java @@ -47,6 +47,7 @@ import com.sun.research.ws.wadl.Include; import com.sun.research.ws.wadl.Resource; import com.sun.research.ws.wadl.Resources; +import org.glassfish.jersey.server.wadl.internal.generators.WadlGeneratorJAXBGrammarGenerator; /** * WADL application context implementation. @@ -263,4 +264,12 @@ private void attachExternalGrammar( throw new ProcessingException(LocalizationMessages.ERROR_WADL_EXTERNAL_GRAMMAR(), e); } } + + public static boolean isJaxbImplAvailable() { + try { + return null != WadlApplicationContextImpl.getJAXBContextFromWadlGenerator(new WadlGeneratorJAXBGrammarGenerator()); + } catch (JAXBException je) { + return false; + } + } } diff --git a/examples/bookstore-webapp/pom.xml b/examples/bookstore-webapp/pom.xml index 8ad0c6ac43..645357896b 100644 --- a/examples/bookstore-webapp/pom.xml +++ b/examples/bookstore-webapp/pom.xml @@ -63,6 +63,10 @@ jakarta.servlet.jsp.jstl-api ${jstl.version} + + jakarta.xml.bind + jakarta.xml.bind-api + diff --git a/examples/https-clientserver-grizzly/pom.xml b/examples/https-clientserver-grizzly/pom.xml index 23f41254f9..676452fbbf 100644 --- a/examples/https-clientserver-grizzly/pom.xml +++ b/examples/https-clientserver-grizzly/pom.xml @@ -49,6 +49,10 @@ org.glassfish.jersey.inject jersey-hk2 + + jakarta.xml.bind + jakarta.xml.bind-api + junit junit diff --git a/examples/jaxb/pom.xml b/examples/jaxb/pom.xml index 976c82b405..ff51f9c511 100644 --- a/examples/jaxb/pom.xml +++ b/examples/jaxb/pom.xml @@ -67,6 +67,10 @@ [11,) + + jakarta.xml.bind + jakarta.xml.bind-api + com.sun.xml.bind jaxb-osgi diff --git a/examples/json-jackson1/pom.xml b/examples/json-jackson1/pom.xml index 5f70a2ab7e..666f155d20 100644 --- a/examples/json-jackson1/pom.xml +++ b/examples/json-jackson1/pom.xml @@ -40,7 +40,10 @@ jersey-media-json-jackson1 ${project.version} - + + jakarta.xml.bind + jakarta.xml.bind-api + org.glassfish.jersey.test-framework.providers jersey-test-framework-provider-bundle diff --git a/examples/multipart-webapp/pom.xml b/examples/multipart-webapp/pom.xml index 5ba57a3110..ec0daedbcc 100644 --- a/examples/multipart-webapp/pom.xml +++ b/examples/multipart-webapp/pom.xml @@ -37,6 +37,10 @@ org.glassfish.jersey.inject jersey-hk2 + + jakarta.xml.bind + jakarta.xml.bind-api + diff --git a/ext/bean-validation/pom.xml b/ext/bean-validation/pom.xml index b33e994b73..30da28d648 100644 --- a/ext/bean-validation/pom.xml +++ b/ext/bean-validation/pom.xml @@ -97,6 +97,11 @@ + + jakarta.xml.bind + jakarta.xml.bind-api + true + javax.enterprise cdi-api diff --git a/ext/bean-validation/src/main/java/org/glassfish/jersey/server/validation/ValidationError.java b/ext/bean-validation/src/main/java/org/glassfish/jersey/server/validation/ValidationError.java index cf2f1c454f..a737399349 100644 --- a/ext/bean-validation/src/main/java/org/glassfish/jersey/server/validation/ValidationError.java +++ b/ext/bean-validation/src/main/java/org/glassfish/jersey/server/validation/ValidationError.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2020 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 @@ -25,15 +25,7 @@ */ @XmlRootElement @SuppressWarnings("UnusedDeclaration") -public final class ValidationError { - - private String message; - - private String messageTemplate; - - private String path; - - private String invalidValue; +public final class ValidationError extends ValidationErrorData { /** * Create a {@code ValidationError} instance. Constructor for JAXB providers. @@ -50,81 +42,6 @@ public ValidationError() { * @param invalidValue value that failed to pass constraints. */ public ValidationError(final String message, final String messageTemplate, final String path, final String invalidValue) { - this.message = message; - this.messageTemplate = messageTemplate; - this.path = path; - this.invalidValue = invalidValue; - } - - /** - * Return the interpolated error message for this validation error. - * - * @return the interpolated error message for this validation error. - */ - public String getMessage() { - return message; - } - - /** - * Return the interpolated error message for this validation error. - * - * @param message the interpolated error message for this validation error. - */ - public void setMessage(final String message) { - this.message = message; - } - - /** - * Return the string representation of the property path to the value. - * - * @return the string representation of the property path to the value. - */ - public String getPath() { - return path; - } - - /** - * Set the string representation of the property path to the value. - * - * @param path the string representation of the property path to the value. - */ - public void setPath(final String path) { - this.path = path; - } - - /** - * Returns the string representation of the value failing to pass the constraint. - * - * @return the value failing to pass the constraint. - */ - public String getInvalidValue() { - return invalidValue; - } - - /** - * Set the value failing to pass the constraint. - * - * @param invalidValue the value failing to pass the constraint. - */ - public void setInvalidValue(final String invalidValue) { - this.invalidValue = invalidValue; - } - - /** - * Return the non-interpolated error message for this validation error. - * - * @return the non-interpolated error message for this validation error. - */ - public String getMessageTemplate() { - return messageTemplate; - } - - /** - * Set the non-interpolated error message for this validation error. - * - * @param messageTemplate the non-interpolated error message for this validation error. - */ - public void setMessageTemplate(final String messageTemplate) { - this.messageTemplate = messageTemplate; + super(message, messageTemplate, path, invalidValue); } } diff --git a/ext/bean-validation/src/main/java/org/glassfish/jersey/server/validation/ValidationErrorData.java b/ext/bean-validation/src/main/java/org/glassfish/jersey/server/validation/ValidationErrorData.java new file mode 100644 index 0000000000..7c5d77daf1 --- /dev/null +++ b/ext/bean-validation/src/main/java/org/glassfish/jersey/server/validation/ValidationErrorData.java @@ -0,0 +1,155 @@ +/* + * Copyright (c) 20208 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 + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package org.glassfish.jersey.server.validation; + + +import org.glassfish.jersey.internal.util.ReflectionHelper; + +/** + * Validation error entity to be included in {@code Response} if JAX-B API is not available + */ +@SuppressWarnings("UnusedDeclaration") +public class ValidationErrorData { + + protected String message; + + protected String messageTemplate; + + protected String path; + + protected String invalidValue; + + /* package */ ValidationErrorData() { + } + + /** + * Create a {@code ValidationError} instance. + * + * @param message interpolated error message. + * @param messageTemplate non-interpolated error message. + * @param path property path. + * @param invalidValue value that failed to pass constraints. + */ + /* package */ + ValidationErrorData(final String message, final String messageTemplate, final String path, final String invalidValue) { + this.message = message; + this.messageTemplate = messageTemplate; + this.path = path; + this.invalidValue = invalidValue; + } + + /** + * Return the interpolated error message for this validation error. + * + * @return the interpolated error message for this validation error. + */ + public String getMessage() { + return message; + } + + /** + * Return the interpolated error message for this validation error. + * + * @param message the interpolated error message for this validation error. + */ + public void setMessage(final String message) { + this.message = message; + } + + /** + * Return the string representation of the property path to the value. + * + * @return the string representation of the property path to the value. + */ + public String getPath() { + return path; + } + + /** + * Set the string representation of the property path to the value. + * + * @param path the string representation of the property path to the value. + */ + public void setPath(final String path) { + this.path = path; + } + + /** + * Returns the string representation of the value failing to pass the constraint. + * + * @return the value failing to pass the constraint. + */ + public String getInvalidValue() { + return invalidValue; + } + + /** + * Set the value failing to pass the constraint. + * + * @param invalidValue the value failing to pass the constraint. + */ + public void setInvalidValue(final String invalidValue) { + this.invalidValue = invalidValue; + } + + /** + * Return the non-interpolated error message for this validation error. + * + * @return the non-interpolated error message for this validation error. + */ + public String getMessageTemplate() { + return messageTemplate; + } + + /** + * Set the non-interpolated error message for this validation error. + * + * @param messageTemplate the non-interpolated error message for this validation error. + */ + public void setMessageTemplate(final String messageTemplate) { + this.messageTemplate = messageTemplate; + } + + /* + * Cache the information + */ + private static Boolean isJaxbAvailable = null; + + private static boolean isJaxbAvailable() { + if (isJaxbAvailable == null) { + isJaxbAvailable = ReflectionHelper.isJaxbAvailable(); + } + return isJaxbAvailable; + } + + /** + * A factory method that creates either JAX-B annotated data if JAX-B is available or POJO data otherwise. + * @param message interpolated error message. + * @param messageTemplate non-interpolated error message. + * @param path property path. + * @param invalidValue value that failed to pass constraints. + * @return ValidationErrorData subclass or itself + */ + public static ValidationErrorData createValidationError( + final String message, final String messageTemplate, final String path, final String invalidValue) { + if (isJaxbAvailable()) { + return new ValidationError(message, messageTemplate, path, invalidValue); + } else { + return new ValidationErrorData(message, messageTemplate, path, invalidValue); + } + } +} diff --git a/ext/bean-validation/src/main/java/org/glassfish/jersey/server/validation/internal/ValidationErrorMessageBodyWriter.java b/ext/bean-validation/src/main/java/org/glassfish/jersey/server/validation/internal/ValidationErrorMessageBodyWriter.java index 84e2a00c05..4c91fc5a2b 100644 --- a/ext/bean-validation/src/main/java/org/glassfish/jersey/server/validation/internal/ValidationErrorMessageBodyWriter.java +++ b/ext/bean-validation/src/main/java/org/glassfish/jersey/server/validation/internal/ValidationErrorMessageBodyWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2019 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2020 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 @@ -30,10 +30,10 @@ import javax.ws.rs.ext.MessageBodyWriter; import org.glassfish.jersey.message.MessageUtils; -import org.glassfish.jersey.server.validation.ValidationError; +import org.glassfish.jersey.server.validation.ValidationErrorData; /** - * {@link MessageBodyWriter} providing support for (collections of) {@link ValidationError} + * {@link MessageBodyWriter} providing support for (collections of) {@link ValidationErrorData} * that is able to output instances to {@code text/plain}/{@code text/html}. * * @author Michal Gajdos @@ -49,10 +49,10 @@ public boolean isWriteable(final Class type, } private static boolean isSupportedType(final Class type, final Type genericType) { - if (ValidationError.class.isAssignableFrom(type)) { + if (ValidationErrorData.class.isAssignableFrom(type)) { return true; } else if (Collection.class.isAssignableFrom(type) && (genericType instanceof ParameterizedType)) { - return ValidationError.class + return ValidationErrorData.class .isAssignableFrom((Class) ((ParameterizedType) genericType).getActualTypeArguments()[0]); } return false; @@ -79,13 +79,13 @@ public void writeTo(final Object entity, final MediaType mediaType, final MultivaluedMap httpHeaders, final OutputStream entityStream) throws IOException, WebApplicationException { - final Collection errors; + final Collection errors; - if (entity instanceof ValidationError) { - errors = Collections.singleton((ValidationError) entity); + if (entity instanceof ValidationErrorData) { + errors = Collections.singleton((ValidationErrorData) entity); } else { //noinspection unchecked - errors = (Collection) entity; + errors = (Collection) entity; } final boolean isPlain = MediaType.TEXT_PLAIN_TYPE.getSubtype().equals(mediaType.getSubtype()); @@ -97,7 +97,7 @@ public void writeTo(final Object entity, builder.append("
"); } - for (final ValidationError error : errors) { + for (final ValidationErrorData error : errors) { if (!isPlain) { builder.append("
"); } diff --git a/ext/bean-validation/src/main/java/org/glassfish/jersey/server/validation/internal/ValidationExceptionMapper.java b/ext/bean-validation/src/main/java/org/glassfish/jersey/server/validation/internal/ValidationExceptionMapper.java index b569607a61..5e44507e4c 100644 --- a/ext/bean-validation/src/main/java/org/glassfish/jersey/server/validation/internal/ValidationExceptionMapper.java +++ b/ext/bean-validation/src/main/java/org/glassfish/jersey/server/validation/internal/ValidationExceptionMapper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2020 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 @@ -35,12 +35,12 @@ import javax.validation.ValidationException; import org.glassfish.jersey.server.ServerProperties; -import org.glassfish.jersey.server.validation.ValidationError; +import org.glassfish.jersey.server.validation.ValidationErrorData; /** * {@link ExceptionMapper} for {@link ValidationException}. *

- * If {@value ServerProperties#BV_SEND_ERROR_IN_RESPONSE} property is enabled then a list of {@link ValidationError} + * If {@value ServerProperties#BV_SEND_ERROR_IN_RESPONSE} property is enabled then a list of {@link ValidationErrorData} * instances is sent in {@link Response} as well (in addition to HTTP 400/500 status code). Supported media types are: * {@code application/json}/{@code application/xml} (in appropriate provider is registered on server) or * {@code text/html}/{@code text/plain} (via custom {@link ValidationErrorMessageBodyWriter}). @@ -85,7 +85,7 @@ public Response toResponse(final ValidationException exception) { response.entity( new GenericEntity<>( ValidationHelper.constraintViolationToValidationErrors(cve), - new GenericType>() {}.getType() + new GenericType>() {}.getType() ) ); } diff --git a/ext/bean-validation/src/main/java/org/glassfish/jersey/server/validation/internal/ValidationHelper.java b/ext/bean-validation/src/main/java/org/glassfish/jersey/server/validation/internal/ValidationHelper.java index 5e92de9b4e..0722dd4461 100644 --- a/ext/bean-validation/src/main/java/org/glassfish/jersey/server/validation/internal/ValidationHelper.java +++ b/ext/bean-validation/src/main/java/org/glassfish/jersey/server/validation/internal/ValidationHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2020 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 @@ -27,7 +27,7 @@ import javax.validation.Path; import javax.ws.rs.core.Response; -import org.glassfish.jersey.server.validation.ValidationError; +import org.glassfish.jersey.server.validation.ValidationErrorData; /** * Utility methods for Bean Validation processing. @@ -39,13 +39,13 @@ public final class ValidationHelper { /** * Extract {@link ConstraintViolation constraint violations} from given exception and transform them into a list of - * {@link ValidationError validation errors}. + * {@link ValidationErrorData validation errors}. * * @param violation exception containing constraint violations. * @return list of validation errors (not {@code null}). */ - public static List constraintViolationToValidationErrors(final ConstraintViolationException violation) { - return violation.getConstraintViolations().stream().map(violation1 -> new ValidationError( + public static List constraintViolationToValidationErrors(final ConstraintViolationException violation) { + return violation.getConstraintViolations().stream().map(violation1 -> ValidationErrorData.createValidationError( violation1.getMessage(), violation1.getMessageTemplate(), getViolationPath(violation1), diff --git a/ext/entity-filtering/pom.xml b/ext/entity-filtering/pom.xml index 60b5b986c1..bb99dad7dc 100644 --- a/ext/entity-filtering/pom.xml +++ b/ext/entity-filtering/pom.xml @@ -34,6 +34,11 @@ + + jakarta.xml.bind + jakarta.xml.bind-api + provided + org.glassfish.jersey.core jersey-client diff --git a/ext/wadl-doclet/pom.xml b/ext/wadl-doclet/pom.xml index dab9887e53..2282eef412 100644 --- a/ext/wadl-doclet/pom.xml +++ b/ext/wadl-doclet/pom.xml @@ -43,21 +43,6 @@ - - jdk1.7 - - 1.7 - - - - com.sun - tools - 1.7.0 - system - ${java.home}/../lib/tools.jar - - - jdk1.8 @@ -201,28 +186,18 @@ - - tools.jar - - - - java.vendor - Sun Microsystems Inc. - - - - - com.sun - tools - 1.6 - system - ${java.home}/../lib/tools.jar - - - + + jakarta.xml.bind + jakarta.xml.bind-api + + + org.glassfish.jersey.media + jersey-media-jaxb + ${project.version} + xerces xercesImpl diff --git a/incubator/declarative-linking/pom.xml b/incubator/declarative-linking/pom.xml index 29cc7f10bc..62a49c36ab 100644 --- a/incubator/declarative-linking/pom.xml +++ b/incubator/declarative-linking/pom.xml @@ -1,7 +1,7 @@