Skip to content

Commit aa0eea9

Browse files
committed
Fix PMD violations
1 parent a5f48a0 commit aa0eea9

File tree

22 files changed

+33
-27
lines changed

22 files changed

+33
-27
lines changed

core/src/main/java/org/apache/cxf/common/logging/JDKBugHacks.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ public String run() {
8585
return Boolean.parseBoolean(cname);
8686
}
8787

88+
89+
@SuppressWarnings("PMD.UselessPureMethodCall")
8890
public static void doHacks() {
8991
if (skipHack("org.apache.cxf.JDKBugHacks.all")) {
9092
return;

core/src/main/java/org/apache/cxf/common/logging/LogUtils.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ public static Logger getL7dLogger(Class<?> cls,
226226
/**
227227
* Create a logger
228228
*/
229+
@SuppressWarnings("PMD.UselessPureMethodCall")
229230
protected static Logger createLogger(Class<?> cls,
230231
String name,
231232
String loggerName) {

core/src/main/java/org/apache/cxf/configuration/spring/ConfigurerImpl.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public class ConfigurerImpl extends BeanConfigurerSupport
6161
private final Map<String, List<MatcherHolder>> wildCardBeanDefinitions = new TreeMap<>();
6262
private BeanFactory beanFactory;
6363

64+
@SuppressWarnings("PMD.OverrideBothEqualsAndHashCodeOnComparable")
6465
static class MatcherHolder implements Comparable<MatcherHolder> {
6566
Matcher matcher;
6667
String wildCardId;

core/src/main/java/org/apache/cxf/workqueue/AutomaticWorkQueueImpl.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
import org.apache.cxf.common.util.ReflectionUtil;
5050

5151
@NoJSR250Annotations
52+
@SuppressWarnings("PMD.OverrideBothEqualsAndHashCodeOnComparable")
5253
public class AutomaticWorkQueueImpl implements AutomaticWorkQueue {
5354
public static final String PROPERTY_NAME = "name";
5455
static final int DEFAULT_MAX_QUEUE_SIZE = 256;

core/src/test/java/org/apache/cxf/attachment/AttachmentDeserializerTest.java

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@
5555
import static org.junit.Assert.assertFalse;
5656
import static org.junit.Assert.assertNotNull;
5757
import static org.junit.Assert.assertThat;
58+
import static org.junit.Assert.assertThrows;
5859
import static org.junit.Assert.assertTrue;
59-
import static org.junit.Assert.fail;
6060

6161
public class AttachmentDeserializerTest {
6262

@@ -696,12 +696,8 @@ public void testManyAttachments() throws Exception {
696696
ad.initializeAttachments();
697697

698698
// Force it to load the attachments
699-
try {
700-
msg.getAttachments().size();
701-
fail("Failure expected on too many attachments");
702-
} catch (RuntimeException ex) {
703-
// expected
704-
}
699+
assertThrows("Failure expected on too many attachments", RuntimeException.class,
700+
() -> msg.getAttachments().size());
705701
}
706702

707703
@Test
@@ -734,12 +730,8 @@ public void testChangingMaxAttachmentCount() throws Exception {
734730
ad.initializeAttachments();
735731

736732
// Force it to load the attachments
737-
try {
738-
msg.getAttachments().size();
739-
fail("Failure expected on too many attachments");
740-
} catch (RuntimeException ex) {
741-
// expected
742-
}
733+
assertThrows("Failure expected on too many attachments", RuntimeException.class,
734+
() -> msg.getAttachments().size());
743735

744736
// Now we'll allow it
745737
msg = new MessageImpl();

integration/spring-boot/autoconfigure/src/test/java/org/apache/cxf/spring/boot/autoconfigure/micrometer/provider/SpringBasedTimedAnnotationProviderTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public class SpringBasedTimedAnnotationProviderTest {
5454
private MethodDispatcher methodDispatcher;
5555

5656
@Before
57+
@SuppressWarnings("PMD.UselessPureMethodCall")
5758
public void setUp() {
5859
openMocks(this);
5960
underTest = new SpringBasedTimedAnnotationProvider();

rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/DuplicateArrayReturnItem.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
package org.apache.cxf.aegis.type.array;
2121

22+
@SuppressWarnings("PMD.OverrideBothEqualsAndHashCodeOnComparable")
2223
public class DuplicateArrayReturnItem implements Comparable<Object> {
2324

2425
String name;

rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ class JAXBContextInitializer extends ServiceModelVisitor {
8383
}
8484

8585
@Override
86+
@SuppressWarnings("PMD.UselessPureMethodCall")
8687
public void begin(MessagePartInfo part) {
8788
Class<?> clazz = part.getTypeClass();
8889
if (clazz == null) {

rt/features/metrics/src/test/java/org/apache/cxf/metrics/micrometer/provider/DefaultExceptionClassProviderTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import static org.mockito.Mockito.doReturn;
3535
import static org.mockito.MockitoAnnotations.openMocks;
3636

37+
@SuppressWarnings("PMD.UselessPureMethodCall")
3738
public class DefaultExceptionClassProviderTest {
3839

3940
private static final Exception EXCEPTION_CAUSE = new CauseException();

rt/features/metrics/src/test/java/org/apache/cxf/metrics/micrometer/provider/DefaultTimedAnnotationProviderTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
import static org.mockito.Mockito.doReturn;
4343
import static org.mockito.MockitoAnnotations.openMocks;
4444

45-
@SuppressWarnings({"unused"})
45+
@SuppressWarnings({"unused", "PMD.UselessPureMethodCall"})
4646
public class DefaultTimedAnnotationProviderTest {
4747

4848
private DefaultTimedAnnotationProvider underTest;

0 commit comments

Comments
 (0)