You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2018/04/19 13:38:40 UTC
[cxf] 09/09: Using .valueOf() for Short + Byte as well
This is an automated email from the ASF dual-hosted git repository.
coheigea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git
commit 278d9185150d743ff4b411d070b023e8758d372e
Author: Colm O hEigeartaigh <co...@apache.org>
AuthorDate: Thu Apr 19 13:23:03 2018 +0100
Using .valueOf() for Short + Byte as well
---
.../corba/runtime/CorbaObjectReaderTest.java | 2 +-
.../corba/runtime/CorbaObjectWriterTest.java | 2 +-
.../corba/types/CorbaPrimitiveHandlerTest.java | 10 ++++-----
.../org/apache/cxf/aegis/type/basic/BeanTest.java | 4 ++--
.../org/apache/cxf/systest/jaxrs/BookServer.java | 2 +-
.../systest/type_test/AbstractTypeTestClient2.java | 24 +++++++++++-----------
6 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/runtime/CorbaObjectReaderTest.java b/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/runtime/CorbaObjectReaderTest.java
index a36dbf0..f72c92c 100644
--- a/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/runtime/CorbaObjectReaderTest.java
+++ b/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/runtime/CorbaObjectReaderTest.java
@@ -446,7 +446,7 @@ public class CorbaObjectReaderTest extends Assert {
reader.readException(obj);
List<CorbaObjectHandler> nestedObjs = obj.getMembers();
- assertTrue(new Short(((CorbaPrimitiveHandler)nestedObjs.get(0))
+ assertTrue(Short.valueOf(((CorbaPrimitiveHandler)nestedObjs.get(0))
.getDataFromValue()).shortValue() == code);
assertTrue(((CorbaPrimitiveHandler)nestedObjs.get(1)).getDataFromValue().equals(message));
}
diff --git a/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/runtime/CorbaObjectWriterTest.java b/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/runtime/CorbaObjectWriterTest.java
index d77dc32..0cb0fbf 100644
--- a/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/runtime/CorbaObjectWriterTest.java
+++ b/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/runtime/CorbaObjectWriterTest.java
@@ -118,7 +118,7 @@ public class CorbaObjectWriterTest extends Assert {
OutputStream oStream = orb.create_output_stream();
CorbaObjectWriter writer = new CorbaObjectWriter(oStream);
- Short shortValue = new Short((short)-123);
+ Short shortValue = Short.valueOf((short)-123);
writer.writeShort(shortValue);
InputStream iStream = oStream.create_input_stream();
diff --git a/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/types/CorbaPrimitiveHandlerTest.java b/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/types/CorbaPrimitiveHandlerTest.java
index b17bff4..16603a9 100644
--- a/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/types/CorbaPrimitiveHandlerTest.java
+++ b/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/types/CorbaPrimitiveHandlerTest.java
@@ -84,10 +84,10 @@ public class CorbaPrimitiveHandlerTest extends Assert {
assertNotNull(obj);
//CXF corba maps the XML char type to a Byte so we need to provide the string data as a Byte value
- Byte byteValue = new Byte((byte)val.charValue());
+ Byte byteValue = Byte.valueOf((byte)val.charValue());
obj.setValueFromData(byteValue.toString());
String result = obj.getDataFromValue();
- Byte byteResult = new Byte(result);
+ Byte byteResult = Byte.valueOf(result);
assertTrue(byteResult.byteValue() == byteValue.byteValue());
// However, internally, we also hold the data as a character to make it easier to marshal the data
@@ -125,7 +125,7 @@ public class CorbaPrimitiveHandlerTest extends Assert {
@Test
public void testCreateCorbaOctet() {
- Byte val = new Byte((byte)100);
+ Byte val = Byte.valueOf((byte)100);
CorbaPrimitiveHandler obj =
new CorbaPrimitiveHandler(new QName("octet"),
CorbaConstants.NT_CORBA_OCTET,
@@ -147,7 +147,7 @@ public class CorbaPrimitiveHandlerTest extends Assert {
@Test
public void testCreateCorbaShort() {
- Short val = new Short((short)1234);
+ Short val = Short.valueOf((short)1234);
CorbaPrimitiveHandler obj =
new CorbaPrimitiveHandler(new QName("short"),
CorbaConstants.NT_CORBA_SHORT,
@@ -169,7 +169,7 @@ public class CorbaPrimitiveHandlerTest extends Assert {
@Test
public void testCreateCorbaUShort() {
- Short val = new Short((short)4321);
+ Short val = Short.valueOf((short)4321);
CorbaPrimitiveHandler obj =
new CorbaPrimitiveHandler(new QName("ushort"),
CorbaConstants.NT_CORBA_USHORT,
diff --git a/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/basic/BeanTest.java b/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/basic/BeanTest.java
index b03a0af..f0eddcb 100644
--- a/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/basic/BeanTest.java
+++ b/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/basic/BeanTest.java
@@ -488,10 +488,10 @@ public class BeanTest extends AbstractAegisTest {
assertTrue(bigByteOk);
SimpleBean bean = new SimpleBean();
- bean.setBigByte(new Byte((byte)0xfe));
+ bean.setBigByte(Byte.valueOf((byte)0xfe));
bean.setLittleByte((byte)0xfd);
Element element = writeObjectToElement(type, bean, getContext());
- Byte bb = new Byte((byte)0xfe);
+ Byte bb = Byte.valueOf((byte)0xfe);
String bbs = bb.toString();
assertValid("/b:root/bz:bigByte[text()='" + bbs + "']", element);
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookServer.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookServer.java
index 5e9e1fb..66417ad 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookServer.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookServer.java
@@ -296,7 +296,7 @@ public class BookServer extends AbstractBusTestServerBase {
private static class ByteConverter implements ParamConverter<Byte> {
@Override
public Byte fromString(String t) {
- return new Byte(t);
+ return Byte.valueOf(t);
}
@Override
diff --git a/systests/uncategorized/src/test/java/org/apache/cxf/systest/type_test/AbstractTypeTestClient2.java b/systests/uncategorized/src/test/java/org/apache/cxf/systest/type_test/AbstractTypeTestClient2.java
index 38a67a3..867cb0c 100644
--- a/systests/uncategorized/src/test/java/org/apache/cxf/systest/type_test/AbstractTypeTestClient2.java
+++ b/systests/uncategorized/src/test/java/org/apache/cxf/systest/type_test/AbstractTypeTestClient2.java
@@ -2057,13 +2057,13 @@ public abstract class AbstractTypeTestClient2 extends AbstractTypeTestClient {
}
SimpleContent1 x1 = new SimpleContent1();
x1.setValue("foo");
- x1.setAttrib1A(new Byte((byte)1));
- x1.setAttrib1B(new Short((short)2));
+ x1.setAttrib1A(Byte.valueOf((byte)1));
+ x1.setAttrib1B(Short.valueOf((short)2));
SimpleContent1 y1 = new SimpleContent1();
y1.setValue("bar");
- y1.setAttrib1A(new Byte((byte)3));
- y1.setAttrib1B(new Short((short)4));
+ y1.setAttrib1A(Byte.valueOf((byte)3));
+ y1.setAttrib1B(Short.valueOf((short)4));
Holder<SimpleContent1> y1Holder = new Holder<SimpleContent1>(y1);
Holder<SimpleContent1> z1 = new Holder<SimpleContent1>();
@@ -2094,15 +2094,15 @@ public abstract class AbstractTypeTestClient2 extends AbstractTypeTestClient {
}
SimpleContent2 x2 = new SimpleContent2();
x2.setValue("foo");
- x2.setAttrib1A(new Byte((byte)1));
- x2.setAttrib1B(new Short((short)2));
+ x2.setAttrib1A(Byte.valueOf((byte)1));
+ x2.setAttrib1B(Short.valueOf((short)2));
x2.setAttrib2A(Integer.valueOf(5));
x2.setAttrib2B(Long.valueOf(6));
SimpleContent2 y2 = new SimpleContent2();
y2.setValue("bar");
- y2.setAttrib1A(new Byte((byte)3));
- y2.setAttrib1B(new Short((short)4));
+ y2.setAttrib1A(Byte.valueOf((byte)3));
+ y2.setAttrib1B(Short.valueOf((short)4));
y2.setAttrib2A(Integer.valueOf(7));
y2.setAttrib2B(Long.valueOf(8));
@@ -2135,8 +2135,8 @@ public abstract class AbstractTypeTestClient2 extends AbstractTypeTestClient {
}
SimpleContent3 x3 = new SimpleContent3();
x3.setValue("foo");
- x3.setAttrib1A(new Byte((byte)1));
- x3.setAttrib1B(new Short((short)2));
+ x3.setAttrib1A(Byte.valueOf((byte)1));
+ x3.setAttrib1B(Short.valueOf((short)2));
x3.setAttrib2A(Integer.valueOf(5));
x3.setAttrib2B(Long.valueOf(6));
x3.setAttrib3A("xxx");
@@ -2144,8 +2144,8 @@ public abstract class AbstractTypeTestClient2 extends AbstractTypeTestClient {
SimpleContent3 y3 = new SimpleContent3();
y3.setValue("bar");
- y3.setAttrib1A(new Byte((byte)3));
- y3.setAttrib1B(new Short((short)4));
+ y3.setAttrib1A(Byte.valueOf((byte)3));
+ y3.setAttrib1B(Short.valueOf((short)4));
y3.setAttrib2A(Integer.valueOf(7));
y3.setAttrib2B(Long.valueOf(8));
y3.setAttrib3A("yyy");
--
To stop receiving notification emails like this one, please contact
coheigea@apache.org.