Update maven-pmd-plugin
diff --git a/cxf-xjc-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractXSDToJavaMojo.java b/cxf-xjc-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractXSDToJavaMojo.java
index d19729c..fb58f19 100644
--- a/cxf-xjc-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractXSDToJavaMojo.java
+++ b/cxf-xjc-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractXSDToJavaMojo.java
@@ -392,7 +392,7 @@
List<URL> newCp = new ArrayList<URL>();
List<String> list = new ArrayList<String>();
- if (extensions != null && extensions.size() > 0) {
+ if (extensions != null && !extensions.isEmpty()) {
try {
for (String ext : extensions) {
for (File file : resolve(ext)) {
diff --git a/dv-test/src/test/java/org/apache/cxf/xjc/dv/DefaultValueTest.java b/dv-test/src/test/java/org/apache/cxf/xjc/dv/DefaultValueTest.java
index e11845a..1c4e09d 100644
--- a/dv-test/src/test/java/org/apache/cxf/xjc/dv/DefaultValueTest.java
+++ b/dv-test/src/test/java/org/apache/cxf/xjc/dv/DefaultValueTest.java
@@ -181,11 +181,11 @@
assertEquals("Unexpected value for element integerElem",
new BigInteger("11"), foo.getIntegerElem());
assertEquals("Unexpected value for element intElem",
- new Integer(12), foo.getIntElem());
+ 12, foo.getIntElem().intValue());
assertEquals("Unexpected value for element longElem",
- new Long(13L), foo.getLongElem());
+ 13L, foo.getLongElem().longValue());
assertEquals("Unexpected value for element shortElem",
- new Short((short)14), foo.getShortElem());
+ (short)14, foo.getShortElem().shortValue());
assertEquals("Unexpected value for element decimalElem",
new BigDecimal("15"), foo.getDecimalElem());
assertEquals("Unexpected value for element floatElem",
@@ -193,7 +193,7 @@
assertEquals("Unexpected value for element doubleElem",
new Double(17D), foo.getDoubleElem());
assertEquals("Unexpected value for element byteElem",
- new Byte((byte)18), foo.getByteElem());
+ (byte)18, foo.getByteElem().byteValue());
byte[] expected = DatatypeConverter.parseBase64Binary("abcdefgh");
byte[] effective = foo.getBase64BinaryElem();
@@ -217,11 +217,11 @@
"string", qn.getLocalPart());
assertEquals("Unexpected value for element unsignedIntElem",
- new Long(19L), foo.getUnsignedIntElem());
+ 19L, foo.getUnsignedIntElem().longValue());
assertEquals("Unexpected value for element unsignedShortElem",
- new Integer(20), foo.getUnsignedShortElem());
+ 20, foo.getUnsignedShortElem().intValue());
assertEquals("Unexpected value for element unsignedByteElem",
- new Short((short)21), foo.getUnsignedByteElem());
+ (short)21, foo.getUnsignedByteElem().shortValue());
assertEquals("Unexpected value for element durationElem",
0, foo.getDurationElem().getSeconds());
diff --git a/dv/src/main/java/org/apache/cxf/xjc/dv/DefaultValuePlugin.java b/dv/src/main/java/org/apache/cxf/xjc/dv/DefaultValuePlugin.java
index e56e01a..564ef6c 100644
--- a/dv/src/main/java/org/apache/cxf/xjc/dv/DefaultValuePlugin.java
+++ b/dv/src/main/java/org/apache/cxf/xjc/dv/DefaultValuePlugin.java
@@ -343,24 +343,24 @@
dv = JExpr.direct(Boolean.valueOf(defaultValue) ? "Boolean.TRUE" : "Boolean.FALSE");
} else if ("java.lang.Byte".equals(typeName) && isElement) {
dv = JExpr._new(type)
- .arg(JExpr.cast(type.unboxify(),
- JExpr.lit(new Byte(Short.valueOf(defaultValue).byteValue()))));
+ .arg(JExpr.cast(type.unboxify(),
+ JExpr.lit(Byte.parseByte(defaultValue))));
} else if ("java.lang.Double".equals(typeName) && isElement) {
dv = JExpr._new(type)
- .arg(JExpr.lit(new Double(Double.valueOf(defaultValue).doubleValue())));
+ .arg(JExpr.lit(Double.parseDouble(defaultValue)));
} else if ("java.lang.Float".equals(typeName) && isElement) {
dv = JExpr._new(type)
- .arg(JExpr.lit(new Float(Float.valueOf(defaultValue).floatValue())));
+ .arg(JExpr.lit(Float.parseFloat(defaultValue)));
} else if ("java.lang.Integer".equals(typeName) && isElement) {
dv = JExpr._new(type)
- .arg(JExpr.lit(new Integer(Integer.valueOf(defaultValue).intValue())));
+ .arg(JExpr.lit(Integer.parseInt(defaultValue)));
} else if ("java.lang.Long".equals(typeName) && isElement) {
dv = JExpr._new(type)
- .arg(JExpr.lit(new Long(Long.valueOf(defaultValue).longValue())));
+ .arg(JExpr.lit(Long.parseLong(defaultValue)));
} else if ("java.lang.Short".equals(typeName) && isElement) {
dv = JExpr._new(type)
- .arg(JExpr.cast(type.unboxify(),
- JExpr.lit(new Short(Short.valueOf(defaultValue).shortValue()))));
+ .arg(JExpr.cast(type.unboxify(),
+ JExpr.lit(Short.parseShort(defaultValue))));
} else if ("java.lang.String".equals(type.fullName()) && isElement) {
dv = JExpr.lit(defaultValue);
} else if ("java.math.BigInteger".equals(type.fullName()) && isElement) {
@@ -395,19 +395,19 @@
} else if (unbox) {
typeName = type.unboxify().fullName();
if ("int".equals(typeName)) {
- dv = JExpr.lit(Integer.valueOf(defaultValue).intValue());
+ dv = JExpr.lit(Integer.parseInt(defaultValue));
} else if ("long".equals(typeName)) {
- dv = JExpr.lit(Long.valueOf(defaultValue).longValue());
+ dv = JExpr.lit(Long.parseLong(defaultValue));
} else if ("short".equals(typeName)) {
- dv = JExpr.lit(Short.valueOf(defaultValue).shortValue());
+ dv = JExpr.lit(Short.parseShort(defaultValue));
} else if ("boolean".equals(typeName)) {
- dv = JExpr.lit(Boolean.valueOf(defaultValue).booleanValue());
+ dv = JExpr.lit(Boolean.parseBoolean(defaultValue));
} else if ("double".equals(typeName)) {
- dv = JExpr.lit(Double.valueOf(defaultValue).doubleValue());
+ dv = JExpr.lit(Double.parseDouble(defaultValue));
} else if ("float".equals(typeName)) {
- dv = JExpr.lit(Float.valueOf(defaultValue).floatValue());
+ dv = JExpr.lit(Float.parseFloat(defaultValue));
} else if ("byte".equals(typeName)) {
- dv = JExpr.lit(Byte.valueOf(defaultValue).byteValue());
+ dv = JExpr.lit(Byte.parseByte(defaultValue));
} else {
dv = getDefaultValueExpression(f,
co,
diff --git a/pom.xml b/pom.xml
index 3d89ba6..7cb59be 100644
--- a/pom.xml
+++ b/pom.xml
@@ -414,7 +414,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
- <version>3.10.0</version>
+ <version>3.12.0</version>
<dependencies>
<dependency>
<groupId>org.apache.cxf.build-utils</groupId>
@@ -548,7 +548,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
- <version>3.1</version>
+ <version>3.8.1</version>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
diff --git a/runtime/src/test/java/org/apache/cxf/xjc/runtime/JAXBToStringBuilderTest.java b/runtime/src/test/java/org/apache/cxf/xjc/runtime/JAXBToStringBuilderTest.java
index 4ec1706..dc7238e 100644
--- a/runtime/src/test/java/org/apache/cxf/xjc/runtime/JAXBToStringBuilderTest.java
+++ b/runtime/src/test/java/org/apache/cxf/xjc/runtime/JAXBToStringBuilderTest.java
@@ -30,38 +30,38 @@
public class JAXBToStringBuilderTest {
- final String dataV = "someData";
+ private static final String DATA = "someData";
@Test
public void testToString() throws Exception {
- String res = JAXBToStringBuilder.valueOf(dataV);
- Assert.assertEquals(res, dataV);
+ String res = JAXBToStringBuilder.valueOf(DATA);
+ Assert.assertEquals(res, DATA);
}
@Test
public void testToStringArray() throws Exception {
- String[] data = new String[]{dataV};
+ String[] data = new String[]{DATA};
String res = JAXBToStringBuilder.valueOf(data);
- Assert.assertTrue(res.indexOf(dataV) != -1);
+ Assert.assertTrue(res.indexOf(DATA) != -1);
}
@Test
public void testToStringCollection() throws Exception {
List<String> data = new ArrayList<String>();
- data.add(dataV);
+ data.add(DATA);
String res = JAXBToStringBuilder.valueOf(data);
- Assert.assertTrue(res.indexOf(dataV) != -1);
+ Assert.assertTrue(res.indexOf(DATA) != -1);
}
@Test
public void testToStringMap() throws Exception {
Map<String, String> data = new HashMap<String, String>();
- data.put(dataV, dataV);
+ data.put(DATA, DATA);
// no content as it is not a Collection
String res = JAXBToStringBuilder.valueOf(data);
- Assert.assertTrue(res.indexOf(dataV) == -1);
+ Assert.assertTrue(res.indexOf(DATA) == -1);
}
}