You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2017/10/25 09:36:30 UTC
[cxf] branch 3.1.x-fixes updated: [CXF-7539] Provide Boolean
wrapper object for == comparation
This is an automated email from the ASF dual-hosted git repository.
sergeyb pushed a commit to branch 3.1.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git
The following commit(s) were added to refs/heads/3.1.x-fixes by this push:
new d17597d [CXF-7539] Provide Boolean wrapper object for == comparation
d17597d is described below
commit d17597dfc9e291173ee18935da2c1d6239e3a9a0
Author: Dennis Kieselhorst <ma...@dekies.de>
AuthorDate: Tue Oct 24 22:01:18 2017 +0200
[CXF-7539] Provide Boolean wrapper object for == comparation
---
.../org/apache/cxf/jaxrs/utils/InjectionUtils.java | 4 ++++
.../src/test/java/org/apache/cxf/jaxrs/Customer.java | 3 ++-
.../org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java | 18 ++++++++++--------
3 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
index 73b3e56..29f3966 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
@@ -411,6 +411,10 @@ public final class InjectionUtils {
//pass empty string to boxed number type will result in 404
return null;
}
+ if (Boolean.class == pClass) {
+ // allow == checks for Boolean object
+ pClass = (Class<T>) Boolean.TYPE;
+ }
if (pClass.isPrimitive()) {
try {
T ret = (T)PrimitiveUtils.read(value, pClass);
diff --git a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/Customer.java b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/Customer.java
index 4d742ba..9f23023 100644
--- a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/Customer.java
+++ b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/Customer.java
@@ -409,7 +409,8 @@ public class Customer extends AbstractCustomer implements CustomerInfo {
@QueryParam("query3") Long queryString3,
@QueryParam("query4") boolean queryBoolean4,
@QueryParam("query5") char queryChar5,
- @QueryParam("query6") String queryString6) {
+ @QueryParam("query6") String queryString6,
+ @QueryParam("query7") Boolean queryString7) {
// complete
}
diff --git a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java
index 008fff9..1a5a6ea 100644
--- a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java
+++ b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java
@@ -1472,15 +1472,15 @@ public class JAXRSUtilsTest extends Assert {
@Test
public void testMultipleQueryParameters() throws Exception {
- Class<?>[] argType = {String.class, String.class, Long.class,
- Boolean.TYPE, char.class, String.class};
+ Class<?>[] argType = {String.class, String.class, Long.class,
+ Boolean.TYPE, char.class, String.class, Boolean.class};
Method m = Customer.class.getMethod("testMultipleQuery", argType);
Message messageImpl = createMessage();
-
- messageImpl.put(Message.QUERY_STRING,
- "query=first&query2=second&query3=3&query4=true&query6");
- List<Object> params = JAXRSUtils.processParameters(new OperationResourceInfo(m,
- new ClassResourceInfo(Customer.class)),
+
+ messageImpl.put(Message.QUERY_STRING,
+ "query=first&query2=second&query3=3&query4=true&query6&query7=true");
+ List<Object> params = JAXRSUtils.processParameters(new OperationResourceInfo(m,
+ new ClassResourceInfo(Customer.class)),
null, messageImpl);
assertEquals("First Query Parameter of multiple was not matched correctly", "first",
params.get(0));
@@ -1488,12 +1488,14 @@ public class JAXRSUtilsTest extends Assert {
"second", params.get(1));
assertEquals("Third Query Parameter of multiple was not matched correctly",
new Long(3), params.get(2));
- assertEquals("Fourth Query Parameter of multiple was not matched correctly",
+ assertSame("Fourth Query Parameter of multiple was not matched correctly",
Boolean.TRUE, params.get(3));
assertEquals("Fifth Query Parameter of multiple was not matched correctly",
'\u0000', params.get(4));
assertEquals("Six Query Parameter of multiple was not matched correctly",
"", params.get(5));
+ assertSame("Seventh Query Parameter of multiple was not matched correctly",
+ Boolean.TRUE, params.get(6));
}
@SuppressWarnings("unchecked")
--
To stop receiving notification emails like this one, please contact
['"commits@cxf.apache.org" <co...@cxf.apache.org>'].