This is an automated email from the ASF dual-hosted git repository. dkulp pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cxf.git
The following commit(s) were added to refs/heads/master by this push: new 00bbab65e5 Update to latest checkstyle and PMD, fix more Java11 warnings/deprecation things 00bbab65e5 is described below commit 00bbab65e59b8f27366335aec19e50129b7759f0 Author: Daniel Kulp <d...@kulp.com> AuthorDate: Thu Apr 14 14:21:50 2022 -0400 Update to latest checkstyle and PMD, fix more Java11 warnings/deprecation things --- .../apache/cxf/attachment/AttachmentDeserializer.java | 4 +++- .../org/apache/cxf/attachment/ContentDisposition.java | 2 +- .../apache/cxf/common/injection/ResourceInjector.java | 5 ----- .../cxf/common/jaxb/SchemaCollectionContextProxy.java | 2 +- .../java/org/apache/cxf/common/util/ASMHelper.java | 12 ++++++------ .../org/apache/cxf/common/util/ClasspathScanner.java | 2 +- .../java/org/apache/cxf/common/util/Compiler.java | 2 +- .../apache/cxf/common/util/SpringClassUnwrapper.java | 2 +- .../blueprint/AbstractBPBeanDefinitionParser.java | 2 +- .../org/apache/cxf/configuration/jsse/SSLUtils.java | 2 +- .../cxf/feature/transform/XSLTOutInterceptor.java | 9 +++------ core/src/main/java/org/apache/cxf/helpers/NSDecl.java | 3 +-- .../transform/TransformOutInterceptor.java | 2 +- .../factory/AnnotationsFactoryBeanListener.java | 2 ++ .../apache/cxf/staxutils/CachingXmlEventWriter.java | 19 ++++++++++--------- .../apache/cxf/common/xmlschema/ImportRepairTest.java | 2 +- .../java/org/apache/cxf/maven_plugin/Java2WSMojo.java | 5 ++--- parent/pom.xml | 12 ++++++------ pom.xml | 2 +- .../cxf/binding/coloc/WebFaultInInterceptor.java | 2 +- .../interceptors/CorbaStreamFaultOutInterceptor.java | 2 +- .../binding/corba/types/CorbaStructEventProducer.java | 4 ++-- .../cxf/binding/corba/types/CorbaStructListener.java | 2 +- .../apache/cxf/binding/corba/utils/CorbaUtils.java | 4 ++-- .../soap/interceptor/SoapActionInInterceptor.java | 2 +- .../binding/soap/jms/interceptor/JMSFaultType.java | 2 +- .../cxf/aegis/databinding/AegisDatabinding.java | 2 +- .../org/apache/cxf/jaxb/JAXBSchemaInitializer.java | 4 ++-- .../org/apache/cxf/jaxrs/impl/HttpHeadersImpl.java | 2 +- .../org/apache/cxf/jaxrs/impl/UriBuilderImpl.java | 2 +- .../apache/cxf/jaxrs/model/OperationResourceInfo.java | 2 +- .../java/org/apache/cxf/jaxrs/model/URITemplate.java | 2 +- .../org/apache/cxf/jaxrs/utils/InjectionUtils.java | 2 +- .../java/org/apache/cxf/jaxws/JAXWSMethodInvoker.java | 2 +- .../org/apache/cxf/javascript/JavascriptUtils.java | 2 +- .../javascript/service/ServiceJavascriptBuilder.java | 2 +- .../cxf/javascript/types/SchemaJavascriptBuilder.java | 8 ++++---- .../apache/cxf/jaxrs/client/ClientConfiguration.java | 2 +- .../java/org/apache/cxf/jaxrs/client/WebClient.java | 2 +- .../ext/search/client/FiqlSearchConditionBuilder.java | 8 ++++---- .../microprofile/client/cdi/RestClientCdiTest.java | 4 ++-- .../multipart/JwsMultipartSignatureInFilter.java | 2 +- .../AbstractContentEncryptionCipherProperties.java | 3 +-- .../oauth2/provider/JPAOAuthDataProvider.java | 2 +- .../cxf/jaxrs/sse/OutboundSseEventImplTest.java | 2 +- .../transport/http_jetty/JettyHTTPServerEngine.java | 2 +- .../apache/cxf/transport/jms/BackChannelConduit.java | 2 +- .../java/org/apache/cxf/transport/jms/JMSConduit.java | 2 +- .../apache/cxf/transport/jms/JMSDestinationTest.java | 2 +- .../attachment/external/URIDomainExpression.java | 2 +- .../ws/policy/selector/BaseAlternativeSelector.java | 2 +- .../interceptors/HttpsTokenInterceptorProvider.java | 2 +- .../policyhandlers/StaxAsymmetricBindingHandler.java | 2 +- .../org/apache/cxf/wsdl11/WSDLServiceFactory.java | 6 +++--- .../cxf/sts/rest/RESTSecurityTokenServiceImpl.java | 2 +- .../sts/token/provider/DefaultSubjectProvider.java | 2 +- .../cxf/sts/token/validator/X509TokenValidator.java | 2 +- .../apache/cxf/sts/operation/DummyTokenValidator.java | 2 +- .../sts/deployment/CustomBSTTokenValidator.java | 2 +- .../cxf/systest/handlers/HandlerInvocationTest.java | 2 +- .../apache/cxf/systest/handlers/TestSOAPHandler.java | 2 +- .../provider/AttachmentStreamSourceXMLProvider.java | 2 +- .../apache/cxf/systest/brave/BraveTestSupport.java | 5 ++++- .../java/org/apache/cxf/systest/ws/wssc/WSSCTest.java | 2 +- .../apache/cxf/systest/ws/addressing/MAPVerifier.java | 2 +- .../java/org/apache/cxf/tools/common/ToolContext.java | 2 +- .../apache/cxf/tools/common/ToolErrorListener.java | 2 +- .../common/toolspec/parser/CommandLineParser.java | 2 +- .../java/org/apache/cxf/tools/corba/IDLToWSDL.java | 4 ++-- .../cxf/tools/corba/common/ProcessorEnvironment.java | 2 +- .../tools/corba/processors/idl/PortTypeVisitor.java | 2 +- .../tools/corba/processors/idl/ScopedNameVisitor.java | 12 ++++++------ .../corba/processors/wsdl/WSDLToCorbaHelper.java | 10 +++++----- .../corba/processors/wsdl/WSDLToCorbaProcessor.java | 4 ++-- .../tools/corba/processors/wsdl/WSDLToIDLAction.java | 4 ++-- .../tools/corba/utils/FileOutputStreamFactory.java | 12 ++++++------ .../corba/processors/WSDLToIDLGenerationTest.java | 2 +- .../tools/java2js/processor/JavaToJSProcessor.java | 5 ++--- .../java2wsdl/processor/JavaToWSDLProcessor.java | 5 ++--- .../internal/jaxws/generator/JaxwsImplGenerator.java | 2 +- .../internal/jaxws/generator/JaxwsSEIGenerator.java | 2 +- .../simple/generator/SimpleImplGenerator.java | 2 +- .../internal/simple/generator/SimpleSEIGenerator.java | 2 +- .../tools/validator/internal/WSDLRefValidator.java | 4 ++-- .../cxf/tools/wadlto/jaxrs/SourceGenerator.java | 4 ++-- .../jaxws/processor/internal/OperationProcessor.java | 2 +- .../tools/misc/processor/WSDLToServiceProcessor.java | 6 +++--- .../cxf/tools/misc/processor/WSDLToSoapProcessor.java | 4 ++-- .../cxf/tools/misc/processor/WSDLToXMLProcessor.java | 8 ++++---- 89 files changed, 155 insertions(+), 160 deletions(-) diff --git a/core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java b/core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java index 55a1dcc63b..2cd5472e3a 100644 --- a/core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java +++ b/core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java @@ -292,7 +292,9 @@ public class AttachmentDeserializer { value = pushbackInStream.read(); if ((byte) value == boundary[0]) { int boundaryIndex = 0; - while (value != -1 && (boundaryIndex < boundary.length) && ((byte) value == boundary[boundaryIndex])) { + while (value != -1 + && boundaryIndex < boundary.length + && (byte)value == boundary[boundaryIndex]) { value = pushbackInStream.read(); if (value == -1) { diff --git a/core/src/main/java/org/apache/cxf/attachment/ContentDisposition.java b/core/src/main/java/org/apache/cxf/attachment/ContentDisposition.java index f9d4524a00..a6ae0f2b0a 100644 --- a/core/src/main/java/org/apache/cxf/attachment/ContentDisposition.java +++ b/core/src/main/java/org/apache/cxf/attachment/ContentDisposition.java @@ -50,7 +50,7 @@ public class ContentDisposition { String tempValue = value; int index = tempValue.indexOf(';'); - if (index > 0 && (tempValue.indexOf('=') >= index)) { + if (index > 0 && tempValue.indexOf('=') >= index) { type = tempValue.substring(0, index).trim(); tempValue = tempValue.substring(index + 1); } diff --git a/core/src/main/java/org/apache/cxf/common/injection/ResourceInjector.java b/core/src/main/java/org/apache/cxf/common/injection/ResourceInjector.java index 9c420ce718..583ac0a27a 100644 --- a/core/src/main/java/org/apache/cxf/common/injection/ResourceInjector.java +++ b/core/src/main/java/org/apache/cxf/common/injection/ResourceInjector.java @@ -315,8 +315,6 @@ public class ResourceInjector extends AbstractAnnotationVisitor { return res.name(); } - - private void injectField(Field field, Object resource) { assert field != null; assert resource != null; @@ -335,9 +333,7 @@ public class ResourceInjector extends AbstractAnnotationVisitor { } } - public void invokePostConstruct() { - boolean accessible = false; for (Method method : getPostConstructMethods()) { PostConstruct pc = method.getAnnotation(PostConstruct.class); @@ -357,7 +353,6 @@ public class ResourceInjector extends AbstractAnnotationVisitor { } public void invokePreDestroy() { - boolean accessible = false; for (Method method : getPreDestroyMethods()) { PreDestroy pd = method.getAnnotation(PreDestroy.class); diff --git a/core/src/main/java/org/apache/cxf/common/jaxb/SchemaCollectionContextProxy.java b/core/src/main/java/org/apache/cxf/common/jaxb/SchemaCollectionContextProxy.java index 32b0aaf498..0c5522d693 100644 --- a/core/src/main/java/org/apache/cxf/common/jaxb/SchemaCollectionContextProxy.java +++ b/core/src/main/java/org/apache/cxf/common/jaxb/SchemaCollectionContextProxy.java @@ -176,7 +176,7 @@ public class SchemaCollectionContextProxy implements JAXBContextProxy { return new JAXBBeanInfo() { public boolean isElement() { - return el == null ? false : true; + return el != null; } public Collection<QName> getTypeNames() { return Collections.singletonList(typeName); diff --git a/core/src/main/java/org/apache/cxf/common/util/ASMHelper.java b/core/src/main/java/org/apache/cxf/common/util/ASMHelper.java index 16a79d9975..912c31fcbf 100644 --- a/core/src/main/java/org/apache/cxf/common/util/ASMHelper.java +++ b/core/src/main/java/org/apache/cxf/common/util/ASMHelper.java @@ -38,11 +38,11 @@ public interface ASMHelper { String getNonPrimitive(Class<?> tp); String getPrimitive(Class<?> tp); - public interface ASMType { + interface ASMType { int getOpcode(int ireturn); } - public interface ClassWriter { + interface ClassWriter { @WrapReturn(AnnotationVisitor.class) AnnotationVisitor visitAnnotation(String cls, boolean t); @@ -61,15 +61,15 @@ public interface ASMHelper { void visitSource(String arg0, String arg1); } - public interface Label { + interface Label { } - public interface FieldVisitor { + interface FieldVisitor { @WrapReturn(AnnotationVisitor.class) AnnotationVisitor visitAnnotation(String cls, boolean b); void visitEnd(); } - public interface MethodVisitor { + interface MethodVisitor { void visitEnd(); void visitLabel(@UnwrapParam(typeMethodName = "realType") Label l1); void visitMaxs(int i, int j); @@ -97,7 +97,7 @@ public interface ASMHelper { @WrapReturn(AnnotationVisitor.class) AnnotationVisitor visitAnnotation(String cls, boolean b); } - public interface AnnotationVisitor { + interface AnnotationVisitor { void visit(String arg0, @UnwrapParam(typeMethodName = "realType") ASMType arg1); void visit(String arg0, Object arg1); @WrapReturn(AnnotationVisitor.class) diff --git a/core/src/main/java/org/apache/cxf/common/util/ClasspathScanner.java b/core/src/main/java/org/apache/cxf/common/util/ClasspathScanner.java index 7cc898ed53..f784942da9 100644 --- a/core/src/main/java/org/apache/cxf/common/util/ClasspathScanner.java +++ b/core/src/main/java/org/apache/cxf/common/util/ClasspathScanner.java @@ -179,7 +179,7 @@ public class ClasspathScanner { final Set<String> basePackages = new HashSet<>(values.length); for (final String value : values) { final String trimmed = value.trim(); - if (trimmed.equals(WILDCARD)) { + if (WILDCARD.equals(trimmed)) { basePackages.clear(); basePackages.add(trimmed); break; diff --git a/core/src/main/java/org/apache/cxf/common/util/Compiler.java b/core/src/main/java/org/apache/cxf/common/util/Compiler.java index 9d0c819282..cc2e43173c 100644 --- a/core/src/main/java/org/apache/cxf/common/util/Compiler.java +++ b/core/src/main/java/org/apache/cxf/common/util/Compiler.java @@ -327,7 +327,7 @@ public class Compiler { infoStreamPrinter.start(); } - return p.waitFor() == 0 ? true : false; + return p.waitFor() == 0; } catch (SecurityException e) { System.err.println("[ERROR] SecurityException during exec() of compiler \"" + args[0] + "\"."); } catch (InterruptedException e) { diff --git a/core/src/main/java/org/apache/cxf/common/util/SpringClassUnwrapper.java b/core/src/main/java/org/apache/cxf/common/util/SpringClassUnwrapper.java index a196eb0e4d..65495e4ef2 100644 --- a/core/src/main/java/org/apache/cxf/common/util/SpringClassUnwrapper.java +++ b/core/src/main/java/org/apache/cxf/common/util/SpringClassUnwrapper.java @@ -65,7 +65,7 @@ class SpringClassUnwrapper implements ClassUnwrapper { @Override public Class<?> getRealClass(Object o) { - if (AopUtils.isAopProxy(o) && (o instanceof Advised)) { + if (AopUtils.isAopProxy(o) && o instanceof Advised) { Advised advised = (Advised)o; try { TargetSource targetSource = advised.getTargetSource(); diff --git a/core/src/main/java/org/apache/cxf/configuration/blueprint/AbstractBPBeanDefinitionParser.java b/core/src/main/java/org/apache/cxf/configuration/blueprint/AbstractBPBeanDefinitionParser.java index c32f40cc51..88320f3802 100644 --- a/core/src/main/java/org/apache/cxf/configuration/blueprint/AbstractBPBeanDefinitionParser.java +++ b/core/src/main/java/org/apache/cxf/configuration/blueprint/AbstractBPBeanDefinitionParser.java @@ -108,7 +108,7 @@ public abstract class AbstractBPBeanDefinitionParser { } String id; - if (first.getNamespaceURI().equals(XMLNS_BLUEPRINT)) { + if (XMLNS_BLUEPRINT.equals(first.getNamespaceURI())) { String name = first.getLocalName(); if ("ref".equals(name)) { id = first.getAttribute(COMPONENT_ID); diff --git a/core/src/main/java/org/apache/cxf/configuration/jsse/SSLUtils.java b/core/src/main/java/org/apache/cxf/configuration/jsse/SSLUtils.java index ed19fb0637..9c0e4e318d 100644 --- a/core/src/main/java/org/apache/cxf/configuration/jsse/SSLUtils.java +++ b/core/src/main/java/org/apache/cxf/configuration/jsse/SSLUtils.java @@ -432,7 +432,7 @@ public final class SSLUtils { private static String[] getSystemCiphersuites(Logger log) { String jvmCipherSuites = System.getProperty(HTTPS_CIPHER_SUITES); - if ((jvmCipherSuites != null) && (!jvmCipherSuites.isEmpty())) { + if ((jvmCipherSuites != null) && !jvmCipherSuites.isEmpty()) { LogUtils.log(log, Level.FINE, "CIPHERSUITES_SYSTEM_PROPERTY_SET", jvmCipherSuites); return jvmCipherSuites.split(","); } diff --git a/core/src/main/java/org/apache/cxf/feature/transform/XSLTOutInterceptor.java b/core/src/main/java/org/apache/cxf/feature/transform/XSLTOutInterceptor.java index 53605ccace..a7f54c80f0 100644 --- a/core/src/main/java/org/apache/cxf/feature/transform/XSLTOutInterceptor.java +++ b/core/src/main/java/org/apache/cxf/feature/transform/XSLTOutInterceptor.java @@ -120,20 +120,17 @@ public class XSLTOutInterceptor extends AbstractXSLTInterceptor { @Override public void close() { - Reader transformedReader = null; try { super.flush(); - transformedReader = XSLTUtils.transform(xsltTemplate, cachedWriter.getReader()); - StaxUtils.copy(new StreamSource(transformedReader), origXWriter); + try (Reader transformedReader = XSLTUtils.transform(xsltTemplate, cachedWriter.getReader())) { + StaxUtils.copy(new StreamSource(transformedReader), origXWriter); + } } catch (XMLStreamException e) { throw new Fault("STAX_COPY", LOG, e, e.getMessage()); } catch (IOException e) { throw new Fault("GET_CACHED_INPUT_STREAM", LOG, e, e.getMessage()); } finally { try { - if (transformedReader != null) { - transformedReader.close(); - } cachedWriter.close(); StaxUtils.close(origXWriter); super.close(); diff --git a/core/src/main/java/org/apache/cxf/helpers/NSDecl.java b/core/src/main/java/org/apache/cxf/helpers/NSDecl.java index db6a380fa7..ca3d34ee32 100644 --- a/core/src/main/java/org/apache/cxf/helpers/NSDecl.java +++ b/core/src/main/java/org/apache/cxf/helpers/NSDecl.java @@ -54,8 +54,7 @@ public final class NSDecl { if (!(obj instanceof NSDecl)) { return false; } - return uri == ((NSDecl)obj).uri - && prefix == ((NSDecl)obj).prefix; + return uri == ((NSDecl)obj).uri && prefix == ((NSDecl)obj).prefix; //NOPMD } } diff --git a/core/src/main/java/org/apache/cxf/interceptor/transform/TransformOutInterceptor.java b/core/src/main/java/org/apache/cxf/interceptor/transform/TransformOutInterceptor.java index ba3a242ad6..38339a2d1d 100644 --- a/core/src/main/java/org/apache/cxf/interceptor/transform/TransformOutInterceptor.java +++ b/core/src/main/java/org/apache/cxf/interceptor/transform/TransformOutInterceptor.java @@ -165,7 +165,7 @@ public class TransformOutInterceptor extends AbstractPhaseInterceptor<Message> { } protected boolean isHttpVerbSupported(Message message) { - return isRequestor(message) && isGET(message) ? false : true; + return !(isRequestor(message) && isGET(message)); } public void setContextPropertyName(String propertyName) { diff --git a/core/src/main/java/org/apache/cxf/service/factory/AnnotationsFactoryBeanListener.java b/core/src/main/java/org/apache/cxf/service/factory/AnnotationsFactoryBeanListener.java index 5346f06876..a5ef837e8b 100644 --- a/core/src/main/java/org/apache/cxf/service/factory/AnnotationsFactoryBeanListener.java +++ b/core/src/main/java/org/apache/cxf/service/factory/AnnotationsFactoryBeanListener.java @@ -393,6 +393,7 @@ public class AnnotationsFactoryBeanListener implements FactoryBeanListener { break; default: later.add(doc); + break; } } if (!later.isEmpty()) { @@ -427,6 +428,7 @@ public class AnnotationsFactoryBeanListener implements FactoryBeanListener { break; default: later.add(doc); + break; } } if (!later.isEmpty()) { diff --git a/core/src/main/java/org/apache/cxf/staxutils/CachingXmlEventWriter.java b/core/src/main/java/org/apache/cxf/staxutils/CachingXmlEventWriter.java index 79c2725c2e..9900ee0308 100644 --- a/core/src/main/java/org/apache/cxf/staxutils/CachingXmlEventWriter.java +++ b/core/src/main/java/org/apache/cxf/staxutils/CachingXmlEventWriter.java @@ -27,6 +27,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Set; import javax.xml.XMLConstants; import javax.xml.namespace.NamespaceContext; @@ -212,27 +213,27 @@ public class CachingXmlEventWriter implements XMLStreamWriter { contexts.push(curContext); curContext = new NSContext(curContext); lastStart = new QName(name); - addEvent(factory.createStartElement(lastStart, - Collections.EMPTY_SET.iterator(), - Collections.EMPTY_SET.iterator())); + Set<javax.xml.stream.events.Attribute> atSet = Collections.emptySet(); + Set<javax.xml.stream.events.Namespace> nsSet = Collections.emptySet(); + addEvent(factory.createStartElement(lastStart, atSet.iterator(), nsSet.iterator())); } public void writeStartElement(String name, String ns) throws XMLStreamException { elNames.push(lastStart); contexts.push(curContext); curContext = new NSContext(curContext); lastStart = new QName(ns, name); - addEvent(factory.createStartElement(lastStart, - Collections.EMPTY_SET.iterator(), - Collections.EMPTY_SET.iterator())); + Set<javax.xml.stream.events.Attribute> atSet = Collections.emptySet(); + Set<javax.xml.stream.events.Namespace> nsSet = Collections.emptySet(); + addEvent(factory.createStartElement(lastStart, atSet.iterator(), nsSet.iterator())); } public void writeStartElement(String pfx, String name, String ns) throws XMLStreamException { elNames.push(lastStart); contexts.push(curContext); curContext = new NSContext(curContext); lastStart = new QName(ns, name, pfx); - addEvent(factory.createStartElement(lastStart, - Collections.EMPTY_SET.iterator(), - Collections.EMPTY_SET.iterator())); + Set<javax.xml.stream.events.Attribute> atSet = Collections.emptySet(); + Set<javax.xml.stream.events.Namespace> nsSet = Collections.emptySet(); + addEvent(factory.createStartElement(lastStart, atSet.iterator(), nsSet.iterator())); } public static class NSContext implements NamespaceContext { diff --git a/core/src/test/java/org/apache/cxf/common/xmlschema/ImportRepairTest.java b/core/src/test/java/org/apache/cxf/common/xmlschema/ImportRepairTest.java index 0fc65f02b0..6be268b0e5 100644 --- a/core/src/test/java/org/apache/cxf/common/xmlschema/ImportRepairTest.java +++ b/core/src/test/java/org/apache/cxf/common/xmlschema/ImportRepairTest.java @@ -139,7 +139,7 @@ public class ImportRepairTest { Method findMethod(Object o, String name) { for (Method m: o.getClass().getMethods()) { - if (m.getName() == name) { + if (m.getName().equals(name)) { return m; } } diff --git a/maven-plugins/java2ws-plugin/src/main/java/org/apache/cxf/maven_plugin/Java2WSMojo.java b/maven-plugins/java2ws-plugin/src/main/java/org/apache/cxf/maven_plugin/Java2WSMojo.java index c36ad9742f..6575c1885b 100644 --- a/maven-plugins/java2ws-plugin/src/main/java/org/apache/cxf/maven_plugin/Java2WSMojo.java +++ b/maven-plugins/java2ws-plugin/src/main/java/org/apache/cxf/maven_plugin/Java2WSMojo.java @@ -22,6 +22,7 @@ package org.apache.cxf.maven_plugin; import java.io.File; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.StringTokenizer; @@ -295,9 +296,7 @@ public class Java2WSMojo extends AbstractMojo { if (fork) { if (!StringUtils.isEmpty(additionalJvmArgs)) { String[] split = additionalJvmArgs.split("\\s+"); - for (String each : split) { - args.add(each); - } + args.addAll(Arrays.asList(split)); } // @see JavaToWS#isExitOnFinish() args.add("-DexitOnFinish=true"); diff --git a/parent/pom.xml b/parent/pom.xml index 7e810c7df5..4f3fe07aab 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -393,7 +393,7 @@ <dependency> <groupId>com.puppycrawl.tools</groupId> <artifactId>checkstyle</artifactId> - <version>8.41.1</version> + <version>10.1</version> </dependency> </dependencies> <configuration> @@ -422,23 +422,23 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-pmd-plugin</artifactId> - <version>3.13.0</version> + <version>3.16.0</version> <dependencies> <dependency> <groupId>org.apache.cxf.build-utils</groupId> <artifactId>cxf-buildtools</artifactId> <version>${cxf.build-utils.version}</version> </dependency> - <!--dependency> + <dependency> <groupId>net.sourceforge.pmd</groupId> <artifactId>pmd-core</artifactId> - <version>6.12.0</version> + <version>6.44.0</version> </dependency> <dependency> <groupId>net.sourceforge.pmd</groupId> <artifactId>pmd-java</artifactId> - <version>6.12.0</version> - </dependency--> + <version>6.44.0</version> + </dependency> </dependencies> <configuration> <rulesets> diff --git a/pom.xml b/pom.xml index de26b96afc..ac87cc55e1 100644 --- a/pom.xml +++ b/pom.xml @@ -40,7 +40,7 @@ </issueManagement> <properties> <cxf.compiler.fork>false</cxf.compiler.fork> - <cxf.build-utils.version>3.4.4</cxf.build-utils.version> + <cxf.build-utils.version>4.0.0-SNAPSHOT</cxf.build-utils.version> <cxf.xjc-utils.version>3.3.1</cxf.xjc-utils.version> <cxf.jdk.version>11</cxf.jdk.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> diff --git a/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/WebFaultInInterceptor.java b/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/WebFaultInInterceptor.java index 36b870516c..72965acd7f 100644 --- a/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/WebFaultInInterceptor.java +++ b/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/WebFaultInInterceptor.java @@ -76,7 +76,7 @@ public class WebFaultInInterceptor extends AbstractPhaseInterceptor<Message> { } private MessagePartInfo getFaultMessagePart(QName qname, OperationInfo op) { - if (op.isUnwrapped() && (op instanceof UnwrappedOperationInfo)) { + if (op.isUnwrapped() && op instanceof UnwrappedOperationInfo) { op = ((UnwrappedOperationInfo)op).getWrappedOperation(); } diff --git a/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/interceptors/CorbaStreamFaultOutInterceptor.java b/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/interceptors/CorbaStreamFaultOutInterceptor.java index b5c6d3f0af..77d06a3cc0 100644 --- a/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/interceptors/CorbaStreamFaultOutInterceptor.java +++ b/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/interceptors/CorbaStreamFaultOutInterceptor.java @@ -97,7 +97,7 @@ public class CorbaStreamFaultOutInterceptor extends AbstractPhaseInterceptor<Mes // JCGS. If the cause is not available I can only continue if the exception // is a Fault instance and contains a detail object. if (ex.getCause() == null) { - if ((ex instanceof Fault) && (((Fault)ex).getDetail() != null)) { + if (ex instanceof Fault && (((Fault)ex).getDetail() != null)) { faultEx = (Fault) ex; } else { throw new CorbaBindingException(ex); diff --git a/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/types/CorbaStructEventProducer.java b/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/types/CorbaStructEventProducer.java index d0dca8e446..d1280d477c 100644 --- a/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/types/CorbaStructEventProducer.java +++ b/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/types/CorbaStructEventProducer.java @@ -50,9 +50,9 @@ public class CorbaStructEventProducer extends AbstractStartEndEventProducer { CorbaObjectHandler obj = iterator.next(); //Special case for wrapped/unwrapped arrays or sequences boolean primitiveSequence = obj instanceof CorbaSequenceHandler - && (!CorbaHandlerUtils.isOctets(obj.getType())); + && !CorbaHandlerUtils.isOctets(obj.getType()); boolean primitivearray = obj instanceof CorbaArrayHandler - && (!CorbaHandlerUtils.isOctets(obj.getType())); + && !CorbaHandlerUtils.isOctets(obj.getType()); if (primitiveSequence || primitivearray) { boolean wrapped = true; if (obj.getType() instanceof Abstractanonsequence) { diff --git a/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/types/CorbaStructListener.java b/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/types/CorbaStructListener.java index e631fa1f53..cedf433005 100644 --- a/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/types/CorbaStructListener.java +++ b/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/types/CorbaStructListener.java @@ -53,7 +53,7 @@ public class CorbaStructListener extends AbstractCorbaTypeListener { } public void processStartElement(QName name) { - if (depth == 0 && (currentElement != null) && (!currentElement.equals(name))) { + if (depth == 0 && (currentElement != null) && !currentElement.equals(name)) { currentTypeListener = null; } depth++; diff --git a/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/utils/CorbaUtils.java b/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/utils/CorbaUtils.java index 30248ec4f6..3c119e5b6c 100644 --- a/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/utils/CorbaUtils.java +++ b/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/utils/CorbaUtils.java @@ -610,8 +610,8 @@ public final class CorbaUtils { public static QName processQName(QName qname, ServiceInfo serviceInfo) { QName result = qname; if ((qname.getNamespaceURI() != null) - && (!qname.getNamespaceURI().isEmpty()) - && (!isElementFormQualified(serviceInfo, qname.getNamespaceURI()))) { + && !qname.getNamespaceURI().isEmpty() + && !isElementFormQualified(serviceInfo, qname.getNamespaceURI())) { result = new QName("", qname.getLocalPart()); } return result; diff --git a/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapActionInInterceptor.java b/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapActionInInterceptor.java index b0c2efab42..ba37f8ade3 100644 --- a/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapActionInInterceptor.java +++ b/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapActionInInterceptor.java @@ -277,7 +277,7 @@ public class SoapActionInInterceptor extends AbstractSoapInterceptor { false); return action.equals(soi.getAction()) || (allowNoMatchingToDefault && StringUtils.isEmpty(soi.getAction()) - || (message.getVersion() instanceof Soap12) && StringUtils.isEmpty(soi.getAction())); + || message.getVersion() instanceof Soap12 && StringUtils.isEmpty(soi.getAction())); } } diff --git a/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/JMSFaultType.java b/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/JMSFaultType.java index 624a5ad7a0..1e2d586e33 100644 --- a/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/JMSFaultType.java +++ b/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/JMSFaultType.java @@ -83,7 +83,7 @@ public class JMSFaultType { } public boolean isSetAny() { - return (this.any != null) && (!this.any.isEmpty()); + return (this.any != null) && !this.any.isEmpty(); } public void unsetAny() { diff --git a/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java b/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java index 302ba5a322..a0d5416b01 100644 --- a/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java +++ b/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java @@ -602,7 +602,7 @@ public class AegisDatabinding extends AbstractDataBinding { param.setProperty("maxOccurs", Long.toString(info.getMaxOccurs())); } - if ((type instanceof ArrayType) && !type.isWriteOuter()) { + if (type instanceof ArrayType && !type.isWriteOuter()) { param.setProperty("org.apache.cxf.aegis.outerType", type); ArrayType aType = (ArrayType) type; type = aType.getComponentType(); diff --git a/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java b/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java index dde712fd9b..ed79eed301 100644 --- a/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java +++ b/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java @@ -541,7 +541,7 @@ class JAXBSchemaInitializer extends ServiceModelVisitor { //we want to return the right type for collections so if we get null //from the return type we check if it's ParameterizedType and get the //generic return type. - if ((type == null) && (f.getGenericType() instanceof ParameterizedType)) { + if ((type == null) && f.getGenericType() instanceof ParameterizedType) { type = f.getGenericType(); } if (generateGenericType(type)) { @@ -560,7 +560,7 @@ class JAXBSchemaInitializer extends ServiceModelVisitor { // we want to return the right type for collections so if we get null // from the return type we check if it's ParameterizedType and get the // generic return type. - if ((type == null) && (m.getGenericReturnType() instanceof ParameterizedType)) { + if ((type == null) && m.getGenericReturnType() instanceof ParameterizedType) { type = m.getGenericReturnType(); } diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/HttpHeadersImpl.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/HttpHeadersImpl.java index d307708b15..67fb41bb67 100644 --- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/HttpHeadersImpl.java +++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/HttpHeadersImpl.java @@ -261,7 +261,7 @@ public class HttpHeadersImpl implements HttpHeaders { if (!originalValue.contains(QUOTE) || HEADERS_WITH_POSSIBLE_QUOTES.contains(headerName)) { final String[] ls; - if (COOKIE_SEPARATOR_CRLF_EXPRESSION != sep) { + if (!COOKIE_SEPARATOR_CRLF_EXPRESSION.equals(sep)) { ls = originalValue.split(sep); } else { ls = COOKIE_SEPARATOR_CRLF_PATTERN.split(originalValue); diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriBuilderImpl.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriBuilderImpl.java index c88062415c..cea0a73f6f 100644 --- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriBuilderImpl.java +++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriBuilderImpl.java @@ -379,7 +379,7 @@ public class UriBuilderImpl extends UriBuilder implements Cloneable { for (String var : uniqueVars) { boolean isPathEncVar = !isQuery && alreadyResolvedTsPathEnc.containsKey(var); - boolean isVarEncoded = isPathEncVar || alreadyResolvedTs.containsKey(var) ? false : true; + boolean isVarEncoded = !(isPathEncVar || alreadyResolvedTs.containsKey(var)); Map<String, Object> resolved = isVarEncoded ? alreadyResolvedTsEnc : isPathEncVar ? alreadyResolvedTsPathEnc : alreadyResolvedTs; Object oval = resolved.isEmpty() ? null : resolved.remove(var); diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/OperationResourceInfo.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/OperationResourceInfo.java index 5ce98607b8..617e3cb014 100644 --- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/OperationResourceInfo.java +++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/OperationResourceInfo.java @@ -212,7 +212,7 @@ public class OperationResourceInfo { } public boolean isSubResourceLocator() { - return httpMethod == null ? true : false; + return httpMethod == null; } diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/URITemplate.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/URITemplate.java index 4c6a390271..3970ee484b 100644 --- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/URITemplate.java +++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/URITemplate.java @@ -179,7 +179,7 @@ public final class URITemplate { public boolean match(String uri, MultivaluedMap<String, String> templateVariableToValue) { if (uri == null) { - return (templateRegexPattern == null) ? true : false; + return templateRegexPattern == null; } if (templateRegexPattern == null) { 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 b87f0d57c0..2aaf1baf0a 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 @@ -1071,7 +1071,7 @@ public final class InjectionUtils { } else { String result = null; if (!paramValues.isEmpty()) { - boolean isLast = pathParam == ParameterType.PATH ? true : false; + boolean isLast = pathParam == ParameterType.PATH; result = isLast ? paramValues.get(paramValues.size() - 1) : paramValues.get(0); } diff --git a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodInvoker.java b/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodInvoker.java index 81d7b97dcd..9b105a230a 100644 --- a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodInvoker.java +++ b/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodInvoker.java @@ -84,7 +84,7 @@ public class JAXWSMethodInvoker extends AbstractJAXWSMethodInvoker { } res = CastUtils.cast((List<?>)super.invoke(exchange, serviceObject, m, params)); - if ((serviceObject instanceof Provider) + if (serviceObject instanceof Provider && MessageUtils.getContextualBoolean(exchange.getInMessage(), "jaxws.provider.interpretNullAsOneway", true) diff --git a/rt/javascript/javascript-rt/src/main/java/org/apache/cxf/javascript/JavascriptUtils.java b/rt/javascript/javascript-rt/src/main/java/org/apache/cxf/javascript/JavascriptUtils.java index de14081de8..298001c206 100755 --- a/rt/javascript/javascript-rt/src/main/java/org/apache/cxf/javascript/JavascriptUtils.java +++ b/rt/javascript/javascript-rt/src/main/java/org/apache/cxf/javascript/JavascriptUtils.java @@ -99,7 +99,7 @@ public class JavascriptUtils { private String xmlStringAccumulatorVariable; public JavascriptUtils(StringBuilder code) { - this.code = code; + this.code = code == null ? new StringBuilder(128) : code; prefixStack.push(" "); } diff --git a/rt/javascript/javascript-rt/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java b/rt/javascript/javascript-rt/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java index 9f3785c662..e2664dca61 100755 --- a/rt/javascript/javascript-rt/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java +++ b/rt/javascript/javascript-rt/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java @@ -124,7 +124,7 @@ public class ServiceJavascriptBuilder extends ServiceModelVisitor { NameManager nameManager) { super(serviceInfo); this.endpointAddress = endpointAddress; - code = new StringBuilder(); + code = new StringBuilder(512); utils = new JavascriptUtils(code); this.nameManager = nameManager; xmlSchemaCollection = serviceInfo.getXmlSchemaCollection(); diff --git a/rt/javascript/javascript-rt/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java b/rt/javascript/javascript-rt/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java index c58b392448..f289eccc23 100755 --- a/rt/javascript/javascript-rt/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java +++ b/rt/javascript/javascript-rt/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java @@ -78,7 +78,7 @@ public class SchemaJavascriptBuilder { } public String generateCodeForSchemaCollection(XmlSchemaCollection collection) { - StringBuilder accumulatedCode = new StringBuilder(); + StringBuilder accumulatedCode = new StringBuilder(128); for (XmlSchema schema : collection.getXmlSchemas()) { if (!Constants.URI_2001_SCHEMA_XSD.equals(schema.getTargetNamespace())) { accumulatedCode.append(generateCodeForSchema(schema)); @@ -89,7 +89,7 @@ public class SchemaJavascriptBuilder { public String generateCodeForSchema(XmlSchema schema) { xmlSchema = schema; - code = new StringBuilder(); + code = new StringBuilder(512); code.append("//\n"); code.append("// Definitions for schema: ").append(schema.getTargetNamespace()); if (schema.getSourceURI() != null) { @@ -173,7 +173,7 @@ public class SchemaJavascriptBuilder { // of parameters, it's the least of the evils. public void complexTypeConstructorAndAccessors(QName name, XmlSchemaComplexType type) { - accessors = new StringBuilder(); + accessors = new StringBuilder(512); utils = new JavascriptUtils(code); List<XmlSchemaObject> items = JavascriptUtils.getContentElements(type, xmlSchemaCollection); List<XmlSchemaAnnotated> attrs = XmlSchemaUtils.getContentAttributes(type, xmlSchemaCollection); @@ -291,7 +291,7 @@ public class SchemaJavascriptBuilder { */ public void complexTypeSerializerFunction(QName name, XmlSchemaComplexType type) { - StringBuilder bodyCode = new StringBuilder(); + StringBuilder bodyCode = new StringBuilder(128); JavascriptUtils bodyUtils = new JavascriptUtils(bodyCode); bodyUtils.setXmlStringAccumulator("xml"); diff --git a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/ClientConfiguration.java b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/ClientConfiguration.java index 5305da2065..09a597769b 100644 --- a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/ClientConfiguration.java +++ b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/ClientConfiguration.java @@ -86,7 +86,7 @@ public class ClientConfiguration implements InterceptorProvider, ConduitSelector * @return true if the response can be expected */ public boolean isResponseExpectedForOneway() { - return getConduit() instanceof HTTPConduit ? true : false; + return getConduit() instanceof HTTPConduit; } /** diff --git a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java index eaedd4b07a..76bd2b6e28 100644 --- a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java +++ b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java @@ -767,7 +767,7 @@ public class WebClient extends AbstractClient { if (path == null) { return back(true); } - back(path.startsWith("/") ? true : false); + back(path.startsWith("/")); return path(path); } diff --git a/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/client/FiqlSearchConditionBuilder.java b/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/client/FiqlSearchConditionBuilder.java index 45e56bf900..f33da1b7ae 100644 --- a/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/client/FiqlSearchConditionBuilder.java +++ b/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/client/FiqlSearchConditionBuilder.java @@ -323,8 +323,8 @@ public class FiqlSearchConditionBuilder extends SearchConditionBuilder { } public PartialCondition and() { - if (currentCompositeOp == FiqlParser.OR - || parent != null && parent.currentCompositeOp == FiqlParser.OR) { + if (FiqlParser.OR.equals(currentCompositeOp) + || parent != null && FiqlParser.OR.equals(parent.currentCompositeOp)) { if (parent != null) { parent.result = "(" + parent.result; result += ")"; @@ -342,8 +342,8 @@ public class FiqlSearchConditionBuilder extends SearchConditionBuilder { } public PartialCondition or() { - if (currentCompositeOp == FiqlParser.AND - || parent != null && parent.currentCompositeOp == FiqlParser.AND) { + if (FiqlParser.AND.equals(currentCompositeOp) + || parent != null && FiqlParser.AND.equals(parent.currentCompositeOp)) { if (parent != null) { parent.result = "(" + parent.result; result += ")"; diff --git a/rt/rs/microprofile-client/src/test/java/org/apache/cxf/microprofile/client/cdi/RestClientCdiTest.java b/rt/rs/microprofile-client/src/test/java/org/apache/cxf/microprofile/client/cdi/RestClientCdiTest.java index 019f894912..1db34c0bc7 100644 --- a/rt/rs/microprofile-client/src/test/java/org/apache/cxf/microprofile/client/cdi/RestClientCdiTest.java +++ b/rt/rs/microprofile-client/src/test/java/org/apache/cxf/microprofile/client/cdi/RestClientCdiTest.java @@ -90,7 +90,7 @@ public class RestClientCdiTest { } @Test - @SuppressWarnings({"unchecked", "rawTypes"}) + @SuppressWarnings({"unchecked", "rawtypes"}) public void testCreationalContextsReleasedOnClientClose() throws Exception { IMocksControl control = EasyMock.createStrictControl(); BeanManager mockedBeanMgr = control.createMock(BeanManager.class); @@ -123,7 +123,7 @@ public class RestClientCdiTest { } @Test - @SuppressWarnings({"unchecked", "rawTypes"}) + @SuppressWarnings({"unchecked", "rawtypes"}) public void testCreationalContextsNotReleasedOnClientCloseUsingNormalScope() throws Exception { IMocksControl control = EasyMock.createStrictControl(); BeanManager mockedBeanMgr = control.createMock(BeanManager.class); diff --git a/rt/rs/security/jose-parent/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/multipart/JwsMultipartSignatureInFilter.java b/rt/rs/security/jose-parent/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/multipart/JwsMultipartSignatureInFilter.java index 94fa717072..9257bdc9bc 100644 --- a/rt/rs/security/jose-parent/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/multipart/JwsMultipartSignatureInFilter.java +++ b/rt/rs/security/jose-parent/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/multipart/JwsMultipartSignatureInFilter.java @@ -127,7 +127,7 @@ public class JwsMultipartSignatureInFilter implements MultipartInputFilter { } catch (IOException ex) { throw ExceptionUtils.toBadRequestException(ex, null); } - boolean verifyOnLastRead = i == attSize - 1 ? true : false; + boolean verifyOnLastRead = i == attSize - 1; JwsInputStream jwsStream = new JwsInputStream(dataPartStream, sig, signatureBytes, verifyOnLastRead); final InputStream newStream; diff --git a/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/AbstractContentEncryptionCipherProperties.java b/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/AbstractContentEncryptionCipherProperties.java index 2c3ee9009f..a9f2b9194e 100644 --- a/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/AbstractContentEncryptionCipherProperties.java +++ b/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/AbstractContentEncryptionCipherProperties.java @@ -30,7 +30,6 @@ public abstract class AbstractContentEncryptionCipherProperties implements Conte protected static final Logger LOG = LogUtils.getL7dLogger(AbstractContentEncryptionCipherProperties.class); private static final int DEFAULT_AUTH_TAG_LENGTH = 128; - private final int authTagLen = DEFAULT_AUTH_TAG_LENGTH; private final ContentAlgorithm algo; public AbstractContentEncryptionCipherProperties(ContentAlgorithm algo) { @@ -43,7 +42,7 @@ public abstract class AbstractContentEncryptionCipherProperties implements Conte return JweUtils.getAdditionalAuthenticationData(headersJson, aad); } protected int getAuthTagLen() { - return authTagLen; + return DEFAULT_AUTH_TAG_LENGTH; } @Override public ContentAlgorithm getAlgorithm() { diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/JPAOAuthDataProvider.java b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/JPAOAuthDataProvider.java index 6717d2312e..dcb5be9c62 100644 --- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/JPAOAuthDataProvider.java +++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/JPAOAuthDataProvider.java @@ -294,7 +294,7 @@ public class JPAOAuthDataProvider extends AbstractOAuthDataProvider { private static <T> TypedQuery<T> getQuery(String table, Client c, UserSubject resourceOwnerSubject, EntityManager entityManager, Class<T> resultClass) { - StringBuilder query = new StringBuilder("SELECT t FROM ").append(table).append(" t"); + StringBuilder query = new StringBuilder(64).append("SELECT t FROM ").append(table).append(" t"); Map<String, Object> parameterMap = new HashMap<>(); if (c != null || resourceOwnerSubject != null) { query.append(" WHERE"); diff --git a/rt/rs/sse/src/test/java/org/apache/cxf/jaxrs/sse/OutboundSseEventImplTest.java b/rt/rs/sse/src/test/java/org/apache/cxf/jaxrs/sse/OutboundSseEventImplTest.java index fc7b969cf4..0dbb127791 100644 --- a/rt/rs/sse/src/test/java/org/apache/cxf/jaxrs/sse/OutboundSseEventImplTest.java +++ b/rt/rs/sse/src/test/java/org/apache/cxf/jaxrs/sse/OutboundSseEventImplTest.java @@ -224,7 +224,7 @@ public class OutboundSseEventImplTest { public boolean equals(Object o) { if (o instanceof TestDataImpl && ((TestDataImpl)o).data.size() == data.size()) { for (int i = 0; i < data.size(); i++) { - if (((TestDataImpl)o).data.get(i) != data.get(i)) { + if (!((TestDataImpl)o).data.get(i).equals(data.get(i))) { return false; } } diff --git a/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java b/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java index 35a3f2b91f..ee205c6bf5 100644 --- a/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java +++ b/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java @@ -446,7 +446,7 @@ public class JettyHTTPServerEngine implements ServerEngine, HttpServerEngineSupp if (h instanceof DefaultHandler) { defaultHandler = (DefaultHandler) h; } else { - if ((h instanceof SecurityHandler) + if (h instanceof SecurityHandler && ((SecurityHandler)h).getHandler() == null) { //if h is SecurityHandler(such as ConstraintSecurityHandler) //then it need be on top of JettyHTTPHandler diff --git a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/BackChannelConduit.java b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/BackChannelConduit.java index 5a9550181e..98d39bed4c 100644 --- a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/BackChannelConduit.java +++ b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/BackChannelConduit.java @@ -103,7 +103,7 @@ class BackChannelConduit extends AbstractConduit implements JMSExchangeSender { Exchange exchange = inMessage.getExchange(); exchange.setOutMessage(message); - boolean isTextMessage = (jmsMessage instanceof TextMessage) && !JMSMessageUtils.isMtomEnabled(message); + boolean isTextMessage = jmsMessage instanceof TextMessage && !JMSMessageUtils.isMtomEnabled(message); MessageStreamUtil.prepareStream(message, isTextMessage, this); } diff --git a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java index 8aeb66b9d6..0a45d92741 100644 --- a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java +++ b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java @@ -357,7 +357,7 @@ public class JMSConduit extends AbstractConduit implements JMSExchangeSender, Me return userCID; } else if (!jmsConfig.isSetConduitSelectorPrefix() && !jmsConfig.isReplyPubSubDomain() && exchange.isSynchronous() - && (!jmsConfig.isUseConduitIdSelector())) { + && !jmsConfig.isUseConduitIdSelector()) { // in this case the correlation id will be set to // the message id later return null; diff --git a/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSDestinationTest.java b/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSDestinationTest.java index 6bb17af3a2..46db4fb099 100644 --- a/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSDestinationTest.java +++ b/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSDestinationTest.java @@ -732,6 +732,6 @@ public class JMSDestinationTest extends AbstractJMSTester { type.isAssignableFrom(jmsMsg.getJMSReplyTo().getClass())); String receivedName = getDestinationName(jmsMsg.getJMSReplyTo()); assertTrue("JMS Messsage's replyTo must be named " + expectedName + " but was " + receivedName, - expectedName == receivedName || receivedName.equals(expectedName)); + receivedName.equals(expectedName)); } } \ No newline at end of file diff --git a/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/URIDomainExpression.java b/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/URIDomainExpression.java index 5cd1c4d519..92d818ac43 100644 --- a/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/URIDomainExpression.java +++ b/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/URIDomainExpression.java @@ -354,7 +354,7 @@ public class URIDomainExpression implements DomainExpression { } for (int i = 0; i < args.length; i++) { String matcherGroup = matcher.group(i + 1); - if ((matcherGroup == null) || (!matcherGroup.equals(args[i]))) { + if ((matcherGroup == null) || !matcherGroup.equals(args[i])) { return false; } } diff --git a/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/BaseAlternativeSelector.java b/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/BaseAlternativeSelector.java index 122d0ef006..271f5465f4 100644 --- a/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/BaseAlternativeSelector.java +++ b/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/BaseAlternativeSelector.java @@ -62,7 +62,7 @@ public abstract class BaseAlternativeSelector implements AlternativeSelector { } // Workaround until Neethi assertions implementations do not override equals(): // objects in lists can be different instances - if ((a instanceof PrimitiveAssertion) && (ra instanceof PrimitiveAssertion) + if (a instanceof PrimitiveAssertion && ra instanceof PrimitiveAssertion && ((PrimitiveAssertion) a).equal(ra)) { rNames.remove(ra.getName()); break; diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/HttpsTokenInterceptorProvider.java b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/HttpsTokenInterceptorProvider.java index 2f1db699ef..9bc4d77cf0 100644 --- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/HttpsTokenInterceptorProvider.java +++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/HttpsTokenInterceptorProvider.java @@ -223,7 +223,7 @@ public class HttpsTokenInterceptorProvider extends AbstractPolicyInterceptorProv TLSSessionInfo tlsInfo = message.get(TLSSessionInfo.class); if (tlsInfo != null && tlsInfo.getPeerCertificates() != null && tlsInfo.getPeerCertificates().length > 0 - && (tlsInfo.getPeerCertificates()[0] instanceof X509Certificate) + && tlsInfo.getPeerCertificates()[0] instanceof X509Certificate ) { X509Certificate cert = (X509Certificate)tlsInfo.getPeerCertificates()[0]; message.put( diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxAsymmetricBindingHandler.java b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxAsymmetricBindingHandler.java index 59e8e0f836..1de8d38c40 100644 --- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxAsymmetricBindingHandler.java +++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxAsymmetricBindingHandler.java @@ -437,7 +437,7 @@ public class StaxAsymmetricBindingHandler extends AbstractStaxBindingHandler { AbstractToken sigToken = wrapper.getToken(); configureSignature(sigToken, false); - if (abinding.isProtectTokens() && (sigToken instanceof X509Token) + if (abinding.isProtectTokens() && sigToken instanceof X509Token && sigToken.getIncludeTokenType() != IncludeTokenType.INCLUDE_TOKEN_NEVER) { SecurePart securePart = new SecurePart(new QName(WSSConstants.NS_WSSE10, "BinarySecurityToken"), Modifier.Element); diff --git a/rt/wsdl/src/main/java/org/apache/cxf/wsdl11/WSDLServiceFactory.java b/rt/wsdl/src/main/java/org/apache/cxf/wsdl11/WSDLServiceFactory.java index 49a6c14da0..cd97791df8 100644 --- a/rt/wsdl/src/main/java/org/apache/cxf/wsdl11/WSDLServiceFactory.java +++ b/rt/wsdl/src/main/java/org/apache/cxf/wsdl11/WSDLServiceFactory.java @@ -128,9 +128,9 @@ public class WSDLServiceFactory extends AbstractServiceFactoryBean { } else { javax.wsdl.Service wsdlService = definition.getService(serviceName); if (wsdlService == null) { - if ((!PartialWSDLProcessor.isServiceExisted(definition, serviceName)) - && (!PartialWSDLProcessor.isBindingExisted(definition, serviceName)) - && (PartialWSDLProcessor.isPortTypeExisted(definition, serviceName))) { + if (!PartialWSDLProcessor.isServiceExisted(definition, serviceName) + && !PartialWSDLProcessor.isBindingExisted(definition, serviceName) + && PartialWSDLProcessor.isPortTypeExisted(definition, serviceName)) { try { Map<QName, PortType> portTypes = CastUtils.cast(definition.getAllPortTypes()); String existPortName = null; diff --git a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/rest/RESTSecurityTokenServiceImpl.java b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/rest/RESTSecurityTokenServiceImpl.java index 8101180e93..5ce90bbb2f 100644 --- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/rest/RESTSecurityTokenServiceImpl.java +++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/rest/RESTSecurityTokenServiceImpl.java @@ -386,7 +386,7 @@ public class RESTSecurityTokenServiceImpl extends SecurityTokenServiceImpl imple PhaseInterceptorChain.getCurrentMessage().get(TLSSessionInfo.class); if (tlsInfo != null && tlsInfo.getPeerCertificates() != null && tlsInfo.getPeerCertificates().length > 0 - && (tlsInfo.getPeerCertificates()[0] instanceof X509Certificate) + && tlsInfo.getPeerCertificates()[0] instanceof X509Certificate ) { return (X509Certificate)tlsInfo.getPeerCertificates()[0]; } diff --git a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/DefaultSubjectProvider.java b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/DefaultSubjectProvider.java index 31055280c3..49f6f37e80 100644 --- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/DefaultSubjectProvider.java +++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/DefaultSubjectProvider.java @@ -168,7 +168,7 @@ public class DefaultSubjectProvider implements SubjectProvider { LdapName ln = new LdapName(principal.getName()); for (Rdn rdn : ln.getRdns()) { - if ("CN".equalsIgnoreCase(rdn.getType()) && (rdn.getValue() instanceof String)) { + if ("CN".equalsIgnoreCase(rdn.getType()) && rdn.getValue() instanceof String) { subjectName = (String)rdn.getValue(); break; } diff --git a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/X509TokenValidator.java b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/X509TokenValidator.java index 92a4a0c8de..4e6f776cc4 100644 --- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/X509TokenValidator.java +++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/X509TokenValidator.java @@ -97,7 +97,7 @@ public class X509TokenValidator implements TokenValidator { */ public boolean canHandleToken(ReceivedToken validateTarget, String realm) { Object token = validateTarget.getToken(); - if ((token instanceof BinarySecurityTokenType) + if (token instanceof BinarySecurityTokenType && X509_V3_TYPE.equals(((BinarySecurityTokenType)token).getValueType())) { return true; } else if (token instanceof Element diff --git a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/DummyTokenValidator.java b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/DummyTokenValidator.java index caeed66ce6..beb460a946 100644 --- a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/DummyTokenValidator.java +++ b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/DummyTokenValidator.java @@ -37,7 +37,7 @@ public class DummyTokenValidator implements TokenValidator { public boolean canHandleToken(ReceivedToken validateTarget) { Object token = validateTarget.getToken(); - return (token instanceof BinarySecurityTokenType) + return token instanceof BinarySecurityTokenType && TOKEN_TYPE.equals(((BinarySecurityTokenType)token).getValueType()); } diff --git a/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/deployment/CustomBSTTokenValidator.java b/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/deployment/CustomBSTTokenValidator.java index 1b2bca4a20..bdb06af0f5 100644 --- a/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/deployment/CustomBSTTokenValidator.java +++ b/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/deployment/CustomBSTTokenValidator.java @@ -40,7 +40,7 @@ public class CustomBSTTokenValidator implements TokenValidator { public boolean canHandleToken(ReceivedToken validateTarget) { Object token = validateTarget.getToken(); - return (token instanceof BinarySecurityTokenType) + return token instanceof BinarySecurityTokenType && TOKEN_TYPE.equals(((BinarySecurityTokenType)token).getValueType()); } diff --git a/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java b/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java index 80949f4f90..d8d8f3680a 100644 --- a/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java +++ b/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java @@ -1289,6 +1289,6 @@ public class HandlerInvocationTest extends AbstractBusClientServerTestBase { private boolean isValidWsdlDescription(Object wsdlDescription) { return (wsdlDescription != null) - && ((wsdlDescription instanceof java.net.URI) || (wsdlDescription instanceof java.net.URL)); + && (wsdlDescription instanceof java.net.URI || wsdlDescription instanceof java.net.URL); } } diff --git a/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/TestSOAPHandler.java b/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/TestSOAPHandler.java index 2c9940964a..549207c96b 100644 --- a/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/TestSOAPHandler.java +++ b/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/TestSOAPHandler.java @@ -310,6 +310,6 @@ public class TestSOAPHandler extends TestHandlerBase private boolean isValidWsdlDescription(Object wsdlDescription) { return (wsdlDescription != null) - && ((wsdlDescription instanceof java.net.URI) || (wsdlDescription instanceof java.net.URL)); + && (wsdlDescription instanceof java.net.URI || wsdlDescription instanceof java.net.URL); } } diff --git a/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/AttachmentStreamSourceXMLProvider.java b/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/AttachmentStreamSourceXMLProvider.java index 4c21cf3caa..04f4756a62 100644 --- a/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/AttachmentStreamSourceXMLProvider.java +++ b/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/AttachmentStreamSourceXMLProvider.java @@ -85,7 +85,7 @@ public class AttachmentStreamSourceXMLProvider implements Provider<StreamSource> InputStream is = entry.getValue().getInputStream(); IOUtils.copy(is, bous); - buf.append("<att contentId=\"" + entry.getKey() + "\">"); + buf.append("<att contentId=\"").append(entry.getKey()).append("\">"); buf.append(Base64Utility.encode(bous.toByteArray())); buf.append("</att>"); diff --git a/systests/tracing/src/test/java/org/apache/cxf/systest/brave/BraveTestSupport.java b/systests/tracing/src/test/java/org/apache/cxf/systest/brave/BraveTestSupport.java index c44c9e860d..edc9401347 100644 --- a/systests/tracing/src/test/java/org/apache/cxf/systest/brave/BraveTestSupport.java +++ b/systests/tracing/src/test/java/org/apache/cxf/systest/brave/BraveTestSupport.java @@ -19,12 +19,15 @@ package org.apache.cxf.systest.brave; -public abstract class BraveTestSupport { +public final class BraveTestSupport { public static final String TRACE_ID_NAME = "X-B3-TraceId"; public static final String SPAN_ID_NAME = "X-B3-SpanId"; public static final String PARENT_SPAN_ID_NAME = "X-B3-ParentSpanId"; public static final String SAMPLED_NAME = "X-B3-Sampled"; + private BraveTestSupport() { + } + public static class SpanId { private long traceId; private long spanId; diff --git a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/wssc/WSSCTest.java b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/wssc/WSSCTest.java index 934caef166..24f4310dd6 100644 --- a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/wssc/WSSCTest.java +++ b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/wssc/WSSCTest.java @@ -89,7 +89,7 @@ public class WSSCTest extends AbstractBusClientServerTestBase { } public String toString() { return prefix + ":" - + port + ((port == STAX_PORT || port == STAX_PORT2) ? "(stax)" : "") + + port + ((STAX_PORT.equals(port) || STAX_PORT2.equals(port)) ? "(stax)" : "") + ":" + (streaming ? "streaming" : "dom") + (clearAction ? "/no SOAPAction" : ""); } diff --git a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addressing/MAPVerifier.java b/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addressing/MAPVerifier.java index 2799b835ec..de29ccfd83 100644 --- a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addressing/MAPVerifier.java +++ b/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addressing/MAPVerifier.java @@ -72,7 +72,7 @@ public class MAPVerifier extends AbstractPhaseInterceptor<Message> { String expected = exposeAs != null ? exposeAs : Names.WSA_NAMESPACE_NAME; - if (maps.getNamespaceURI() != expected) { + if (!maps.getNamespaceURI().equals(expected)) { verificationCache.put("Incoming version mismatch" + " expected: " + expected + " got: " + maps.getNamespaceURI()); diff --git a/tools/common/src/main/java/org/apache/cxf/tools/common/ToolContext.java b/tools/common/src/main/java/org/apache/cxf/tools/common/ToolContext.java index 7192334ec7..af7ce07220 100644 --- a/tools/common/src/main/java/org/apache/cxf/tools/common/ToolContext.java +++ b/tools/common/src/main/java/org/apache/cxf/tools/common/ToolContext.java @@ -156,7 +156,7 @@ public class ToolContext { } public boolean optionSet(String key) { - return (get(key) == null) ? false : true; + return get(key) != null; } public boolean isVerbose() { diff --git a/tools/common/src/main/java/org/apache/cxf/tools/common/ToolErrorListener.java b/tools/common/src/main/java/org/apache/cxf/tools/common/ToolErrorListener.java index 7d3824f5e1..8731efd9d2 100644 --- a/tools/common/src/main/java/org/apache/cxf/tools/common/ToolErrorListener.java +++ b/tools/common/src/main/java/org/apache/cxf/tools/common/ToolErrorListener.java @@ -82,7 +82,7 @@ public class ToolErrorListener { public void throwToolException() { StringBuilder b = new StringBuilder(); for (ErrorInfo e : errors) { - createMessage(b, e).append("\n"); + createMessage(b, e).append('\n'); } throw new ToolException(b.toString(), errors); } diff --git a/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/CommandLineParser.java b/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/CommandLineParser.java index 103f681c54..14ae791b71 100644 --- a/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/CommandLineParser.java +++ b/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/CommandLineParser.java @@ -310,7 +310,7 @@ public class CommandLineParser { "annotation"); - if ((annotations != null) && (!annotations.isEmpty())) { + if ((annotations != null) && !annotations.isEmpty()) { result = annotations.get(0).getFirstChild().getNodeValue(); } return result; diff --git a/tools/corba/src/main/java/org/apache/cxf/tools/corba/IDLToWSDL.java b/tools/corba/src/main/java/org/apache/cxf/tools/corba/IDLToWSDL.java index 6f3a3198ae..e9d2802425 100644 --- a/tools/corba/src/main/java/org/apache/cxf/tools/corba/IDLToWSDL.java +++ b/tools/corba/src/main/java/org/apache/cxf/tools/corba/IDLToWSDL.java @@ -205,8 +205,8 @@ public class IDLToWSDL extends AbstractCXFToolContainer { if (doc.hasParameter(ToolCorbaConstants.CFG_SEQUENCE_OCTET_TYPE)) { String sequenceOctetType = doc.getParameter(ToolCorbaConstants.CFG_SEQUENCE_OCTET_TYPE); if (sequenceOctetType != null - && (!(sequenceOctetType.equals(ToolCorbaConstants.CFG_SEQUENCE_OCTET_TYPE_BASE64BINARY) - || sequenceOctetType.equals(ToolCorbaConstants.CFG_SEQUENCE_OCTET_TYPE_HEXBINARY)))) { + && !(sequenceOctetType.equals(ToolCorbaConstants.CFG_SEQUENCE_OCTET_TYPE_BASE64BINARY) + || sequenceOctetType.equals(ToolCorbaConstants.CFG_SEQUENCE_OCTET_TYPE_HEXBINARY))) { errors.add(new ErrorVisitor.UserError("Invalid value specified for -s option")); } } diff --git a/tools/corba/src/main/java/org/apache/cxf/tools/corba/common/ProcessorEnvironment.java b/tools/corba/src/main/java/org/apache/cxf/tools/corba/common/ProcessorEnvironment.java index c24dd11e91..1dc2db4bb5 100644 --- a/tools/corba/src/main/java/org/apache/cxf/tools/corba/common/ProcessorEnvironment.java +++ b/tools/corba/src/main/java/org/apache/cxf/tools/corba/common/ProcessorEnvironment.java @@ -102,7 +102,7 @@ public class ProcessorEnvironment { } public boolean optionSet(String key) { - return (get(key) == null) ? false : true; + return get(key) != null; } public boolean isVerbose() { diff --git a/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/PortTypeVisitor.java b/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/PortTypeVisitor.java index b3f2348feb..9498736a6c 100644 --- a/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/PortTypeVisitor.java +++ b/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/PortTypeVisitor.java @@ -391,7 +391,7 @@ public class PortTypeVisitor extends VisitorBase { interfaceNameNode = interfaceNameNode.getNextSibling(); } - if ((!inheritedScopes.isEmpty()) + if (!inheritedScopes.isEmpty() && (wsdlVisitor.getInheritedScopeMap() != null)) { wsdlVisitor.getInheritedScopeMap().put(childScope, inheritedScopes); } diff --git a/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ScopedNameVisitor.java b/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ScopedNameVisitor.java index e747276722..8042777293 100644 --- a/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ScopedNameVisitor.java +++ b/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ScopedNameVisitor.java @@ -523,11 +523,11 @@ public class ScopedNameVisitor extends VisitorBase { Scope scopedName) { CorbaType result = null; for (CorbaType type : typeMap.getStructOrExceptionOrUnion()) { - if ((type instanceof Sequence) - || (type instanceof Array) + if (type instanceof Sequence + || type instanceof Array || (type.getType() == null) - || (type instanceof Anonsequence) - || (type instanceof Anonarray)) { + || type instanceof Anonsequence + || type instanceof Anonarray) { //REVISIT, cannot compare the type because they are incorrect if (type.getQName().getLocalPart().equals(schemaTypeName.getLocalPart())) { result = type; @@ -600,7 +600,7 @@ public class ScopedNameVisitor extends VisitorBase { if (holder != null) { populateAliasSchemaType(corbaType, wsdlVisitor, holder); } - } else if (((corbaType instanceof Sequence) || (corbaType instanceof Anonsequence)) + } else if ((corbaType instanceof Sequence || corbaType instanceof Anonsequence) && ((corbaType.getType().equals(Constants.XSD_BASE64)))) { //special case of sequence of octets result = true; @@ -622,7 +622,7 @@ public class ScopedNameVisitor extends VisitorBase { Alias alias = (Alias) corbaType; //loop through alias base types, till you get a non-alias corba type CorbaType type = findCorbaType(typeMap, alias.getBasetype()); - while ((type != null) && (type instanceof Alias)) { + while ((type != null) && type instanceof Alias) { alias = (Alias) type; type = findCorbaType(typeMap, alias.getBasetype()); } diff --git a/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/wsdl/WSDLToCorbaHelper.java b/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/wsdl/WSDLToCorbaHelper.java index 0cd6cde4aa..8b2255d762 100644 --- a/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/wsdl/WSDLToCorbaHelper.java +++ b/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/wsdl/WSDLToCorbaHelper.java @@ -874,12 +874,12 @@ public class WSDLToCorbaHelper { public boolean isLiteralArray(XmlSchemaComplexType type) { boolean array = false; - if ((type.getAttributes().isEmpty()) - && (type.getParticle() instanceof XmlSchemaSequence)) { + if (type.getAttributes().isEmpty() + && type.getParticle() instanceof XmlSchemaSequence) { XmlSchemaSequence stype = (XmlSchemaSequence)type.getParticle(); if ((stype.getItems().size() == 1) - && (stype.getItems().get(0) instanceof XmlSchemaElement)) { + && stype.getItems().get(0) instanceof XmlSchemaElement) { XmlSchemaElement el = (XmlSchemaElement)stype.getItems().get(0); if (el.getMaxOccurs() != 1) { // it's a literal array @@ -1578,8 +1578,8 @@ public class WSDLToCorbaHelper { private boolean isAddressingNamespace(QName typeName) { return (typeName != null) - && (!isIDLObjectType(typeName)) - && (typeName.getNamespaceURI().equals(ReferenceConstants.WSADDRESSING_NAMESPACE)); + && !isIDLObjectType(typeName) + && typeName.getNamespaceURI().equals(ReferenceConstants.WSADDRESSING_NAMESPACE); } protected static boolean queryBinding(Definition definition, QName bqname) { diff --git a/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/wsdl/WSDLToCorbaProcessor.java b/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/wsdl/WSDLToCorbaProcessor.java index 63539de4d0..3bd8db12d7 100644 --- a/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/wsdl/WSDLToCorbaProcessor.java +++ b/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/wsdl/WSDLToCorbaProcessor.java @@ -126,7 +126,7 @@ public class WSDLToCorbaProcessor extends WSDLToProcessor { wsdlToCorbaBinding.mapBindingToInterface(env.get("porttype").toString(), env.get("binding") .toString()); } - if ((!env.optionSet(ToolConstants.CFG_PORTTYPE)) + if (!env.optionSet(ToolConstants.CFG_PORTTYPE) && !env.optionSet(ToolConstants.CFG_BINDING)) { wsdlToCorbaBinding.setAllBindings(true); } @@ -166,7 +166,7 @@ public class WSDLToCorbaProcessor extends WSDLToProcessor { } else { //try to get the binding name from the wsdlToCorbaBinding java.util.List<String> bindingNames = wsdlToCorbaBinding.getGeneratedBindingNames(); - if ((bindingNames != null) && (!bindingNames.isEmpty())) { + if ((bindingNames != null) && !bindingNames.isEmpty()) { idlAction.setBindingName(bindingNames.get(0)); if (bindingNames.size() > 1) { System.err.println("Warning: Generating idl only for the binding " diff --git a/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/wsdl/WSDLToIDLAction.java b/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/wsdl/WSDLToIDLAction.java index 3c7de6aab6..950807cd31 100644 --- a/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/wsdl/WSDLToIDLAction.java +++ b/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/wsdl/WSDLToIDLAction.java @@ -376,7 +376,7 @@ public class WSDLToIDLAction { IdlDefn result = root.lookup(name); if (result != null - && (!(result instanceof IdlType))) { + && !(result instanceof IdlType)) { String msgStr = idlType.getLocalPart() + " is an incorrect idltype."; org.apache.cxf.common.i18n.Message msg = new org.apache.cxf.common.i18n.Message(msgStr, LOG); @@ -546,7 +546,7 @@ public class WSDLToIDLAction { Object obj = scope.lookup(local); - if (obj != null && (obj instanceof IdlException)) { + if (obj instanceof IdlException) { result = (IdlType)obj; } else { IdlException exc = IdlException.create(scope, local); diff --git a/tools/corba/src/main/java/org/apache/cxf/tools/corba/utils/FileOutputStreamFactory.java b/tools/corba/src/main/java/org/apache/cxf/tools/corba/utils/FileOutputStreamFactory.java index 9fff88cc83..b00e784673 100644 --- a/tools/corba/src/main/java/org/apache/cxf/tools/corba/utils/FileOutputStreamFactory.java +++ b/tools/corba/src/main/java/org/apache/cxf/tools/corba/utils/FileOutputStreamFactory.java @@ -53,8 +53,8 @@ public class FileOutputStreamFactory implements OutputStreamFactory { dirName = ""; } - if ((!"".equals(dirName)) - && (!".".equals(dirName))) { + if (!"".equals(dirName) + && !".".equals(dirName)) { if (!dirName.endsWith(File.separator)) { dirName += File.separator; } @@ -122,7 +122,7 @@ public class FileOutputStreamFactory implements OutputStreamFactory { throws IOException { String packageDirName = convertPackageNameToDirectory(packageName); - if ((!"".equals(packageDirName)) && (!packageDirName.endsWith(File.separator))) { + if (!"".equals(packageDirName) && !packageDirName.endsWith(File.separator)) { packageDirName += File.separator; } @@ -136,7 +136,7 @@ public class FileOutputStreamFactory implements OutputStreamFactory { throws IOException { String packageDirName = convertPackageNameToDirectory(packageName); - if ((!"".equals(packageDirName)) && (!packageDirName.endsWith(File.separator))) { + if (!"".equals(packageDirName) && !packageDirName.endsWith(File.separator)) { packageDirName += File.separator; } @@ -146,7 +146,7 @@ public class FileOutputStreamFactory implements OutputStreamFactory { dname = dirName + packageDirName; } - if ((!"".equals(dname)) && (!".".equals(dname))) { + if (!"".equals(dname) && !".".equals(dname)) { File file = new File(dname); file.mkdirs(); } @@ -200,7 +200,7 @@ public class FileOutputStreamFactory implements OutputStreamFactory { public boolean isOutputStreamExists(String packageName, String name) { String dname = getClassDirectory(packageName); - if ((!"".equals(dname)) && (!dname.endsWith(File.separator))) { + if (!"".equals(dname) && !dname.endsWith(File.separator)) { dname += File.separator; } diff --git a/tools/corba/src/test/java/org/apache/cxf/tools/corba/processors/WSDLToIDLGenerationTest.java b/tools/corba/src/test/java/org/apache/cxf/tools/corba/processors/WSDLToIDLGenerationTest.java index 49e48152b9..6ed5d121f8 100644 --- a/tools/corba/src/test/java/org/apache/cxf/tools/corba/processors/WSDLToIDLGenerationTest.java +++ b/tools/corba/src/test/java/org/apache/cxf/tools/corba/processors/WSDLToIDLGenerationTest.java @@ -74,7 +74,7 @@ public class WSDLToIDLGenerationTest { if (sgen.trim().startsWith(START_COMMENT)) { genComment = true; } - if ((!origComment) && (!genComment)) { + if (!origComment && !genComment) { assertEquals(sorig, sgen); sgen = genReader.readLine(); sorig = origReader.readLine(); diff --git a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2js/processor/JavaToJSProcessor.java b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2js/processor/JavaToJSProcessor.java index 6ef5ada0ac..71b69b83ea 100644 --- a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2js/processor/JavaToJSProcessor.java +++ b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2js/processor/JavaToJSProcessor.java @@ -26,6 +26,7 @@ import java.io.OutputStream; import java.io.OutputStreamWriter; import java.nio.file.Files; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.List; import java.util.logging.Level; @@ -124,9 +125,7 @@ public class JavaToJSProcessor implements Processor { beanDefinitions.addAll((List<String>)beanFilesParameter); } else { String[] list = (String[])beanFilesParameter; - for (String b : list) { - beanDefinitions.add(b); - } + beanDefinitions.addAll(Arrays.asList(list)); } } diff --git a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/JavaToWSDLProcessor.java b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/JavaToWSDLProcessor.java index 2bcb140e2d..a6cbb37f03 100644 --- a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/JavaToWSDLProcessor.java +++ b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/JavaToWSDLProcessor.java @@ -21,6 +21,7 @@ package org.apache.cxf.tools.java2wsdl.processor; import java.io.File; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; @@ -169,9 +170,7 @@ public class JavaToWSDLProcessor implements Processor { beanDefinitions.addAll((List<String>)beanFilesParameter); } else { String[] list = (String[]) beanFilesParameter; - for (String b : list) { - beanDefinitions.add(b); - } + beanDefinitions.addAll(Arrays.asList(list)); } } diff --git a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/JaxwsImplGenerator.java b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/JaxwsImplGenerator.java index 2f439a1b71..a079607e19 100644 --- a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/JaxwsImplGenerator.java +++ b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/JaxwsImplGenerator.java @@ -39,7 +39,7 @@ public class JaxwsImplGenerator extends AbstractJaxwsGenerator { public boolean passthrough() { Boolean genFromSei = (Boolean)env.get(ToolConstants.GEN_FROM_SEI); return !(genFromSei && env.optionSet(ToolConstants.CFG_SERVER) - && (!env.optionSet(ToolConstants.IMPL_CLASS))); + && !env.optionSet(ToolConstants.IMPL_CLASS)); } public void generate(ToolContext penv) throws ToolException { diff --git a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/JaxwsSEIGenerator.java b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/JaxwsSEIGenerator.java index 1eb1807863..65735f29e9 100644 --- a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/JaxwsSEIGenerator.java +++ b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/JaxwsSEIGenerator.java @@ -38,7 +38,7 @@ public class JaxwsSEIGenerator extends AbstractJaxwsGenerator { public boolean passthrough() { Boolean genFromSei = (Boolean)env.get(ToolConstants.GEN_FROM_SEI); return !(!genFromSei && env.optionSet(ToolConstants.CFG_CLIENT) - && (!env.optionSet(ToolConstants.SEI_CLASS))); + && !env.optionSet(ToolConstants.SEI_CLASS)); } diff --git a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/SimpleImplGenerator.java b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/SimpleImplGenerator.java index 4c0f910fcf..b4d81c97ff 100644 --- a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/SimpleImplGenerator.java +++ b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/SimpleImplGenerator.java @@ -37,7 +37,7 @@ public class SimpleImplGenerator extends AbstractSimpleGenerator { public boolean passthrough() { Boolean genFromSei = (Boolean)env.get(ToolConstants.GEN_FROM_SEI); return !(genFromSei && env.optionSet(ToolConstants.CFG_SERVER) - && (!env.optionSet(ToolConstants.IMPL_CLASS))); + && !env.optionSet(ToolConstants.IMPL_CLASS)); } diff --git a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/SimpleSEIGenerator.java b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/SimpleSEIGenerator.java index dc0054ce11..212aa64c54 100644 --- a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/SimpleSEIGenerator.java +++ b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/SimpleSEIGenerator.java @@ -37,7 +37,7 @@ public class SimpleSEIGenerator extends AbstractSimpleGenerator { public boolean passthrough() { Boolean genFromSei = (Boolean)env.get(ToolConstants.GEN_FROM_SEI); return !(!genFromSei && env.optionSet(ToolConstants.CFG_CLIENT) - && (!env.optionSet(ToolConstants.SEI_CLASS))); + && !env.optionSet(ToolConstants.SEI_CLASS)); } diff --git a/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java b/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java index 391ee12304..fa1ef3d314 100644 --- a/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java +++ b/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java @@ -587,7 +587,7 @@ public class WSDLRefValidator extends AbstractDefinitionValidator { if (isElement) { XmlSchemaElement schemaEle = schemaCollection.getElementByQName(new QName(WSDLConstants.NS_SCHEMA_XSD, name)); - partvalid = schemaEle != null ? true : false; + partvalid = schemaEle != null; } else { if ("anyType".equals(name)) { return true; @@ -595,7 +595,7 @@ public class WSDLRefValidator extends AbstractDefinitionValidator { XmlSchemaType schemaType = schemaCollection.getTypeByQName(new QName(WSDLConstants.NS_SCHEMA_XSD, name)); - partvalid = schemaType != null ? true : false; + partvalid = schemaType != null; } } else { diff --git a/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java b/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java index b2e942c1ee..ffcba36346 100644 --- a/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java +++ b/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java @@ -455,7 +455,7 @@ public class SourceGenerator { resourceId += DEFAULT_RESOURCE_NAME; } - boolean expandedQName = resourceId.startsWith("{") ? true : false; + boolean expandedQName = resourceId.startsWith("{"); QName qname = convertToQName(resourceId, expandedQName); String namespaceURI = possiblyConvertNamespaceURI(qname.getNamespaceURI(), expandedQName); @@ -939,7 +939,7 @@ public class SourceGenerator { return false; } return methodNames.contains(methodNameLowerCase) - || methodNameLowerCase != id && methodNames.contains(id.toLowerCase()) + || !methodNameLowerCase.equals(id) && methodNames.contains(id.toLowerCase()) || methodNames.size() == 1 && "*".equals(methodNames.iterator().next()); } diff --git a/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/OperationProcessor.java b/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/OperationProcessor.java index c0d6941e8e..958d66edb8 100644 --- a/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/OperationProcessor.java +++ b/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/OperationProcessor.java @@ -405,7 +405,7 @@ public class OperationProcessor extends AbstractProcessor { counter++; } } - return counter > 1 ? true : false; + return counter > 1; } } diff --git a/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToServiceProcessor.java b/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToServiceProcessor.java index d5beb0d5ce..020dd8a6e5 100644 --- a/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToServiceProcessor.java +++ b/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToServiceProcessor.java @@ -79,7 +79,7 @@ public class WSDLToServiceProcessor extends AbstractWSDLToProcessor { break; } } - return (service == null) ? false : true; + return service != null; } private boolean isPortExisted() { @@ -93,7 +93,7 @@ public class WSDLToServiceProcessor extends AbstractWSDLToProcessor { break; } } - return (port == null) ? false : true; + return port != null; } private boolean isBindingExisted() { @@ -108,7 +108,7 @@ public class WSDLToServiceProcessor extends AbstractWSDLToProcessor { binding = entry.getValue(); } } - return (binding == null) ? false : true; + return binding != null; } protected void init() throws ToolException { diff --git a/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToSoapProcessor.java b/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToSoapProcessor.java index fd0be57bd0..4fbf2a6a87 100644 --- a/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToSoapProcessor.java +++ b/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToSoapProcessor.java @@ -124,7 +124,7 @@ public class WSDLToSoapProcessor extends AbstractWSDLToProcessor { break; } } - return (portType == null) ? false : true; + return portType != null; } private boolean isBindingExisted() { @@ -139,7 +139,7 @@ public class WSDLToSoapProcessor extends AbstractWSDLToProcessor { binding = entry.getValue(); } } - return (binding == null) ? false : true; + return binding != null; } private boolean nameSpaceCheck() { diff --git a/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToXMLProcessor.java b/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToXMLProcessor.java index 47a3dc34bb..187186fe3d 100644 --- a/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToXMLProcessor.java +++ b/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToXMLProcessor.java @@ -97,7 +97,7 @@ public class WSDLToXMLProcessor extends AbstractWSDLToProcessor { break; } } - return (service == null) ? false : true; + return service != null; } private boolean isPortExisted() { @@ -111,7 +111,7 @@ public class WSDLToXMLProcessor extends AbstractWSDLToProcessor { break; } } - return (port == null) ? false : true; + return port != null; } private boolean isPortTypeExisted() { @@ -126,7 +126,7 @@ public class WSDLToXMLProcessor extends AbstractWSDLToProcessor { break; } } - return (portType == null) ? false : true; + return portType != null; } private boolean isBindingExisted() { @@ -141,7 +141,7 @@ public class WSDLToXMLProcessor extends AbstractWSDLToProcessor { binding = entry.getValue(); } } - return (binding == null) ? false : true; + return binding != null; } protected void init() throws ToolException {