Skip to content
This repository was archived by the owner on May 28, 2018. It is now read-only.

Commit 3f3719a

Browse files
author
Adam Lindenthal
committed
Upgrade hk2 to 2.4.0-b02 and fix the javax.el related dependencies
Change-Id: Icb0e6f1a9645c3e8c889c4e3c9d21c42e6f14288
1 parent 6d3342c commit 3f3719a

File tree

6 files changed

+57
-26
lines changed

6 files changed

+57
-26
lines changed

examples/shortener-webapp/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@
6666
<groupId>org.glassfish.jersey.ext</groupId>
6767
<artifactId>jersey-mvc-mustache</artifactId>
6868
</dependency>
69+
<dependency>
70+
<groupId>javax.el</groupId>
71+
<artifactId>javax.el-api</artifactId>
72+
</dependency>
6973
</dependencies>
7074

7175
<build>

ext/bean-validation/pom.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,17 @@
110110
<artifactId>hibernate-validator</artifactId>
111111
</dependency>
112112

113+
<!-- java-el related dependencies are in scope "provided" in hibernate-validator -->
114+
<dependency>
115+
<groupId>javax.el</groupId>
116+
<artifactId>javax.el-api</artifactId>
117+
</dependency>
118+
119+
<dependency>
120+
<groupId>org.glassfish.web</groupId>
121+
<artifactId>javax.el</artifactId>
122+
</dependency>
123+
113124
<dependency>
114125
<groupId>org.glassfish.jersey.test-framework.providers</groupId>
115126
<artifactId>jersey-test-framework-provider-bundle</artifactId>

ext/bean-validation/src/main/java/org/glassfish/jersey/server/validation/internal/ValidationBinder.java

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
33
*
4-
* Copyright (c) 2012-2013 Oracle and/or its affiliates. All rights reserved.
4+
* Copyright (c) 2012-2014 Oracle and/or its affiliates. All rights reserved.
55
*
66
* The contents of this file are subject to the terms of either the GNU
77
* General Public License Version 2 only ("GPL") or the Common Development
@@ -43,7 +43,10 @@
4343
import java.util.ArrayList;
4444
import java.util.List;
4545
import java.util.WeakHashMap;
46+
import java.util.logging.Level;
47+
import java.util.logging.Logger;
4648

