You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by de...@apache.org on 2017/09/07 09:37:54 UTC
[1/2] cxf git commit: [CXF-7473] simplified code
Repository: cxf
Updated Branches:
refs/heads/master 1eedb232f -> e47f445ba
[CXF-7473] simplified code
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/49a1c646
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/49a1c646
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/49a1c646
Branch: refs/heads/master
Commit: 49a1c64647c042b3bde735160734a443f4806315
Parents: 1eedb23
Author: Dennis Kieselhorst <de...@apache.org>
Authored: Thu Sep 7 11:37:05 2017 +0200
Committer: Dennis Kieselhorst <de...@apache.org>
Committed: Thu Sep 7 11:37:05 2017 +0200
----------------------------------------------------------------------
.../org/apache/cxf/jaxrs/provider/ProviderFactory.java | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/49a1c646/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
index e21b5c1..9450f8e 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
@@ -292,7 +292,7 @@ public abstract class ProviderFactory {
boolean injectContext) {
Class<?> mapperClass = ClassHelper.getRealClass(bus, em.getProvider());
- Type[] types = null;
+ Type[] types;
if (m != null && MessageUtils.getContextualBoolean(m, IGNORE_TYPE_VARIABLES)) {
types = new Type[]{mapperClass};
} else {
@@ -302,14 +302,13 @@ public abstract class ProviderFactory {
if (t instanceof ParameterizedType) {
ParameterizedType pt = (ParameterizedType)t;
Type[] args = pt.getActualTypeArguments();
- for (int i = 0; i < args.length; i++) {
- Type arg = args[i];
+ for (Type arg : args) {
if (arg instanceof TypeVariable) {
- TypeVariable<?> var = (TypeVariable<?>)arg;
+ TypeVariable<?> var = (TypeVariable<?>) arg;
Type[] bounds = var.getBounds();
boolean isResolved = false;
- for (int j = 0; j < bounds.length; j++) {
- Class<?> cls = InjectionUtils.getRawType(bounds[j]);
+ for (Type bound : bounds) {
+ Class<?> cls = InjectionUtils.getRawType(bound);
if (cls != null && (cls == Object.class || cls.isAssignableFrom(expectedType))) {
isResolved = true;
break;
[2/2] cxf git commit: [CXF-7473] added more testcases
Posted by de...@apache.org.
[CXF-7473] added more testcases
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/e47f445b
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/e47f445b
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/e47f445b
Branch: refs/heads/master
Commit: e47f445bacdca72c86b0aa26c152841f0a37f36e
Parents: 49a1c64
Author: Dennis Kieselhorst <de...@apache.org>
Authored: Thu Sep 7 11:37:48 2017 +0200
Committer: Dennis Kieselhorst <de...@apache.org>
Committed: Thu Sep 7 11:37:48 2017 +0200
----------------------------------------------------------------------
...rFactoryHierarchicalExceptionMapperTest.java | 26 ++++++++++++++++----
1 file changed, 21 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/e47f445b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ProviderFactoryHierarchicalExceptionMapperTest.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ProviderFactoryHierarchicalExceptionMapperTest.java b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ProviderFactoryHierarchicalExceptionMapperTest.java
index 2b66732..db122b7 100644
--- a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ProviderFactoryHierarchicalExceptionMapperTest.java
+++ b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ProviderFactoryHierarchicalExceptionMapperTest.java
@@ -31,7 +31,6 @@ import org.junit.Test;
/**
* Testcase for CXF-7473
*/
-@Ignore("To be fixed in CXF-7473")
public class ProviderFactoryHierarchicalExceptionMapperTest {
private ServerProviderFactory pf;
@@ -43,12 +42,29 @@ public class ProviderFactoryHierarchicalExceptionMapperTest {
}
@Test
- public void testNearestSuperclassMatch() {
+ public void testExceptionMapperInHierarchy() {
+ ExceptionMapper<?> exceptionMapper = pf.createExceptionMapper(IllegalArgumentException.class,
+ new MessageImpl());
+ Assert.assertNotNull(exceptionMapper);
+ Assert.assertEquals("Wrong mapper found for IllegalArgumentException",
+ IllegalArgumentExceptionMapper.class, exceptionMapper.getClass());
+ }
+
+ @Test
+ public void testSimpleExceptionMapperWhenHierarchyPresent() {
+ ExceptionMapper<?> exceptionMapper = pf.createExceptionMapper(IllegalStateException.class,
+ new MessageImpl());
+ Assert.assertNotNull(exceptionMapper);
+ Assert.assertEquals("Wrong mapper found for IllegalStateException",
+ IllegalStateExceptionMapper.class, exceptionMapper.getClass());
+ }
+
+ @Ignore("To be fixed in CXF-7473")
+ @Test
+ public void testNoMatch() {
ExceptionMapper<?> exceptionMapper = pf.createExceptionMapper(UnmappedRuntimeException.class,
new MessageImpl());
- Assert.assertNotEquals("Wrong mapper found for UnmappedRuntimeException",
- IllegalArgumentExceptionMapper.class,
- exceptionMapper.getClass());
+ Assert.assertNull(exceptionMapper);
}
public abstract class AbstractExceptionMapper<E extends Throwable> implements ExceptionMapper<E> {