deki closed pull request #327: [CXF-7539] Provide Boolean wrapper object for ==
comparation
URL: https://github.com/apache/cxf/pull/327
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
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 c083de234a2..4f1688ca83f 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
@@ -436,6 +436,10 @@ public static Object extractFromMethod(Object
requestObject,
//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 {
// cannot us pClass.cast as the pClass is something like
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 af7a54509cc..bf7751ccc5b 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 void testMultipleQuery(@QueryParam("query") String
queryString,
@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 2db131377d1..abaf5024b46 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,12 +1472,12 @@ private void verifyParametersBean(Method m,
@Test
public void testMultipleQueryParameters() throws Exception {
Class<?>[] argType = {String.class, String.class, Long.class,
- Boolean.TYPE, char.class, String.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");
+
"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);
@@ -1487,12 +1487,14 @@ public void testMultipleQueryParameters() throws
Exception {
"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")
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services