49+
import javax.validation.ValidationException;
4750
import javax.ws.rs.container.ResourceContext;
4851
import javax.ws.rs.core.Context;
4952
import javax.ws.rs.core.MediaType;
@@ -79,6 +82,8 @@
7982
*/
8083
public class ValidationBinder extends AbstractBinder {
8184

85+
private static final Logger LOGGER = Logger.getLogger(ValidationBinder.class.getName());
86+
8287
@Override
8388
protected void configure() {
8489
bindFactory(DefaultConfigurationProvider.class, Singleton.class).to(Configuration.class).in(Singleton.class);
@@ -102,24 +107,30 @@ public DefaultConfigurationProvider() {
102107

103108
@Override
104109
public Configuration provide() {
105-
if (!inOsgi) {
106-
return Validation.byDefaultProvider().configure();
107-
} else {
108-
return Validation.
109-
byDefaultProvider().
110-
providerResolver(new ValidationProviderResolver() {
111-
@Override
112-
public List<ValidationProvider<?>> getValidationProviders() {
113-
final List<ValidationProvider<?>> validationProviders = new ArrayList<ValidationProvider<?>>();
114-
115-
for (final ValidationProvider validationProvider : ServiceFinder.find(ValidationProvider.class)) {
116-
validationProviders.add(validationProvider);
110+
try {
111+
if (!inOsgi) {
112+
return Validation.byDefaultProvider().configure();
113+
} else {
114+
return Validation.
115+
byDefaultProvider().
116+
providerResolver(new ValidationProviderResolver() {
117+
@Override
118+
public List<ValidationProvider<?>> getValidationProviders() {
119+
final List<ValidationProvider<?>> validationProviders = new ArrayList<>();
120+
121+
for (final ValidationProvider validationProvider : ServiceFinder.find(ValidationProvider.class)) {
122+
validationProviders.add(validationProvider);
123+
}
124+
125+
return validationProviders;
117126
}
118-
119-
return validationProviders;
120-
}
121-
}).
122-
configure();
127+
}).
128+
configure();
129+
}
130+
} catch (final ValidationException e) {
131+
// log and re-trow
132+
LOGGER.log(Level.FINE, LocalizationMessages.VALIDATION_EXCEPTION_PROVIDER(), e);
133+
throw e;
123134
}
124135
}
125136

@@ -187,7 +198,7 @@ private static class ConfiguredValidatorProvider implements Factory<ConfiguredVa
187198
private ConfiguredValidator defaultValidator;
188199

189200
private final WeakHashMap<ContextResolver<ValidationConfig>, ConfiguredValidator> validatorCache =
190-
new WeakHashMap<ContextResolver<ValidationConfig>, ConfiguredValidator>();
201+
new WeakHashMap<>();
191202

192203
@Override
193204
public ConfiguredValidator provide() {

ext/bean-validation/src/main/resources/org/glassfish/jersey/server/validation/internal/localization.properties

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#
22
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
33
#
4-
# Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
4+
# Copyright (c) 2013-2014 Oracle and/or its affiliates. All rights reserved.
55
#
66
# The contents of this file are subject to the terms of either the GNU
77
# General Public License Version 2 only ("GPL") or the Common Development
@@ -41,4 +41,5 @@
4141
constraint.violations.encountered=Following ConstraintViolations has been encountered.
4242
# {0} - Class#methodName, i.e. java.lang.String#intern
4343
override.check.error=Multiple ValidateOnExecution annotation definitions are hosted in the hierarchy of {0} method.
44-
validation.exception.raised=Unexpected Bean Validation problem.
44+
validation.exception.raised=Unexpected Bean Validation problem.
45+
validation.exception.provider=Failed to configure the default validation provider.

incubator/declarative-linking/pom.xml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,11 @@
7474

7575
<dependency>
7676
<groupId>javax.el</groupId>
77-
<artifactId>el-api</artifactId>
78-
<version>2.2</version>
77+
<artifactId>javax.el-api</artifactId>
7978
</dependency>
8079
<dependency>
8180
<groupId>org.glassfish.web</groupId>
82-
<artifactId>el-impl</artifactId>
83-
<version>2.2</version>
81+
<artifactId>javax.el</artifactId>
8482
</dependency>
8583
<dependency>
8684
<groupId>junit</groupId>

pom.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1313,6 +1313,11 @@
13131313
<artifactId>javax.el-api</artifactId>
13141314
<version>${javax.el.version}</version>
13151315
</dependency>
1316+
<dependency>
1317+
<groupId>org.glassfish.web</groupId>
1318+
<artifactId>javax.el</artifactId>
1319+
<version>${javax.el.impl.version}</version>
1320+
</dependency>
13161321

13171322
<dependency>
13181323
<groupId>org.glassfish</groupId>
@@ -1463,7 +1468,7 @@
14631468
<grizzly.client.version>1.8</grizzly.client.version>
14641469
<grizzly2.version>2.3.16</grizzly2.version>
14651470
<hamcrest.version>1.3</hamcrest.version>
1466-
<hk2.version>2.3.0</hk2.version>
1471+
<hk2.version>2.4.0-b02</hk2.version>
14671472
<asm.version>5.0.2</asm.version>
14681473
<httpclient.version>4.3.1</httpclient.version>
14691474
<jackson.version>2.3.2</jackson.version>
@@ -1472,6 +1477,7 @@
14721477
<javax.annotation.version>1.2</javax.annotation.version>
14731478
<javax.annotation.bundle.version>1.2</javax.annotation.bundle.version>
14741479
<javax.el.version>2.2.4</javax.el.version>
1480+
<javax.el.impl.version>2.2.4</javax.el.impl.version>
14751481
<javax.interceptor.version>1.2</javax.interceptor.version>
14761482
<javax.persistence.version>1.0</javax.persistence.version>
14771483
<jaxb.api.version>2.2.7</jaxb.api.version>

0 commit comments

Comments
 (0)