From fbd1eefbd2e699aed0b193a08e542824f975d4ce Mon Sep 17 00:00:00 2001 From: Lukas Jungmann Date: Mon, 16 Oct 2023 23:21:19 +0200 Subject: [PATCH] code cleanup in wscompile Signed-off-by: Lukas Jungmann --- .../src/main/java/module-info.java | 3 +- .../main/java/com/sun/tools/ws/Invoker.java | 6 +- .../ws/ant/AnnotationProcessingTask.java | 3 +- .../com/sun/tools/ws/ant/WrapperTask.java | 3 +- .../java/com/sun/tools/ws/ant/WsGenBase.java | 14 +-- .../com/sun/tools/ws/ant/WsImportBase.java | 9 +- .../java/com/sun/tools/ws/ant/WsTask2.java | 22 ++-- .../generator/CustomExceptionGenerator.java | 4 +- .../ws/processor/generator/GeneratorBase.java | 6 +- .../generator/GeneratorConstants.java | 4 +- .../processor/generator/JwsImplGenerator.java | 12 +-- .../ws/processor/generator/SeiGenerator.java | 7 +- .../processor/generator/ServiceGenerator.java | 3 +- .../W3CAddressingJavaGeneratorExtension.java | 10 +- .../ws/processor/model/AbstractType.java | 12 +-- .../processor/model/ExtendedModelVisitor.java | 30 +++--- .../sun/tools/ws/processor/model/Fault.java | 22 ++-- .../sun/tools/ws/processor/model/Message.java | 12 +-- .../sun/tools/ws/processor/model/Model.java | 6 +- .../tools/ws/processor/model/ModelObject.java | 12 +-- .../tools/ws/processor/model/Operation.java | 19 ++-- .../tools/ws/processor/model/Response.java | 11 +- .../sun/tools/ws/processor/model/Service.java | 10 +- .../processor/model/java/JavaInterface.java | 18 ++-- .../model/java/JavaStructureType.java | 36 +++---- .../model/jaxb/JAXBStructuredType.java | 24 ++--- .../ws/processor/model/jaxb/JAXBType.java | 4 +- .../processor/modeler/ModelerConstants.java | 4 +- .../annotation/WebServiceConstants.java | 4 +- .../modeler/annotation/WebServiceVisitor.java | 29 ++--- .../WebServiceWrapperGenerator.java | 26 ++--- .../modeler/wsdl/ClassNameAllocatorImpl.java | 4 +- .../processor/modeler/wsdl/ModelerUtils.java | 12 +-- .../modeler/wsdl/PseudoSchemaBuilder.java | 14 ++- .../processor/modeler/wsdl/WSDLModeler.java | 101 ++++++++---------- .../modeler/wsdl/WSDLModelerBase.java | 14 +-- .../ws/processor/util/ClassNameCollector.java | 40 ++++--- .../ws/processor/util/DirectoryUtil.java | 4 +- .../tools/ws/wscompile/FilerCodeWriter.java | 4 +- .../ws/wscompile/JavaCompilerHelper.java | 4 +- .../com/sun/tools/ws/wscompile/Options.java | 6 +- .../sun/tools/ws/wscompile/WsgenOptions.java | 22 ++-- .../com/sun/tools/ws/wscompile/WsgenTool.java | 4 +- .../tools/ws/wscompile/WsimportOptions.java | 12 +-- .../sun/tools/ws/wscompile/WsimportTool.java | 4 +- .../sun/tools/ws/wsdl/document/Binding.java | 16 +-- .../tools/ws/wsdl/document/Definitions.java | 72 ++++++------- .../sun/tools/ws/wsdl/document/Message.java | 6 +- .../tools/ws/wsdl/document/MessagePart.java | 4 +- .../sun/tools/ws/wsdl/document/Operation.java | 4 +- .../sun/tools/ws/wsdl/document/PortType.java | 28 ++--- .../sun/tools/ws/wsdl/document/Service.java | 12 +-- .../tools/ws/wsdl/document/WSDLDocument.java | 34 +++--- .../document/mime/MIMEMultipartRelated.java | 7 +- .../ws/wsdl/document/soap/SOAPHeader.java | 16 +-- .../sun/tools/ws/wsdl/framework/Entity.java | 6 +- .../wsdl/framework/ExtensibilityHelper.java | 12 +-- .../framework/TWSDLParserContextImpl.java | 20 ++-- .../parser/AbstractReferenceFinderImpl.java | 11 +- .../sun/tools/ws/wsdl/parser/DOMBuilder.java | 6 +- .../sun/tools/ws/wsdl/parser/DOMForest.java | 7 +- ...rSubmissionAddressingExtensionHandler.java | 8 +- .../tools/ws/wsdl/parser/MetadataFinder.java | 12 +-- .../com/sun/tools/ws/wsdl/parser/Util.java | 4 +- .../tools/ws/wsdl/parser/VersionChecker.java | 3 +- ...W3CAddressingMetadataExtensionHandler.java | 8 +- .../wscompile/src/main/java/module-info.java | 3 +- .../sun/tools/ws/test/ant/WsAntToolsTest.java | 6 +- .../wscompile/src/test/java/module-info.java | 3 +- 69 files changed, 457 insertions(+), 481 deletions(-) diff --git a/jaxws-ri/bundles/jaxws-tools/src/main/java/module-info.java b/jaxws-ri/bundles/jaxws-tools/src/main/java/module-info.java index 9a9c08b20..5489ff6a4 100644 --- a/jaxws-ri/bundles/jaxws-tools/src/main/java/module-info.java +++ b/jaxws-ri/bundles/jaxws-tools/src/main/java/module-info.java @@ -16,6 +16,7 @@ * * @since 2.4.0 */ +@SuppressWarnings({"deprecation"}) module com.sun.tools.ws { requires transitive java.compiler; @@ -24,7 +25,7 @@ requires transitive com.sun.xml.ws; - requires com.sun.tools.jxc; + requires transitive com.sun.tools.jxc; requires transitive com.sun.tools.xjc; exports com.sun.tools.ws; diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/Invoker.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/Invoker.java index ab564ecdb..5e988e781 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/Invoker.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/Invoker.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -125,8 +125,8 @@ static int invoke(String mainClass, String[] args) throws Throwable { Thread.currentThread().setContextClassLoader(cl); - Class compileTool = cl.loadClass(mainClass); - Constructor ctor = compileTool.getConstructor(OutputStream.class); + Class compileTool = cl.loadClass(mainClass); + Constructor ctor = compileTool.getConstructor(OutputStream.class); Object tool = ctor.newInstance(System.out); Method runMethod = compileTool.getMethod("run",String[].class); boolean r = (Boolean)runMethod.invoke(tool,new Object[]{args}); diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/ant/AnnotationProcessingTask.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/ant/AnnotationProcessingTask.java index ca682ad0d..af3eed883 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/ant/AnnotationProcessingTask.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/ant/AnnotationProcessingTask.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -39,6 +39,7 @@ /** * annotation processing task for use with the JAXWS project. */ +@SuppressWarnings({"exports"}) public class AnnotationProcessingTask extends Javac { private boolean procOnly = false; diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/ant/WrapperTask.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/ant/WrapperTask.java index 944fe5985..091cd7338 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/ant/WrapperTask.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/ant/WrapperTask.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -41,6 +41,7 @@ protected String getCoreClassName() { @Override + @SuppressWarnings({"exports"}) public void setDynamicAttribute(String name, String value) throws BuildException { super.setDynamicAttribute(name,value); if(name.equals("target")) diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/ant/WsGenBase.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/ant/WsGenBase.java index c4985f222..446309ec5 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/ant/WsGenBase.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/ant/WsGenBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -80,7 +80,7 @@ public void setClasspathRef(Reference r) { createClasspath().setRefid(r); } - /************************ -cp option *************************/ + /* *********************** -cp option *************************/ /** * Gets the classpath. * @@ -272,7 +272,7 @@ public void setSei(String endpointImplementationClass) { protected CommandlineJava setupCommand() { CommandlineJava cmd = super.setupCommand(); Path classpath = getClasspath(); - if (classpath != null && !classpath.toString().equals("")) { + if (classpath != null && !classpath.toString().isEmpty()) { cmd.createArgument().setValue("-classpath"); cmd.createArgument().setPath(classpath); } @@ -284,17 +284,17 @@ protected CommandlineJava setupCommand() { if (getGenwsdl()) { String tmp = "-wsdl"; - if (protocol.length() > 0) { + if (!protocol.isEmpty()) { tmp += ":" + protocol; } cmd.createArgument().setValue(tmp); - if (serviceName != null && serviceName.length() > 0) { + if (serviceName != null && !serviceName.isEmpty()) { cmd.createArgument().setValue("-servicename"); cmd.createArgument().setValue(serviceName); } - if (portName != null && portName.length() > 0) { + if (portName != null && !portName.isEmpty()) { cmd.createArgument().setValue("-portname"); cmd.createArgument().setValue(portName); } @@ -307,7 +307,7 @@ protected CommandlineJava setupCommand() { } // r option - if (null != getResourcedestdir() && !getResourcedestdir().getName().equals("")) { + if (null != getResourcedestdir() && !getResourcedestdir().getName().isEmpty()) { cmd.createArgument().setValue("-r"); cmd.createArgument().setFile(getResourcedestdir()); } diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/ant/WsImportBase.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/ant/WsImportBase.java index e230d582c..cfea81223 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/ant/WsImportBase.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/ant/WsImportBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -32,6 +32,7 @@ * * @author lukas */ +@SuppressWarnings({"exports"}) public class WsImportBase extends WsTask2 { /** @@ -430,7 +431,7 @@ protected CommandlineJava setupCommand() { } //catalog - if((getCatalog() != null) && (getCatalog().getName().length() > 0)){ + if((getCatalog() != null) && (!getCatalog().getName().isEmpty())){ cmd.createArgument().setValue("-catalog"); cmd.createArgument().setFile(getCatalog()); } @@ -459,7 +460,7 @@ protected CommandlineJava setupCommand() { } //package - if((getPackage() != null) && (getPackage().length() > 0)){ + if((getPackage() != null) && (!getPackage().isEmpty())){ cmd.createArgument().setValue("-p"); cmd.createArgument().setValue(getPackage()); } @@ -505,7 +506,7 @@ protected CommandlineJava setupCommand() { } } - if((wsdlLocation != null) && (wsdlLocation.length() != 0)){ + if((wsdlLocation != null) && (!wsdlLocation.isEmpty())){ cmd.createArgument().setValue("-wsdllocation"); cmd.createArgument().setValue(wsdlLocation); } diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/ant/WsTask2.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/ant/WsTask2.java index abdc7eae5..fdb1a47c7 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/ant/WsTask2.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/ant/WsTask2.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -500,7 +500,7 @@ protected final void execute(String tool, String toolClass) throws BuildExceptio */ protected CommandlineJava setupCommand() { // d option - if (null != getDestdir() && !getDestdir().getName().equals("")) { + if (null != getDestdir() && !getDestdir().getName().isEmpty()) { getCommandline().createArgument().setValue("-d"); getCommandline().createArgument().setFile(getDestdir()); } @@ -517,7 +517,7 @@ protected CommandlineJava setupCommand() { getCommandline().createArgument().setValue("-keep"); } // s option - if (null != getSourcedestdir() && !getSourcedestdir().getName().equals("")) { + if (null != getSourcedestdir() && !getSourcedestdir().getName().isEmpty()) { getCommandline().createArgument().setValue("-s"); getCommandline().createArgument().setFile(getSourcedestdir()); } @@ -582,29 +582,29 @@ public void setupForkCommand(String className) { cp.append(mvn); } - if (getModulepath() != null && getModulepath().size() > 0) { + if (getModulepath() != null && !getModulepath().isEmpty()) { getCommandline().createModulepath(getProject()).add(getModulepath()); } - if (getUpgrademodulepath() != null && getUpgrademodulepath().size() > 0) { + if (getUpgrademodulepath() != null && !getUpgrademodulepath().isEmpty()) { getCommandline().createUpgrademodulepath(getProject()).add(getUpgrademodulepath()); } - if (getAddmodules() != null && getAddmodules().length() > 0) { + if (getAddmodules() != null && !getAddmodules().isEmpty()) { getCommandline().createVmArgument().setLine("--add-modules " + getAddmodules()); } - if (getAddreads() != null && getAddreads().length() > 0) { + if (getAddreads() != null && !getAddreads().isEmpty()) { getCommandline().createVmArgument().setLine("--add-reads " + getAddreads()); } - if (getAddexports() != null && getAddexports().length() > 0) { + if (getAddexports() != null && !getAddexports().isEmpty()) { getCommandline().createVmArgument().setLine("--add-exports " + getAddexports()); } - if (getAddopens() != null && getAddopens().length() > 0) { + if (getAddopens() != null && !getAddopens().isEmpty()) { getCommandline().createVmArgument().setLine("--add-opens " + getAddopens()); } - if (getPatchmodule() != null && getPatchmodule().length() > 0) { + if (getPatchmodule() != null && !getPatchmodule().isEmpty()) { getCommandline().createVmArgument().setLine("--patch-module " + getPatchmodule()); } - if (getLimitmodules() != null && getLimitmodules().length() > 0) { + if (getLimitmodules() != null && !getLimitmodules().isEmpty()) { getCommandline().createVmArgument().setLine("--limit-modules " + getLimitmodules()); } diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/generator/CustomExceptionGenerator.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/generator/CustomExceptionGenerator.java index 330bc7715..7b8dfd6fc 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/generator/CustomExceptionGenerator.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/generator/CustomExceptionGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -67,7 +67,7 @@ public void visit(Fault fault) throws Exception { } private boolean isRegistered(Fault fault) { - if(faults.keySet().contains(fault.getJavaException().getName())){ + if(faults.containsKey(fault.getJavaException().getName())){ fault.setExceptionClass(faults.get(fault.getJavaException().getName())); return true; } diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/generator/GeneratorBase.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/generator/GeneratorBase.java index b0e87dcfb..8dc728994 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/generator/GeneratorBase.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/generator/GeneratorBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -108,11 +108,11 @@ public void visit(Operation operation) throws Exception { if (operation.getResponse() != null) { operation.getResponse().accept(this); } - Iterator faults = operation.getFaultsSet().iterator(); + Iterator faults = operation.getFaultsSet().iterator(); if (faults != null) { Fault fault; while (faults.hasNext()) { - fault = (Fault) faults.next(); + fault = faults.next(); fault.accept(this); } } diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/generator/GeneratorConstants.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/generator/GeneratorConstants.java index 9d788cc82..0f188bbc6 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/generator/GeneratorConstants.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/generator/GeneratorConstants.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -33,7 +33,7 @@ public enum GeneratorConstants { private String value; - private GeneratorConstants(String value) { + GeneratorConstants(String value) { this.value = value; } diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/generator/JwsImplGenerator.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/generator/JwsImplGenerator.java index 0ab363077..08319a829 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/generator/JwsImplGenerator.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/generator/JwsImplGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -354,7 +354,7 @@ private String transToValidJavaIdentifier(String s) { private String makePackageQualified(String s) { s = transToValidJavaIdentifier(s); - if (options.defaultPackage != null && !options.defaultPackage.equals("")) { + if (options.defaultPackage != null && !options.defaultPackage.isEmpty()) { return options.defaultPackage + "." + s; } else { return s; @@ -424,10 +424,10 @@ private String getBindingType(QName bName) { if (model.getEntity() instanceof Definitions) { Definitions definitions = (Definitions) model.getEntity(); if (definitions != null) { - Iterator bindings = definitions.bindings(); + Iterator bindings = definitions.bindings(); if (bindings != null) { while (bindings.hasNext()) { - Binding binding = (Binding) bindings.next(); + Binding binding = bindings.next(); if (bName.getLocalPart().equals(binding.getName()) && bName.getNamespaceURI().equals(binding.getNamespaceURI())) { List bindextends = (List) binding @@ -519,7 +519,7 @@ public static List toImplFiles(List qualifiedClassNames) { private static File makePackageDir(WsimportOptions options) { File ret = null; - if (options.defaultPackage != null && !options.defaultPackage.equals("")) { + if (options.defaultPackage != null && !options.defaultPackage.isEmpty()) { String subDir = options.defaultPackage.replace('.', '/'); ret = new File(options.implDestDir, subDir); } else { @@ -566,7 +566,7 @@ private static boolean equalsNSOptional(String strQName, QName checkQN) { strQName = strQName.trim(); QName reqQN = QName.valueOf(strQName); - if (reqQN.getNamespaceURI() == null || reqQN.getNamespaceURI().equals("")) + if (reqQN.getNamespaceURI() == null || reqQN.getNamespaceURI().isEmpty()) return reqQN.getLocalPart().equals(checkQN.getLocalPart()); return reqQN.equals(checkQN); diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/generator/SeiGenerator.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/generator/SeiGenerator.java index 73d807215..53d86dcd5 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/generator/SeiGenerator.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/generator/SeiGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -19,7 +19,6 @@ import com.sun.tools.ws.processor.model.jaxb.JAXBType; import com.sun.tools.ws.processor.model.jaxb.JAXBTypeAndAnnotation; import com.sun.tools.ws.wscompile.ErrorReceiver; -import com.sun.tools.ws.wscompile.Options; import com.sun.tools.ws.wscompile.WsimportOptions; import com.sun.tools.ws.wsdl.document.soap.SOAPStyle; import com.sun.tools.ws.wsdl.document.PortType; @@ -210,14 +209,14 @@ private void writeWebMethod(Operation operation, JMethod m) { webMethodAnn.param("operationName", operationName); } - if (operation.getSOAPAction() != null && operation.getSOAPAction().length() > 0){ + if (operation.getSOAPAction() != null && !operation.getSOAPAction().isEmpty()){ webMethodAnn.param("action", operation.getSOAPAction()); } if (operation.getResponse() == null){ m.annotate(jakarta.jws.Oneway.class); }else if (!operation.getJavaMethod().getReturnType().getName().equals("void") && - operation.getResponse().getParametersList().size() > 0){ + !operation.getResponse().getParametersList().isEmpty()){ Block block; String resultName = null; String nsURI = null; diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/generator/ServiceGenerator.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/generator/ServiceGenerator.java index b7efa46d8..dde6db398 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/generator/ServiceGenerator.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/generator/ServiceGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -35,7 +35,6 @@ import com.sun.tools.ws.processor.model.java.JavaInterface; import com.sun.tools.ws.resources.GeneratorMessages; import com.sun.tools.ws.wscompile.ErrorReceiver; -import com.sun.tools.ws.wscompile.Options; import com.sun.tools.ws.wscompile.WsimportOptions; import com.sun.tools.ws.wsdl.document.PortType; import com.sun.xml.ws.spi.db.BindingHelper; diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/generator/W3CAddressingJavaGeneratorExtension.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/generator/W3CAddressingJavaGeneratorExtension.java index 7bc5c5e5e..c69325786 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/generator/W3CAddressingJavaGeneratorExtension.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/generator/W3CAddressingJavaGeneratorExtension.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -48,14 +48,14 @@ public void writeMethodAnnotations(TWSDLOperation two, JMethod jMethod) { Operation o = ((Operation)two); // explicit input action - if (o.getInput().getAction() != null && !o.getInput().getAction().equals("")) { + if (o.getInput().getAction() != null && !o.getInput().getAction().isEmpty()) { // explicitly specified actionAnn = jMethod.annotate(Action.class); actionAnn.param("input", o.getInput().getAction()); } // explicit output action - if (o.getOutput() != null && o.getOutput().getAction() != null && !o.getOutput().getAction().equals("")) { + if (o.getOutput() != null && o.getOutput().getAction() != null && !o.getOutput().getAction().isEmpty()) { // explicitly specified if (actionAnn == null) actionAnn = jMethod.annotate(Action.class); @@ -64,7 +64,7 @@ public void writeMethodAnnotations(TWSDLOperation two, JMethod jMethod) { } // explicit fault action - if (o.getFaults() != null && o.getFaults().size() > 0) { + if (o.getFaults() != null && !o.getFaults().isEmpty()) { Map map = o.getFaults(); JAnnotationArrayMember jam = null; @@ -72,7 +72,7 @@ public void writeMethodAnnotations(TWSDLOperation two, JMethod jMethod) { if (f.getAction() == null) continue; - if (f.getAction().equals("")) + if (f.getAction().isEmpty()) continue; if (actionAnn == null) { diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/AbstractType.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/AbstractType.java index 186e99237..445afe639 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/AbstractType.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/AbstractType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -94,7 +94,7 @@ public void setProperty(String key, Object value) { } if (properties == null) { - properties = new HashMap(); + properties = new HashMap<>(); } properties.put(key, value); } @@ -105,7 +105,7 @@ public void removeProperty(String key) { } } - public Iterator getProperties() { + public Iterator getProperties() { if (properties == null) { return Collections.emptyIterator(); } else { @@ -114,17 +114,17 @@ public Iterator getProperties() { } /* serialization */ - public Map getPropertiesMap() { + public Map getPropertiesMap() { return properties; } /* serialization */ - public void setPropertiesMap(Map m) { + public void setPropertiesMap(Map m) { properties = m; } private QName name; private JavaType javaType; private String version = null; - private Map properties; + private Map properties; } diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/ExtendedModelVisitor.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/ExtendedModelVisitor.java index b5fd06449..3366b4c6b 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/ExtendedModelVisitor.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/ExtendedModelVisitor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -34,22 +34,22 @@ public void visit(Model model) throws Exception { Request request = operation.getRequest(); if (request != null) { preVisit(request); - for (Iterator iter4 = request.getHeaderBlocks(); + for (Iterator iter4 = request.getHeaderBlocks(); iter4.hasNext();) { - Block block = (Block) iter4.next(); + Block block = iter4.next(); visitHeaderBlock(block); } - for (Iterator iter4 = request.getBodyBlocks(); + for (Iterator iter4 = request.getBodyBlocks(); iter4.hasNext();) { - Block block = (Block) iter4.next(); + Block block = iter4.next(); visitBodyBlock(block); } - for (Iterator iter4 = request.getParameters(); + for (Iterator iter4 = request.getParameters(); iter4.hasNext();) { - Parameter parameter = (Parameter) iter4.next(); + Parameter parameter = iter4.next(); visit(parameter); } postVisit(request); @@ -58,31 +58,31 @@ public void visit(Model model) throws Exception { Response response = operation.getResponse(); if (response != null) { preVisit(response); - for (Iterator iter4 = response.getHeaderBlocks(); + for (Iterator iter4 = response.getHeaderBlocks(); iter4.hasNext();) { - Block block = (Block) iter4.next(); + Block block = iter4.next(); visitHeaderBlock(block); } - for (Iterator iter4 = response.getBodyBlocks(); + for (Iterator iter4 = response.getBodyBlocks(); iter4.hasNext();) { - Block block = (Block) iter4.next(); + Block block = iter4.next(); visitBodyBlock(block); } - for (Iterator iter4 = response.getParameters(); + for (Iterator iter4 = response.getParameters(); iter4.hasNext();) { - Parameter parameter = (Parameter) iter4.next(); + Parameter parameter = iter4.next(); visit(parameter); } postVisit(response); } - for (Iterator iter4 = operation.getFaults(); + for (Iterator iter4 = operation.getFaults(); iter4.hasNext();) { - Fault fault = (Fault) iter4.next(); + Fault fault = iter4.next(); preVisit(fault); visitFaultBlock(fault.getBlock()); postVisit(fault); diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/Fault.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/Fault.java index 6bb6b3bd7..e38b8ad5b 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/Fault.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/Fault.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -63,7 +63,7 @@ public void accept(ModelVisitor visitor) throws Exception { visitor.visit(this); } - public Iterator getSubfaults() { + public Iterator getSubfaults() { if (subfaults.isEmpty()) { return null; } @@ -71,28 +71,28 @@ public Iterator getSubfaults() { } /* serialization */ - public Set getSubfaultsSet() { + public Set getSubfaultsSet() { return subfaults; } /* serialization */ - public void setSubfaultsSet(Set s) { + public void setSubfaultsSet(Set s) { subfaults = s; } - public Iterator getAllFaults() { - Set allFaults = getAllFaultsSet(); + public Iterator getAllFaults() { + Set allFaults = getAllFaultsSet(); if (allFaults.isEmpty()) { return null; } return allFaults.iterator(); } - public Set getAllFaultsSet() { - Set transSet = new HashSet(); - Iterator iter = subfaults.iterator(); + public Set getAllFaultsSet() { + Set transSet = new HashSet<>(); + Iterator iter = subfaults.iterator(); while (iter.hasNext()) { - transSet.addAll(((Fault)iter.next()).getAllFaultsSet()); + transSet.addAll(iter.next().getAllFaultsSet()); } transSet.addAll(subfaults); return transSet; @@ -139,7 +139,7 @@ public JClass getExceptionClass(){ private String name; private Block block; private JavaException javaException; - private Set subfaults = new HashSet(); + private Set subfaults = new HashSet<>(); private QName elementName = null; private String javaMemberName = null; private JClass exceptionClass; diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/Message.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/Message.java index a73db8ec5..f33db94cd 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/Message.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/Message.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -60,8 +60,8 @@ public boolean isBodyEmpty() { public boolean isBodyEncoded() { boolean isEncoded = false; - for (Iterator iter = getBodyBlocks(); iter.hasNext();) { - Block bodyBlock = (Block) iter.next(); + for (Iterator iter = getBodyBlocks(); iter.hasNext();) { + Block bodyBlock = iter.next(); if (bodyBlock.getType().isSOAPType()) { isEncoded = true; } @@ -187,10 +187,10 @@ public void setParametersList(List l) { } private void initializeParametersByName() { - _parametersByName = new HashMap(); + _parametersByName = new HashMap<>(); if (_parameters != null) { - for (Iterator iter = _parameters.iterator(); iter.hasNext();) { - Parameter param = (Parameter) iter.next(); + for (Iterator iter = _parameters.iterator(); iter.hasNext();) { + Parameter param = iter.next(); if (param.getName() != null && _parametersByName.containsKey(param.getName())) { errorReceiver.error(getEntity().getLocator(), ModelMessages.MODEL_PARAMETER_NOTUNIQUE(param.getName(), param.getName())); diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/Model.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/Model.java index 2dc567493..7be094db3 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/Model.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/Model.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -75,7 +75,7 @@ public void setServices(List l) { } private void initializeServicesByName() { - servicesByName = new HashMap(); + servicesByName = new HashMap<>(); if (services != null) { for (Service service : services) { if (service.getName() != null && @@ -92,7 +92,7 @@ public void addExtraType(AbstractType type) { extraTypes.add(type); } - public Iterator getExtraTypes() { + public Iterator getExtraTypes() { return extraTypes.iterator(); } diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/ModelObject.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/ModelObject.java index b1c40658d..5913abd1f 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/ModelObject.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/ModelObject.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -56,7 +56,7 @@ public void setProperty(String key, Object value) { } if (_properties == null) { - _properties = new HashMap(); + _properties = new HashMap<>(); } _properties.put(key, value); } @@ -67,7 +67,7 @@ public void removeProperty(String key) { } } - public Iterator getProperties() { + public Iterator getProperties() { if (_properties == null) { return Collections.emptyIterator(); } else { @@ -79,11 +79,11 @@ public Locator getLocator(){ return entity.getLocator(); } - public Map getPropertiesMap() { + public Map getPropertiesMap() { return _properties; } - public void setPropertiesMap(Map m) { + public void setPropertiesMap(Map m) { _properties = m; } @@ -96,5 +96,5 @@ public void setJavaDoc(String javaDoc) { } private String javaDoc; - private Map _properties; + private Map _properties; } diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/Operation.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/Operation.java index 7a7559327..48a906749 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/Operation.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/Operation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -106,8 +106,8 @@ public void setFaultsSet(Set s) { private void initializeFaultNames() { _faultNames = new HashSet<>(); if (_faults != null) { - for (Iterator iter = _faults.iterator(); iter.hasNext();) { - Fault f = (Fault) iter.next(); + for (Iterator iter = _faults.iterator(); iter.hasNext();) { + Fault f = iter.next(); if (f.getName() != null && _faultNames.contains(f.getName())) { throw new ModelException("model.uniqueness"); } @@ -122,12 +122,11 @@ public Iterator getAllFaults() { } public Set getAllFaultsSet() { - Set transSet = new HashSet(_faults); - Iterator iter = _faults.iterator(); - Fault fault; - Set tmpSet; + Set transSet = new HashSet<>(_faults); + Iterator iter = _faults.iterator(); + Set tmpSet; while (iter.hasNext()) { - tmpSet = ((Fault)iter.next()).getAllFaultsSet(); + tmpSet = iter.next().getAllFaultsSet(); transSet.addAll(tmpSet); } return transSet; @@ -139,9 +138,9 @@ public int getFaultCount() { public Set getAllFaultBlocks(){ Set blocks = new HashSet<>(); - Iterator faults = _faults.iterator(); + Iterator faults = _faults.iterator(); while(faults.hasNext()){ - Fault f = (Fault)faults.next(); + Fault f = faults.next(); blocks.add(f.getBlock()); } return blocks; diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/Response.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/Response.java index c43bf9a49..ca102f76e 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/Response.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/Response.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -12,6 +12,7 @@ import com.sun.tools.ws.wscompile.ErrorReceiver; +import javax.xml.namespace.QName; import java.util.HashMap; import java.util.Iterator; import java.util.Map; @@ -33,7 +34,7 @@ public void addFaultBlock(Block b) { _faultBlocks.put(b.getName(), b); } - public Iterator getFaultBlocks() { + public Iterator getFaultBlocks() { return _faultBlocks.values().iterator(); } @@ -42,11 +43,11 @@ public int getFaultBlockCount () { } /* serialization */ - public Map getFaultBlocksMap() { + public Map getFaultBlocksMap() { return _faultBlocks; } - public void setFaultBlocksMap(Map m) { + public void setFaultBlocksMap(Map m) { _faultBlocks = m; } @@ -55,5 +56,5 @@ public void accept(ModelVisitor visitor) throws Exception { visitor.visit(this); } - private Map _faultBlocks = new HashMap(); + private Map _faultBlocks = new HashMap<>(); } diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/Service.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/Service.java index 72b6c204d..2ab93b836 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/Service.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/Service.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -68,10 +68,10 @@ public void setPorts(List m) { } private void initializePortsByName() { - portsByName = new HashMap(); + portsByName = new HashMap<>(); if (ports != null) { - for (Iterator iter = ports.iterator(); iter.hasNext();) { - Port port = (Port) iter.next(); + for (Iterator iter = ports.iterator(); iter.hasNext();) { + Port port = iter.next(); if (port.getName() != null && portsByName.containsKey(port.getName())) { @@ -100,7 +100,7 @@ public void accept(ModelVisitor visitor) throws Exception { } private QName name; - private List ports = new ArrayList(); + private List ports = new ArrayList<>(); private Map portsByName = new HashMap<>(); private JavaInterface javaInterface; } diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/java/JavaInterface.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/java/JavaInterface.java index 1afb66f74..fd39611d2 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/java/JavaInterface.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/java/JavaInterface.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -63,7 +63,7 @@ public void setImpl(String s) { impl = s; } - public Iterator getMethods() { + public Iterator getMethods() { return methods.iterator(); } @@ -85,12 +85,12 @@ public void addMethod(JavaMethod method) { } /* serialization */ - public List getMethodsList() { + public List getMethodsList() { return methods; } /* serialization */ - public void setMethodsList(List l) { + public void setMethodsList(List l) { methods = l; } @@ -112,17 +112,17 @@ public void addInterface(String interfaceName) { interfaces.add(interfaceName); } - public Iterator getInterfaces() { + public Iterator getInterfaces() { return interfaces.iterator(); } /* serialization */ - public List getInterfacesList() { + public List getInterfacesList() { return interfaces; } /* serialization */ - public void setInterfacesList(List l) { + public void setInterfacesList(List l) { interfaces = l; } @@ -146,6 +146,6 @@ public void setJavaDoc(String javadoc) { private String name; private String realName; private String impl; - private List methods = new ArrayList(); - private List interfaces = new ArrayList(); + private List methods = new ArrayList<>(); + private List interfaces = new ArrayList<>(); } diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/java/JavaStructureType.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/java/JavaStructureType.java index 3ac7c0813..0cb0fd3a6 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/java/JavaStructureType.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/java/JavaStructureType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -44,7 +44,7 @@ public JavaStructureMember getMemberByName(String name) { return membersByName.get(name); } - public Iterator getMembers() { + public Iterator getMembers() { return members.iterator(); } @@ -97,39 +97,39 @@ public void addSubclass(JavaStructureType subclassType) { subclassType.setSuperclass(this); } - public Iterator getSubclasses() { - if (subclasses == null || subclasses.size() == 0) { + public Iterator getSubclasses() { + if (subclasses == null || subclasses.isEmpty()) { return null; } return subclasses.iterator(); } - public Set getSubclassesSet() { + public Set getSubclassesSet() { return subclasses; } /* serialization */ - public void setSubclassesSet(Set s) { + public void setSubclassesSet(Set s) { subclasses = s; - for (Iterator iter = s.iterator(); iter.hasNext();) { - ((JavaStructureType) iter.next()).setSuperclass(this); + for (Iterator iter = s.iterator(); iter.hasNext();) { + iter.next().setSuperclass(this); } } - public Iterator getAllSubclasses() { - Set subs = getAllSubclassesSet(); - if (subs.size() == 0) { + public Iterator getAllSubclasses() { + Set subs = getAllSubclassesSet(); + if (subs.isEmpty()) { return null; } return subs.iterator(); } - public Set getAllSubclassesSet() { - Set transitiveSet = new HashSet(); - Iterator subs = subclasses.iterator(); + public Set getAllSubclassesSet() { + Set transitiveSet = new HashSet<>(); + Iterator subs = subclasses.iterator(); while (subs.hasNext()) { transitiveSet.addAll( - ((JavaStructureType)subs.next()).getAllSubclassesSet()); + subs.next().getAllSubclassesSet()); } transitiveSet.addAll(subclasses); return transitiveSet; @@ -147,11 +147,11 @@ public void setOwner(Object owner) { this.owner = owner; } - private List members = new ArrayList(); - private Map membersByName = new HashMap(); + private List members = new ArrayList<>(); + private Map membersByName = new HashMap<>(); // known subclasses of this type - private Set subclasses = new HashSet(); + private Set subclasses = new HashSet<>(); private JavaStructureType superclass; // usually a SOAPStructureType diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/jaxb/JAXBStructuredType.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/jaxb/JAXBStructuredType.java index 4b2a4efb6..e641d1d4b 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/jaxb/JAXBStructuredType.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/jaxb/JAXBStructuredType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -40,7 +40,7 @@ public JAXBStructuredType(QName name, JavaStructureType javaType) { } public void add(JAXBElementMember m) { - if (_elementMembersByName.containsKey(m.getName())) { + if (_elementMembersByName.containsKey(m.getName().getLocalPart())) { throw new ModelException("model.uniqueness"); } _elementMembers.add(m); @@ -49,7 +49,7 @@ public void add(JAXBElementMember m) { } } - public Iterator getElementMembers() { + public Iterator getElementMembers() { return _elementMembers.iterator(); } @@ -58,24 +58,24 @@ public int getElementMembersCount() { } /* serialization */ - public List getElementMembersList() { + public List getElementMembersList() { return _elementMembers; } /* serialization */ - public void setElementMembersList(List l) { + public void setElementMembersList(List l) { _elementMembers = l; } public void addSubtype(JAXBStructuredType type) { if (_subtypes == null) { - _subtypes = new HashSet(); + _subtypes = new HashSet<>(); } _subtypes.add(type); type.setParentType(this); } - public Iterator getSubtypes() { + public Iterator getSubtypes() { if (_subtypes != null) { return _subtypes.iterator(); } @@ -90,12 +90,12 @@ public boolean isUnwrapped() { return true; } /* serialization */ - public Set getSubtypesSet() { + public Set getSubtypesSet() { return _subtypes; } /* serialization */ - public void setSubtypesSet(Set s) { + public void setSubtypesSet(Set s) { _subtypes = s; } @@ -117,8 +117,8 @@ public JAXBStructuredType getParentType() { } - private List _elementMembers = new ArrayList(); - private Map _elementMembersByName = new HashMap(); - private Set _subtypes = null; + private List _elementMembers = new ArrayList<>(); + private Map _elementMembersByName = new HashMap<>(); + private Set _subtypes = null; private JAXBStructuredType _parentType = null; } diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/jaxb/JAXBType.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/jaxb/JAXBType.java index fab273629..81a07a715 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/jaxb/JAXBType.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/model/jaxb/JAXBType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -61,7 +61,7 @@ public boolean isUnwrappable(){ } public boolean hasWrapperChildren(){ - return wrapperChildren.size() > 0; + return !wrapperChildren.isEmpty(); } @Override diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/modeler/ModelerConstants.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/modeler/ModelerConstants.java index 0a2276288..887fe3d9a 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/modeler/ModelerConstants.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/modeler/ModelerConstants.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -86,7 +86,7 @@ public enum ModelerConstants { private String value; - private ModelerConstants(String value) { + ModelerConstants(String value) { this.value = value; } diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/modeler/annotation/WebServiceConstants.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/modeler/annotation/WebServiceConstants.java index dff97153e..85c36efa4 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/modeler/annotation/WebServiceConstants.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/modeler/annotation/WebServiceConstants.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -29,7 +29,7 @@ public enum WebServiceConstants { private String value; - private WebServiceConstants(String value) { + WebServiceConstants(String value) { this.value = value; } diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/modeler/annotation/WebServiceVisitor.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/modeler/annotation/WebServiceVisitor.java index eb55aaac7..35d77aa66 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/modeler/annotation/WebServiceVisitor.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/modeler/annotation/WebServiceVisitor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -109,9 +109,9 @@ public Void visitType(TypeElement e, Object o) { if (serviceImplName == null) serviceImplName = e.getQualifiedName(); String endpointInterfaceName = webService != null ? webService.endpointInterface() : null; - if (endpointInterfaceName != null && endpointInterfaceName.length() > 0) { + if (endpointInterfaceName != null && !endpointInterfaceName.isEmpty()) { checkForInvalidImplAnnotation(e, SOAPBinding.class); - if (webService.name().length() > 0) + if (!webService.name().isEmpty()) builder.processError(WebserviceapMessages.WEBSERVICEAP_ENDPOINTINTEFACE_PLUS_ELEMENT("name"), e); endpointReferencesInterface = true; verifyImplAnnotations(e); @@ -134,15 +134,15 @@ public Void visitType(TypeElement e, Object o) { } protected void verifySeiAnnotations(WebService webService, TypeElement d) { - if (webService.endpointInterface().length() > 0) { + if (!webService.endpointInterface().isEmpty()) { builder.processError(WebserviceapMessages.WEBSERVICEAP_ENDPOINTINTERFACE_ON_INTERFACE( d.getQualifiedName(), webService.endpointInterface()), d); } - if (webService.serviceName().length() > 0) { + if (!webService.serviceName().isEmpty()) { builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_SEI_ANNOTATION_ELEMENT( "serviceName", d.getQualifiedName()), d); } - if (webService.portName().length() > 0) { + if (!webService.portName().isEmpty()) { builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_SEI_ANNOTATION_ELEMENT( "portName", d.getQualifiedName()), d); } @@ -159,7 +159,7 @@ protected void verifyImplAnnotations(TypeElement d) { } } - protected void checkForInvalidSeiAnnotation(TypeElement element, Class annotationClass) { + protected void checkForInvalidSeiAnnotation(TypeElement element, Class annotationClass) { Object annotation = element.getAnnotation(annotationClass); if (annotation != null) { builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_SEI_ANNOTATION( @@ -167,7 +167,7 @@ protected void checkForInvalidSeiAnnotation(TypeElement element, Class annotatio } } - protected void checkForInvalidImplAnnotation(Element element, Class annotationClass) { + protected void checkForInvalidImplAnnotation(Element element, Class annotationClass) { Object annotation = element.getAnnotation(annotationClass); if (annotation != null) { builder.processError(WebserviceapMessages.WEBSERVICEAP_ENDPOINTINTEFACE_PLUS_ANNOTATION(annotationClass.getName()), element); @@ -181,9 +181,9 @@ protected void preProcessWebService(WebService webService, TypeElement element) if (webService != null) targetNamespace = webService.targetNamespace(); PackageElement packageElement = builder.getProcessingEnvironment().getElementUtils().getPackageOf(element); - if (targetNamespace == null || targetNamespace.length() == 0) { + if (targetNamespace == null || targetNamespace.isEmpty()) { String packageName = packageElement.getQualifiedName().toString(); - if (packageName == null || packageName.length() == 0) { + if (packageName == null || packageName.isEmpty()) { builder.processError(WebserviceapMessages.WEBSERVICEAP_NO_PACKAGE_CLASS_MUST_HAVE_TARGETNAMESPACE( element.getQualifiedName()), element); } @@ -198,10 +198,10 @@ protected void preProcessWebService(WebService webService, TypeElement element) } portName = ClassNameInfo.getName(element.getSimpleName().toString().replace('$', '_')); packageName = packageElement.getQualifiedName(); - portName = webService != null && webService.name() != null && webService.name().length() > 0 ? + portName = webService != null && webService.name() != null && !webService.name().isEmpty() ? webService.name() : portName; serviceName = ClassNameInfo.getName(element.getQualifiedName().toString()) + WebServiceConstants.SERVICE.getValue(); - serviceName = webService != null && webService.serviceName() != null && webService.serviceName().length() > 0 ? + serviceName = webService != null && webService.serviceName() != null && !webService.serviceName().isEmpty() ? webService.serviceName() : serviceName; wsdlNamespace = seiContext.getNamespaceUri(); typeNamespace = wsdlNamespace; @@ -333,10 +333,10 @@ protected boolean hasWebMethods(TypeElement element) { webMethod = method.getAnnotation(WebMethod.class); if (webMethod != null) { if (webMethod.exclude()) { - if (webMethod.operationName().length() > 0) + if (!webMethod.operationName().isEmpty()) builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_WEBMETHOD_ELEMENT_WITH_EXCLUDE( "operationName", element.getQualifiedName(), method.toString()), method); - if (webMethod.action().length() > 0) + if (!webMethod.action().isEmpty()) builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_WEBMETHOD_ELEMENT_WITH_EXCLUDE( "action", element.getQualifiedName(), method.toString()), method); } else { @@ -523,6 +523,7 @@ protected boolean isLegalImplementation(WebService webService, TypeElement class } } + @SuppressWarnings({"unchecked"}) private boolean isStateful(TypeElement classElement) { try { // We don't want dependency on rt-ha module as its not integrated in JDK diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/modeler/annotation/WebServiceWrapperGenerator.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/modeler/annotation/WebServiceWrapperGenerator.java index 4b50f3f6c..554eaafa7 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/modeler/annotation/WebServiceWrapperGenerator.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/modeler/annotation/WebServiceWrapperGenerator.java @@ -203,7 +203,7 @@ private boolean generateWrappers(ExecutableElement method, WebMethod webMethod) beanPackage = WebServiceConstants.JAXWS_PACKAGE_PD.getValue(); Name methodName = method.getSimpleName(); String operationName = builder.getOperationName(methodName); - operationName = webMethod != null && webMethod.operationName().length() > 0 ? + operationName = webMethod != null && !webMethod.operationName().isEmpty() ? webMethod.operationName() : operationName; String reqName = operationName; String resName = operationName + WebServiceConstants.RESPONSE.getValue(); @@ -213,11 +213,11 @@ private boolean generateWrappers(ExecutableElement method, WebMethod webMethod) String requestClassName = beanPackage + StringUtils.capitalize(method.getSimpleName().toString()); RequestWrapper reqWrapper = method.getAnnotation(RequestWrapper.class); if (reqWrapper != null) { - if (reqWrapper.className().length() > 0) + if (!reqWrapper.className().isEmpty()) requestClassName = reqWrapper.className(); - if (reqWrapper.localName().length() > 0) + if (!reqWrapper.localName().isEmpty()) reqName = reqWrapper.localName(); - if (reqWrapper.targetNamespace().length() > 0) + if (!reqWrapper.targetNamespace().isEmpty()) reqNamespace = reqWrapper.targetNamespace(); } builder.log("requestWrapper: "+requestClassName); @@ -236,11 +236,11 @@ private boolean generateWrappers(ExecutableElement method, WebMethod webMethod) responseClassName = beanPackage+StringUtils.capitalize(method.getSimpleName().toString())+ WebServiceConstants.RESPONSE.getValue(); ResponseWrapper resWrapper = method.getAnnotation(ResponseWrapper.class); if(resWrapper != null) { - if (resWrapper.className().length() > 0) + if (!resWrapper.className().isEmpty()) responseClassName = resWrapper.className(); - if (resWrapper.localName().length() > 0) + if (!resWrapper.localName().isEmpty()) resName = resWrapper.localName(); - if (resWrapper.targetNamespace().length() > 0) + if (!resWrapper.targetNamespace().isEmpty()) resNamespace = resWrapper.targetNamespace(); } canOverwriteResponse = builder.canOverWriteClass(responseClassName); @@ -401,20 +401,20 @@ private boolean generateExceptionBean(TypeElement thrownDecl, String beanPackage if (isWSDLException) { TypeMirror beanType = getFaultInfoMember(members).getParamType(); faultInfo = new FaultInfo(TypeMonikerFactory.getTypeMoniker(beanType), true); - namespace = webFault.targetNamespace().length()>0 ? + namespace = !webFault.targetNamespace().isEmpty() ? webFault.targetNamespace() : namespace; - name = webFault.name().length()>0 ? + name = !webFault.name().isEmpty() ? webFault.name() : name; faultInfo.setElementName(new QName(namespace, name)); seiContext.addExceptionBeanEntry(thrownDecl.getQualifiedName(), faultInfo, builder); return false; } if (webFault != null) { - namespace = webFault.targetNamespace().length()>0 ? + namespace = !webFault.targetNamespace().isEmpty() ? webFault.targetNamespace() : namespace; - name = webFault.name().length()>0 ? + name = !webFault.name().isEmpty() ? webFault.name() : name; - className = webFault.faultBean().length()>0 ? + className = !webFault.faultBean().isEmpty() ? webFault.faultBean() : className; } @@ -481,7 +481,7 @@ private void writeXmlElementDeclaration(JDefinedClass cls, String elementName, S return; JAnnotationUse xmlRootElementAnn = cls.annotate(XmlRootElement.class); xmlRootElementAnn.param("name", elementName); - if (namespaceUri.length() > 0) { + if (!namespaceUri.isEmpty()) { xmlRootElementAnn.param("namespace", namespaceUri); } JAnnotationUse xmlAccessorTypeAnn = cls.annotate(cm.ref(XmlAccessorType.class)); diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/modeler/wsdl/ClassNameAllocatorImpl.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/modeler/wsdl/ClassNameAllocatorImpl.java index 25eb999ad..5ba4c6b7c 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/modeler/wsdl/ClassNameAllocatorImpl.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/modeler/wsdl/ClassNameAllocatorImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -35,7 +35,7 @@ public String assignClassName(String packageName, String className) { } //if either of the values are empty string return the default className - if(packageName.equals("") || className.equals("")) + if(packageName.isEmpty() || className.isEmpty()) return className; String fullClassName = packageName+"."+className; diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/modeler/wsdl/ModelerUtils.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/modeler/wsdl/ModelerUtils.java index 3478ec959..53832bcc4 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/modeler/wsdl/ModelerUtils.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/modeler/wsdl/ModelerUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -77,10 +77,10 @@ public static List createUnwrappedParameters(JAXBType jaxbType, .getRealName(), true, type); type.setJavaType(jst); block.setType(type); - List memberList = jaxbType.getWrapperChildren(); - Iterator props = memberList.iterator(); + List memberList = jaxbType.getWrapperChildren(); + Iterator props = memberList.iterator(); while (props.hasNext()) { - JAXBProperty prop = (JAXBProperty) props.next(); + JAXBProperty prop = props.next(); paramList.add(createUnwrappedParameter(prop, jaxbType, block, type, jst)); } @@ -187,11 +187,11 @@ public static boolean isEquivalentLiteralStructures( JAXBStructuredType struct2) { if (struct1.getElementMembersCount() != struct2.getElementMembersCount()) return false; - Iterator members = struct1.getElementMembers(); + Iterator members = struct1.getElementMembers(); JAXBElementMember member1; JavaStructureMember javaMember1, javaMember2; for (int i = 0; members.hasNext(); i++) { - member1 = (JAXBElementMember)members.next(); + member1 = members.next(); javaMember1 = member1.getJavaStructureMember(); javaMember2 = ((JavaStructureType)struct2.getJavaType()).getMemberByName( diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/modeler/wsdl/PseudoSchemaBuilder.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/modeler/wsdl/PseudoSchemaBuilder.java index 3a89e08a2..bedd90d2c 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/modeler/wsdl/PseudoSchemaBuilder.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/modeler/wsdl/PseudoSchemaBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -13,7 +13,6 @@ import com.sun.tools.ws.processor.generator.Names; import com.sun.tools.ws.wscompile.ErrorReceiver; import com.sun.tools.ws.wscompile.WsimportOptions; -import com.sun.tools.ws.wscompile.Options; import com.sun.tools.ws.wsdl.document.*; import com.sun.tools.ws.wsdl.document.jaxws.JAXWSBinding; import com.sun.tools.ws.wsdl.document.schema.SchemaKinds; @@ -25,7 +24,6 @@ import java.io.ByteArrayInputStream; import java.io.StringReader; import java.io.StringWriter; -import java.io.UnsupportedEncodingException; import java.nio.charset.StandardCharsets; import java.text.MessageFormat; import java.util.*; @@ -155,14 +153,14 @@ private void build(Port port) { bindingNameToPortMap.put(bindingName, port); - for(Iterator itr=binding.operations(); itr.hasNext();){ - BindingOperation bindingOperation = (BindingOperation)itr.next(); + for(Iterator itr=binding.operations(); itr.hasNext();){ + BindingOperation bindingOperation = itr.next(); // get only the bounded operations - Set boundedOps = portType.getOperationsNamed(bindingOperation.getName()); + Set boundedOps = portType.getOperationsNamed(bindingOperation.getName()); if(boundedOps.size() != 1) continue; - Operation operation = (Operation)boundedOps.iterator().next(); + Operation operation = boundedOps.iterator().next(); // No pseudo schema required for doc/lit if(wsdlModeler.isAsync(portType, operation)){ @@ -264,7 +262,7 @@ private void build(QName elementName, List allParts){ print(""); // reset the StringWriter, so that next operation element could be written - if(buf.toString().length() > 0){ + if(!buf.toString().isEmpty()){ //System.out.println("Response bean Schema for operation========> "+ elementName+"\n\n"+buf); InputSource is = new InputSource(new StringReader(buf.toString())); schemas.add(is); diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/modeler/wsdl/WSDLModeler.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/modeler/wsdl/WSDLModeler.java index 6ad203d9e..e7d72f0eb 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/modeler/wsdl/WSDLModeler.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/modeler/wsdl/WSDLModeler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -90,7 +90,7 @@ public void ignoringExtension(Entity entity, QName name, QName parent) { if (parent.equals(WSDLConstants.QNAME_TYPES)) { // check for a schema element with the wrong namespace URI if (name.getLocalPart().equals("schema") - && !name.getNamespaceURI().equals("")) { + && !name.getNamespaceURI().isEmpty()) { warning(entity, ModelerMessages.WSDLMODELER_WARNING_IGNORING_UNRECOGNIZED_SCHEMA_EXTENSION(name.getNamespaceURI())); } } @@ -134,7 +134,7 @@ public void doneParsingEntity(QName element, Entity entity) { // give up StringBuilder conflictList = new StringBuilder(); boolean first = true; - for (Iterator iter = + for (Iterator iter = classNameCollector.getConflictingClassNames().iterator(); iter.hasNext(); ) { @@ -143,7 +143,7 @@ public void doneParsingEntity(QName element, Entity entity) { } else { first = false; } - conflictList.append((String) iter.next()); + conflictList.append(iter.next()); } error(document.getDefinitions(), ModelerMessages.WSDLMODELER_UNSOLVABLE_NAMING_CONFLICTS(conflictList.toString())); } catch (ModelException e) { @@ -191,11 +191,10 @@ private Model internalBuildModel(WSDLDocument document) { boolean hasServices = document.getDefinitions().services().hasNext(); if (hasServices) { - for (Iterator iter = document.getDefinitions().services(); + for (Iterator iter = document.getDefinitions().services(); iter.hasNext(); ) { - processService((com.sun.tools.ws.wsdl.document.Service) iter.next(), - model, document); + processService(iter.next(), model, document); } } else { // emit a warning if there are no service definitions @@ -221,10 +220,10 @@ protected void processService(com.sun.tools.ws.wsdl.document.Service wsdlService setDocumentationIfPresent(service, wsdlService.getDocumentation()); boolean hasPorts = false; - for (Iterator iter = wsdlService.ports(); iter.hasNext();) { + for (Iterator iter = wsdlService.ports(); iter.hasNext();) { boolean processed = processPort( - (com.sun.tools.ws.wsdl.document.Port) iter.next(), + iter.next(), service, document); hasPorts = hasPorts || processed; @@ -346,9 +345,9 @@ protected boolean processPort(com.sun.tools.ws.wsdl.document.Port wsdlPort, boolean hasOverloadedOperations = false; Set operationNames = new HashSet<>(); - for (Iterator iter = portType.operations(); iter.hasNext();) { + for (Iterator iter = portType.operations(); iter.hasNext();) { com.sun.tools.ws.wsdl.document.Operation operation = - (com.sun.tools.ws.wsdl.document.Operation) iter.next(); + iter.next(); if (operationNames.contains(operation.getName())) { hasOverloadedOperations = true; @@ -356,11 +355,11 @@ protected boolean processPort(com.sun.tools.ws.wsdl.document.Port wsdlPort, } operationNames.add(operation.getName()); - for (Iterator itr = binding.operations(); + for (Iterator itr = binding.operations(); iter.hasNext(); ) { BindingOperation bindingOperation = - (BindingOperation) itr.next(); + itr.next(); if (operation .getName() .equals(bindingOperation.getName())) { @@ -373,33 +372,24 @@ protected boolean processPort(com.sun.tools.ws.wsdl.document.Port wsdlPort, Map headers = new HashMap(); boolean hasOperations = false; - for (Iterator iter = binding.operations(); iter.hasNext();) { - BindingOperation bindingOperation = - (BindingOperation) iter.next(); + for (Iterator iter = binding.operations(); iter.hasNext();) { + BindingOperation bindingOperation = iter.next(); - com.sun.tools.ws.wsdl.document.Operation portTypeOperation = - null; - Set operations = + com.sun.tools.ws.wsdl.document.Operation portTypeOperation = null; + Set operations = portType.getOperationsNamed(bindingOperation.getName()); if (operations.isEmpty()) { // the WSDL document is invalid error(bindingOperation, ModelerMessages.WSDLMODELER_INVALID_BINDING_OPERATION_NOT_IN_PORT_TYPE(bindingOperation.getName(), binding.getName())); } else if (operations.size() == 1) { - portTypeOperation = - (com.sun.tools.ws.wsdl.document.Operation) operations - .iterator() - .next(); + portTypeOperation = operations.iterator().next(); } else { boolean found = false; - String expectedInputName = - bindingOperation.getInput().getName(); - String expectedOutputName = - bindingOperation.getOutput().getName(); + String expectedInputName = bindingOperation.getInput().getName(); + String expectedOutputName = bindingOperation.getOutput().getName(); - for (Iterator iter2 = operations.iterator(); iter2.hasNext();) { - com.sun.tools.ws.wsdl.document.Operation candidateOperation = - (com.sun.tools.ws.wsdl.document.Operation) iter2 - .next(); + for (Iterator iter2 = operations.iterator(); iter2.hasNext();) { + com.sun.tools.ws.wsdl.document.Operation candidateOperation = iter2.next(); if (expectedInputName == null) { // the WSDL document is invalid @@ -560,7 +550,7 @@ private Operation processNonSOAPOperation() { } // faults with duplicate names - Set duplicateNames = getDuplicateFaultNames(); + Set duplicateNames = getDuplicateFaultNames(); // handle soap:fault handleLiteralSOAPFault(response, duplicateNames); @@ -875,7 +865,7 @@ protected Operation processLiteralSOAPOperation(StyleAndUse styleAndUse) { } // faults with duplicate names - Set duplicateNames = getDuplicateFaultNames(); + Set duplicateNames = getDuplicateFaultNames(); // handle soap:fault handleLiteralSOAPFault(response, duplicateNames); @@ -1234,13 +1224,13 @@ protected boolean isAsync(com.sun.tools.ws.wsdl.document.PortType portType, com. return false; } - protected void handleLiteralSOAPHeaders(Request request, Response response, Iterator headerParts, Set duplicateNames, @NotNull List definitiveParameterList, boolean processRequest) { + protected void handleLiteralSOAPHeaders(Request request, Response response, Iterator headerParts, Set duplicateNames, @NotNull List definitiveParameterList, boolean processRequest) { QName headerName; Block headerBlock; JAXBType jaxbType; int parameterOrderPosition = definitiveParameterList.size(); while (headerParts.hasNext()) { - MessagePart part = (MessagePart) headerParts.next(); + MessagePart part = headerParts.next(); headerName = part.getDescriptor(); jaxbType = getJAXBType(part); headerBlock = new Block(headerName, jaxbType, part); @@ -1285,7 +1275,7 @@ protected void handleLiteralSOAPHeaders(Request request, Response response, Iter } - protected void handleLiteralSOAPFault(Response response, Set duplicateNames) { + protected void handleLiteralSOAPFault(Response response, Set duplicateNames) { for (BindingFault bindingFault : info.bindingOperation.faults()) { com.sun.tools.ws.wsdl.document.Fault portTypeFault = null; for (com.sun.tools.ws.wsdl.document.Fault aFault : info.portTypeOperation.faults()) { @@ -1357,12 +1347,12 @@ protected void handleLiteralSOAPFault(Response response, Set duplicateNames) { } com.sun.tools.ws.wsdl.document.Message faultMessage = portTypeFault.resolveMessage(info.document); - Iterator iter2 = faultMessage.parts(); + Iterator iter2 = faultMessage.parts(); if (!iter2.hasNext()) { // the WSDL document is invalid error(faultMessage, ModelerMessages.WSDLMODELER_INVALID_BINDING_FAULT_EMPTY_MESSAGE(portTypeFault.getName(), faultMessage.getName())); } - MessagePart faultPart = (MessagePart) iter2.next(); + MessagePart faultPart = iter2.next(); QName faultQName = faultPart.getDescriptor(); // Don't include fault messages with non-unique soap:fault names @@ -1469,8 +1459,8 @@ protected boolean setMessagePartsBinding(SOAPBody body, Message message, StyleAn } //now build the final parts list with header, mime parts and body parts - for (Iterator iter = message.parts(); iter.hasNext();) { - MessagePart mPart = (MessagePart) iter.next(); + for (Iterator iter = message.parts(); iter.hasNext();) { + MessagePart mPart = iter.next(); if (mimeParts.contains(mPart)) { mPart.setBindingExtensibilityElementKind(MessagePart.WSDL_MIME_BINDING); } else if (headerParts.contains(mPart)) { @@ -2000,7 +1990,7 @@ private void setCustomizedParameterName(TWSDLExtensible extension, Message msg, elementName = param.getType().getName(); } String customName = jaxwsBinding.getParameterName(msg.getName(), paramName, elementName, wrapperStyle); - if (customName != null && !customName.equals("")) { + if (customName != null && !customName.isEmpty()) { param.setCustomName(customName); } } @@ -2108,16 +2098,16 @@ private boolean getWrapperStyleCustomization() { /* (non-Javadoc) * @see WSDLModelerBase#isSingleInOutPart(Set, MessagePart) */ - protected boolean isSingleInOutPart(Set inputParameterNames, + protected boolean isSingleInOutPart(Set inputParameterNames, MessagePart outputPart) { // As of now, we dont have support for in/out in doc-lit. So return false. SOAPOperation soapOperation = (SOAPOperation) getExtensionOfType(info.bindingOperation, SOAPOperation.class); if ((soapOperation != null) && (soapOperation.isDocument() || info.soapBinding.isDocument())) { - Iterator iter = getInputMessage().parts(); + Iterator iter = getInputMessage().parts(); while (iter.hasNext()) { - MessagePart part = (MessagePart) iter.next(); + MessagePart part = iter.next(); if (outputPart.getName().equals(part.getName()) && outputPart.getDescriptor().equals(part.getDescriptor())) { return true; } @@ -2320,7 +2310,7 @@ protected String getServiceInterfaceName(QName serviceQName, com.sun.tools.ws.ws JAXWSBinding jaxwsCust = (JAXWSBinding) getExtensionOfType(wsdlService, JAXWSBinding.class); if (jaxwsCust != null && jaxwsCust.getClassName() != null) { CustomName name = jaxwsCust.getClassName(); - if (name != null && !name.getName().equals("")) { + if (name != null && !name.getName().isEmpty()) { return makePackageQualified(name.getName()); } } @@ -2339,7 +2329,7 @@ protected String getJavaNameOfSEI(Port port) { JAXWSBinding jaxwsCust = (JAXWSBinding) getExtensionOfType(pt, JAXWSBinding.class); if (jaxwsCust != null && jaxwsCust.getClassName() != null) { CustomName name = jaxwsCust.getClassName(); - if (name != null && !name.getName().equals("")) { + if (name != null && !name.getName().isEmpty()) { return makePackageQualified(name.getName()); } } @@ -2367,8 +2357,8 @@ private void createJavaMethodForAsyncOperation(Port port, Operation operation, // build a signature of the form "opName%arg1type%arg2type%...%argntype so that we // detect overloading conflicts in the generated java interface/classes - for (Iterator iter = operation.getRequest().getParameters(); iter.hasNext();) { - Parameter parameter = (Parameter) iter.next(); + for (Iterator iter = operation.getRequest().getParameters(); iter.hasNext();) { + Parameter parameter = iter.next(); if (parameter.getJavaParameter() != null) { error(operation.getEntity(), ModelerMessages.WSDLMODELER_INVALID_OPERATION(operation.getName().getLocalPart())); @@ -2419,6 +2409,7 @@ protected void createJavaMethodForOperation(Port port, Operation operation, Java } else { method.setReturnType(JavaSimpleTypeCreator.VOID_JAVATYPE); } + @SuppressWarnings({"unchecked"}) List parameterOrder = (List) operation.getProperty(WSDL_PARAMETER_ORDER); for (Parameter param : parameterOrder) { JavaType parameterType = param.getType().getJavaType(); @@ -2445,16 +2436,16 @@ protected void createJavaMethodForOperation(Port port, Operation operation, Java intf.addMethod(method); String opName = BindingHelper.mangleNameToVariableName(operation.getName().getLocalPart()); - for (Iterator iter = operation.getFaults(); + for (Iterator iter = operation.getFaults(); iter != null && iter.hasNext(); ) { - Fault fault = (Fault) iter.next(); + Fault fault = iter.next(); createJavaExceptionFromLiteralType(fault, port, opName); } JavaException javaException; Fault fault; - for (Iterator iter = operation.getFaults(); iter.hasNext();) { - fault = (Fault) iter.next(); + for (Iterator iter = operation.getFaults(); iter.hasNext();) { + fault = iter.next(); javaException = fault.getJavaException(); method.addException(javaException.getName()); } @@ -2537,7 +2528,7 @@ protected List getParameterOrder() { String parameterOrder = info.portTypeOperation.getParameterOrder(); java.util.List parameterList; boolean parameterOrderPresent = false; - if ((parameterOrder != null) && !(parameterOrder.trim().equals(""))) { + if ((parameterOrder != null) && !(parameterOrder.trim().isEmpty())) { parameterList = XmlUtil.parseTokenList(parameterOrder); parameterOrderPresent = true; } else { @@ -2738,9 +2729,9 @@ protected boolean validateWSDLBindingStyle(Binding binding) { } SOAPStyle opStyle = soapBinding.getStyle(); - for (Iterator iter = binding.operations(); iter.hasNext();) { + for (Iterator iter = binding.operations(); iter.hasNext();) { BindingOperation bindingOperation = - (BindingOperation) iter.next(); + iter.next(); SOAPOperation soapOperation = (SOAPOperation) getExtensionOfType(bindingOperation, SOAPOperation.class); diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/modeler/wsdl/WSDLModelerBase.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/modeler/wsdl/WSDLModelerBase.java index 198e57bdb..18f4286f0 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/modeler/wsdl/WSDLModelerBase.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/modeler/wsdl/WSDLModelerBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -161,7 +161,7 @@ protected List getMessageParts( List parts = new ArrayList<>(); //get Mime parts - List mimeParts; + List mimeParts; if (isInput) { mimeParts = getMimeContentParts(message, info.bindingOperation.getInput()); } else { @@ -421,7 +421,7 @@ private boolean isRootPart(MIMEPart part) { return false; } - protected Set getDuplicateFaultNames() { + protected Set getDuplicateFaultNames() { // look for fault messages with the same soap:fault name Set faultNames = new HashSet<>(); Set duplicateNames = new HashSet<>(); @@ -547,7 +547,7 @@ protected String makePackageQualified(String s) { // s is already package qualified return s; } else if (options.defaultPackage != null - && !options.defaultPackage.equals("")) { + && !options.defaultPackage.isEmpty()) { return options.defaultPackage + "." + s; } else {//options.defaultPackage seems to be never null, and this is never executed return s; @@ -575,7 +575,7 @@ protected static QName getQNameOf(GloballyKnown entity) { @SuppressWarnings({"deprecation"}) protected static TWSDLExtension getExtensionOfType( TWSDLExtensible extensible, - Class type) { + Class type) { for (TWSDLExtension extension:extensible.extensions()) { if (extension.getClass().equals(type)) { return extension; @@ -588,7 +588,7 @@ protected static TWSDLExtension getExtensionOfType( @SuppressWarnings({"deprecation"}) protected TWSDLExtension getAnyExtensionOfType( TWSDLExtensible extensible, - Class type) { + Class type) { if (extensible == null) { return null; } @@ -717,7 +717,7 @@ protected void error(Entity entity, String message){ protected ProcessSOAPOperationInfo info; - private Set _conflictingClassNames; + private Set _conflictingClassNames; protected Map _javaExceptions; protected Map _faultTypeToStructureMap; protected Map _bindingNameToPortMap; diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/util/ClassNameCollector.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/util/ClassNameCollector.java index bd1b50f3d..57b835150 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/util/ClassNameCollector.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/util/ClassNameCollector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -11,7 +11,7 @@ package com.sun.tools.ws.processor.util; import com.sun.tools.ws.processor.model.*; -import com.sun.tools.ws.processor.model.java.JavaInterface; +import com.sun.tools.ws.processor.model.java.JavaException; import com.sun.tools.ws.processor.model.jaxb.JAXBType; import com.sun.tools.ws.processor.model.jaxb.JAXBTypeVisitor; import com.sun.tools.ws.processor.model.jaxb.RpcLitStructure; @@ -34,10 +34,10 @@ public ClassNameCollector() { public void process(Model model) { try { - _allClassNames = new HashSet(); - _exceptions = new HashSet(); - _wsdlBindingNames = new HashSet(); - _conflictingClassNames = new HashSet(); + _allClassNames = new HashSet<>(); + _exceptions = new HashSet<>(); + _wsdlBindingNames = new HashSet<>(); + _conflictingClassNames = new HashSet<>(); _seiClassNames = new HashSet<>(); _jaxbGeneratedClassNames = new HashSet<>(); _exceptionClassNames = new HashSet<>(); @@ -52,14 +52,14 @@ public void process(Model model) { } } - public Set getConflictingClassNames() { + public Set getConflictingClassNames() { return _conflictingClassNames; } @Override protected void postVisit(Model model) throws Exception { - for (Iterator iter = model.getExtraTypes(); iter.hasNext();) { - visitType((AbstractType)iter.next()); + for (Iterator iter = model.getExtraTypes(); iter.hasNext();) { + visitType(iter.next()); } } @@ -108,14 +108,10 @@ private void addSEIClassName(String s) { protected void postVisit(Port port) throws Exception { QName wsdlBindingName = (QName) port.getProperty( ModelProperties.PROPERTY_WSDL_BINDING_NAME); - if (!_wsdlBindingNames.contains(wsdlBindingName)) { - _wsdlBindingNames.add(wsdlBindingName); - } + _wsdlBindingNames.add(wsdlBindingName); QName portTypeName = (QName)port.getProperty(ModelProperties.PROPERTY_WSDL_PORT_TYPE_NAME); - if(!_portTypeNames.contains(portTypeName)){ - _portTypeNames.add(portTypeName); - } + _portTypeNames.add(portTypeName); } @Override @@ -135,10 +131,10 @@ protected void preVisit(Fault fault) throws Exception { _exceptions.add(fault.getJavaException()); addExceptionClassName(fault.getJavaException().getName()); - for (Iterator iter = fault.getSubfaults(); + for (Iterator iter = fault.getSubfaults(); iter != null && iter.hasNext();) { - Fault subfault = (Fault) iter.next(); + Fault subfault = iter.next(); preVisit(subfault); } } @@ -192,7 +188,7 @@ private void visitType(RpcLitStructure type) throws Exception { type.accept(this); } private void registerClassName(String name) { - if (name == null || name.equals("")) { + if (name == null || name.isEmpty()) { return; } if (_allClassNames.contains(name)) { @@ -249,9 +245,9 @@ private void addJAXBGeneratedClassName(String name) { registerClassName(name); } - private Set _allClassNames; - private Set _exceptions; - private Set _wsdlBindingNames; - private Set _conflictingClassNames; + private Set _allClassNames; + private Set _exceptions; + private Set _wsdlBindingNames; + private Set _conflictingClassNames; private Set _portTypeNames; } diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/util/DirectoryUtil.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/util/DirectoryUtil.java index acd07ac7e..026f0e283 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/util/DirectoryUtil.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/processor/util/DirectoryUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -31,7 +31,7 @@ public static File getOutputDirectoryFor(String theClass, File rootDir) throws G String qualifiedClassName = theClass; String packagePath = null; String packageName = ClassNameInfo.getQualifier(qualifiedClassName); - if (packageName != null && packageName.length() > 0) { + if (packageName != null && !packageName.isEmpty()) { packagePath = packageName.replace('.', File.separatorChar); } diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wscompile/FilerCodeWriter.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wscompile/FilerCodeWriter.java index 721173184..d39497067 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wscompile/FilerCodeWriter.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wscompile/FilerCodeWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2019 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -60,6 +60,6 @@ public void close() throws IOException { } private static boolean isDefaultPackage(JPackage pkg) { - return pkg.name() == null || "".equals(pkg.name()); + return pkg.name() == null || pkg.name().isEmpty(); } } diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wscompile/JavaCompilerHelper.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wscompile/JavaCompilerHelper.java index 6d76960e7..897fbc19b 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wscompile/JavaCompilerHelper.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wscompile/JavaCompilerHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -27,7 +27,7 @@ * @author WS Development Team */ class JavaCompilerHelper{ - static File getJarFile(Class clazz) { + static File getJarFile(Class clazz) { URL url = null; try { url = ParallelWorldClassLoader.toJarUrl(clazz.getResource('/'+clazz.getName().replace('.','/')+".class")); diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wscompile/Options.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wscompile/Options.java index ea988c143..3d14387d6 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wscompile/Options.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wscompile/Options.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -112,7 +112,7 @@ public enum Target { private final String version; - private Target(String version) { + Target(String version) { this.version = version; } @@ -269,7 +269,7 @@ public void deleteGeneratedFiles() { public void parseArguments( String[] args ) throws BadCommandLineException { for (int i = 0; i < args.length; i++) { - if(args[i].length()==0) + if(args[i].isEmpty()) throw new BadCommandLineException(); if (args[i].charAt(0) == '-') { int j = parseArguments(args,i); diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wscompile/WsgenOptions.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wscompile/WsgenOptions.java index 9a431445e..c9ae9d1a7 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wscompile/WsgenOptions.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wscompile/WsgenOptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -105,8 +105,8 @@ public WsgenOptions() { nonstdProtocols.put(X_SOAP12, SOAPBindingImpl.X_SOAP12HTTP_BINDING); ServiceFinder extn = ServiceFinder.find(WsgenExtension.class, ServiceLoader.load(WsgenExtension.class)); for(WsgenExtension ext : extn) { - Class clazz = ext.getClass(); - WsgenProtocol pro = (WsgenProtocol)clazz.getAnnotation(WsgenProtocol.class); + Class clazz = ext.getClass(); + WsgenProtocol pro = clazz.getAnnotation(WsgenProtocol.class); protocols.add(pro.token()); nonstdProtocols.put(pro.token(), pro.lexical()); } @@ -118,19 +118,19 @@ protected int parseArguments(String[] args, int i) throws BadCommandLineExceptio int j = super.parseArguments(args, i); if (args[i].equals(SERVICENAME_OPTION)) { serviceName = QName.valueOf(requireArgument(SERVICENAME_OPTION, args, ++i)); - if (serviceName.getNamespaceURI() == null || serviceName.getNamespaceURI().length() == 0) { + if (serviceName.getNamespaceURI() == null || serviceName.getNamespaceURI().isEmpty()) { throw new BadCommandLineException(WscompileMessages.WSGEN_SERVICENAME_MISSING_NAMESPACE(args[i])); } - if (serviceName.getLocalPart() == null || serviceName.getLocalPart().length() == 0) { + if (serviceName.getLocalPart() == null || serviceName.getLocalPart().isEmpty()) { throw new BadCommandLineException(WscompileMessages.WSGEN_SERVICENAME_MISSING_LOCALNAME(args[i])); } return 2; } else if (args[i].equals(PORTNAME_OPTION)) { portName = QName.valueOf(requireArgument(PORTNAME_OPTION, args, ++i)); - if (portName.getNamespaceURI() == null || portName.getNamespaceURI().length() == 0) { + if (portName.getNamespaceURI() == null || portName.getNamespaceURI().isEmpty()) { throw new BadCommandLineException(WscompileMessages.WSGEN_PORTNAME_MISSING_NAMESPACE(args[i])); } - if (portName.getLocalPart() == null || portName.getLocalPart().length() == 0) { + if (portName.getLocalPart() == null || portName.getLocalPart().isEmpty()) { throw new BadCommandLineException(WscompileMessages.WSGEN_PORTNAME_MISSING_LOCALNAME(args[i])); } return 2; @@ -188,7 +188,7 @@ protected void addFile(String arg) { List endpoints = new ArrayList<>(); - public Class endpoint; + public Class endpoint; private boolean isImplClass; @@ -222,7 +222,7 @@ public void validate() throws BadCommandLineException { * Get an implementation class annotated with @WebService annotation. */ private void validateEndpointClass() throws BadCommandLineException { - Class clazz = null; + Class clazz = null; for(String cls : endpoints){ clazz = getClass(cls); if (clazz == null) @@ -233,7 +233,7 @@ private void validateEndpointClass() throws BadCommandLineException { continue; } isImplClass = true; - WebService webService = (WebService) clazz.getAnnotation(WebService.class); + WebService webService = clazz.getAnnotation(WebService.class); if(webService == null) continue; break; @@ -286,7 +286,7 @@ BindingID getBindingID(String protocol) { } - private Class getClass(String className) { + private Class getClass(String className) { try { return getClassLoader().loadClass(className); } catch (ClassNotFoundException e) { diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wscompile/WsgenTool.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wscompile/WsgenTool.java index ee2ce2cce..81d21e74b 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wscompile/WsgenTool.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wscompile/WsgenTool.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -213,7 +213,7 @@ public void report(Diagnostic diagnostic) { List externalMetadataFileNames = options.externalMetadataFiles; boolean disableXmlSecurity = options.disableXmlSecurity; - if (externalMetadataFileNames != null && externalMetadataFileNames.size() > 0) { + if (externalMetadataFileNames != null && !externalMetadataFileNames.isEmpty()) { config.setMetadataReader(new ExternalMetadataReader(getExternalFiles(externalMetadataFileNames), null, null, true, disableXmlSecurity)); } diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wscompile/WsimportOptions.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wscompile/WsimportOptions.java index fe3fdaf1a..3ede18a93 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wscompile/WsimportOptions.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wscompile/WsimportOptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -238,7 +238,7 @@ public String getModuleName() { public final void parseArguments( String[] args ) throws BadCommandLineException { for (int i = 0; i < args.length; i++) { - if(args[i].length()==0) + if(args[i].isEmpty()) throw new BadCommandLineException(); if (args[i].charAt(0) == '-') { int j = parseArguments(args,i); @@ -325,9 +325,9 @@ public int parseArguments(String[] args, int i) throws BadCommandLineException { String catalog = requireArgument("-catalog", args, ++i); try { if (entityResolver == null) { - if (catalog != null && catalog.length() > 0) + if (catalog != null && !catalog.isEmpty()) entityResolver = XmlUtil.createEntityResolver(JAXWSUtils.getFileOrURL(JAXWSUtils.absolutize(Util.escapeSpace(catalog)))); - } else if (catalog != null && catalog.length() > 0) { + } else if (catalog != null && !catalog.isEmpty()) { EntityResolver er = XmlUtil.createEntityResolver(JAXWSUtils.getFileOrURL(JAXWSUtils.absolutize(Util.escapeSpace(catalog)))); entityResolver = new ForkEntityResolver(er, entityResolver); } @@ -337,7 +337,7 @@ public int parseArguments(String[] args, int i) throws BadCommandLineException { return 2; } else if (args[i].startsWith("-httpproxy:")) { String value = args[i].substring(11); - if (value.length() == 0) { + if (value.isEmpty()) { throw new BadCommandLineException(WscompileMessages.WSCOMPILE_INVALID_OPTION(args[i])); } parseProxy(value); @@ -465,7 +465,7 @@ protected void addFile(String arg) throws BadCommandLineException { * behaviour and generate only one @HandlerChain on the SEI */ public Element getHandlerChainConfiguration(){ - if(handlerConfigs.size() > 0) + if(!handlerConfigs.isEmpty()) return handlerConfigs.get(0); return null; } diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wscompile/WsimportTool.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wscompile/WsimportTool.java index 55f53836e..5a9821102 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wscompile/WsimportTool.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wscompile/WsimportTool.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -497,7 +497,7 @@ protected boolean compileGeneratedClasses(ErrorReceiver receiver, WsimportListen } } - if (sourceFiles.size() > 0) { + if (!sourceFiles.isEmpty()) { String classDir = options.destDir.getAbsolutePath(); String classpathString = createClasspathString(); List args = new ArrayList<>(); diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/document/Binding.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/document/Binding.java index ace6cfe0e..f9bba9c0f 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/document/Binding.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/document/Binding.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -33,7 +33,7 @@ public class Binding extends GlobalEntity implements TWSDLExtensible { public Binding(Defining defining, Locator locator, ErrorReceiver receiver) { super(defining, locator, receiver); - _operations = new ArrayList(); + _operations = new ArrayList<>(); _helper = new ExtensibilityHelper(); } @@ -41,7 +41,7 @@ public void add(BindingOperation operation) { _operations.add(operation); } - public Iterator operations() { + public Iterator operations() { return _operations.iterator(); } @@ -82,8 +82,8 @@ public void setDocumentation(Documentation d) { @Override public void withAllSubEntitiesDo(EntityAction action) { - for (Iterator iter = _operations.iterator(); iter.hasNext();) { - action.perform((Entity) iter.next()); + for (Iterator iter = _operations.iterator(); iter.hasNext();) { + action.perform(iter.next()); } _helper.withAllSubEntitiesDo(action); } @@ -109,8 +109,8 @@ public void accept(WSDLDocumentVisitor visitor) throws Exception { visitor.preVisit(this); //bug fix: 4947340, extensions should be the first element _helper.accept(visitor); - for (Iterator iter = _operations.iterator(); iter.hasNext();) { - ((BindingOperation) iter.next()).accept(visitor); + for (Iterator iter = _operations.iterator(); iter.hasNext();) { + iter.next().accept(visitor); } visitor.postVisit(this); } @@ -158,7 +158,7 @@ public TWSDLExtensible getParent() { private ExtensibilityHelper _helper; private Documentation _documentation; private QName _portType; - private List _operations; + private List _operations; public void setParent(TWSDLExtensible parent) { this.parent = parent; diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/document/Definitions.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/document/Definitions.java index eb91f37ad..2074b6076 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/document/Definitions.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/document/Definitions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -30,12 +30,12 @@ public class Definitions extends Entity implements Defining, TWSDLExtensible { public Definitions(AbstractDocument document, Locator locator) { super(locator); _document = document; - _bindings = new ArrayList(); - _imports = new ArrayList(); - _messages = new ArrayList(); - _portTypes = new ArrayList(); - _services = new ArrayList(); - _importedNamespaces = new HashSet(); + _bindings = new ArrayList<>(); + _imports = new ArrayList<>(); + _messages = new ArrayList<>(); + _portTypes = new ArrayList<>(); + _services = new ArrayList<>(); + _importedNamespaces = new HashSet<>(); _helper = new ExtensibilityHelper(); } @@ -93,19 +93,19 @@ public void add(Import i) { _importedNamespaces.add(i.getNamespace()); } - public Iterator imports() { + public Iterator imports() { return _imports.iterator(); } - public Iterator messages() { + public Iterator messages() { return _messages.iterator(); } - public Iterator portTypes() { + public Iterator portTypes() { return _portTypes.iterator(); } - public Iterator bindings() { + public Iterator bindings() { return _bindings.iterator(); } @@ -159,20 +159,20 @@ public void withAllSubEntitiesDo(EntityAction action) { if (_types != null) { action.perform(_types); } - for (Iterator iter = _messages.iterator(); iter.hasNext();) { - action.perform((Entity) iter.next()); + for (Iterator iter = _messages.iterator(); iter.hasNext();) { + action.perform(iter.next()); } - for (Iterator iter = _portTypes.iterator(); iter.hasNext();) { - action.perform((Entity) iter.next()); + for (Iterator iter = _portTypes.iterator(); iter.hasNext();) { + action.perform(iter.next()); } - for (Iterator iter = _bindings.iterator(); iter.hasNext();) { - action.perform((Entity) iter.next()); + for (Iterator iter = _bindings.iterator(); iter.hasNext();) { + action.perform(iter.next()); } - for (Iterator iter = _services.iterator(); iter.hasNext();) { - action.perform((Entity) iter.next()); + for (Iterator iter = _services.iterator(); iter.hasNext();) { + action.perform(iter.next()); } - for (Iterator iter = _imports.iterator(); iter.hasNext();) { - action.perform((Entity) iter.next()); + for (Iterator iter = _imports.iterator(); iter.hasNext();) { + action.perform(iter.next()); } _helper.withAllSubEntitiesDo(action); } @@ -180,25 +180,25 @@ public void withAllSubEntitiesDo(EntityAction action) { public void accept(WSDLDocumentVisitor visitor) throws Exception { visitor.preVisit(this); - for (Iterator iter = _imports.iterator(); iter.hasNext();) { - ((Import) iter.next()).accept(visitor); + for (Iterator iter = _imports.iterator(); iter.hasNext();) { + iter.next().accept(visitor); } if (_types != null) { _types.accept(visitor); } - for (Iterator iter = _messages.iterator(); iter.hasNext();) { - ((Message) iter.next()).accept(visitor); + for (Iterator iter = _messages.iterator(); iter.hasNext();) { + iter.next().accept(visitor); } - for (Iterator iter = _portTypes.iterator(); iter.hasNext();) { - ((PortType) iter.next()).accept(visitor); + for (Iterator iter = _portTypes.iterator(); iter.hasNext();) { + iter.next().accept(visitor); } - for (Iterator iter = _bindings.iterator(); iter.hasNext();) { - ((Binding) iter.next()).accept(visitor); + for (Iterator iter = _bindings.iterator(); iter.hasNext();) { + iter.next().accept(visitor); } - for (Iterator iter = _services.iterator(); iter.hasNext();) { - ((Service) iter.next()).accept(visitor); + for (Iterator iter = _services.iterator(); iter.hasNext();) { + iter.next().accept(visitor); } _helper.accept(visitor); @@ -219,12 +219,12 @@ public Map resolveBindings() { private String _name; private String _targetNsURI; private Types _types; - private List _messages; - private List _portTypes; - private List _bindings; + private List _messages; + private List _portTypes; + private List _bindings; private List _services; - private List _imports; - private Set _importedNamespaces; + private List _imports; + private Set _importedNamespaces; @Override public QName getElementName() { diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/document/Message.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/document/Message.java index 61b6ca6f9..b0a80e4f2 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/document/Message.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/document/Message.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -83,8 +83,8 @@ public void setDocumentation(Documentation d) { public void withAllSubEntitiesDo(EntityAction action) { super.withAllSubEntitiesDo(action); - for (Iterator iter = _parts.iterator(); iter.hasNext();) { - action.perform((Entity) iter.next()); + for (Iterator iter = _parts.iterator(); iter.hasNext();) { + action.perform(iter.next()); } } diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/document/MessagePart.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/document/MessagePart.java index 5c4a7931a..9bceebc5d 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/document/MessagePart.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/document/MessagePart.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -95,7 +95,7 @@ public void accept(WSDLDocumentVisitor visitor) throws Exception { @Override public void validateThis() { - if(_descriptor != null && _descriptor.getLocalPart().equals("")){ + if(_descriptor != null && _descriptor.getLocalPart().isEmpty()){ failValidation("validation.invalidElement", _descriptor.toString()); } } diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/document/Operation.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/document/Operation.java index 2e8650a66..9d7934f9c 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/document/Operation.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/document/Operation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -176,7 +176,7 @@ public void validateThis() { if (_output != null) { failValidation("validation.invalidSubEntity", "output"); } - if (_faults != null && _faults.size() != 0) { + if (_faults != null && !_faults.isEmpty()) { failValidation("validation.invalidSubEntity", "fault"); } } else if (_style == OperationStyle.NOTIFICATION) { diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/document/PortType.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/document/PortType.java index f0100be72..44fef10e5 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/document/PortType.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/document/PortType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -29,8 +29,8 @@ public class PortType extends GlobalEntity implements TWSDLExtensible { public PortType(Defining defining, Locator locator, ErrorReceiver errReceiver) { super(defining, locator, errReceiver); - _operations = new ArrayList(); - _operationKeys = new HashSet(); + _operations = new ArrayList<>(); + _operationKeys = new HashSet<>(); _helper = new ExtensibilityHelper(); } @@ -44,14 +44,14 @@ public void add(Operation operation) { _operations.add(operation); } - public Iterator operations() { + public Iterator operations() { return _operations.iterator(); } - public Set getOperationsNamed(String s) { - Set result = new HashSet(); - for (Iterator iter = _operations.iterator(); iter.hasNext();) { - Operation operation = (Operation) iter.next(); + public Set getOperationsNamed(String s) { + Set result = new HashSet<>(); + for (Iterator iter = _operations.iterator(); iter.hasNext();) { + Operation operation = iter.next(); if (operation.getName().equals(s)) { result.add(operation); } @@ -81,8 +81,8 @@ public void setDocumentation(Documentation d) { public void withAllSubEntitiesDo(EntityAction action) { super.withAllSubEntitiesDo(action); - for (Iterator iter = _operations.iterator(); iter.hasNext();) { - action.perform((Entity) iter.next()); + for (Iterator iter = _operations.iterator(); iter.hasNext();) { + action.perform(iter.next()); } _helper.withAllSubEntitiesDo(action); } @@ -90,8 +90,8 @@ public void withAllSubEntitiesDo(EntityAction action) { public void accept(WSDLDocumentVisitor visitor) throws Exception { visitor.preVisit(this); _helper.accept(visitor); - for (Iterator iter = _operations.iterator(); iter.hasNext();) { - ((Operation) iter.next()).accept(visitor); + for (Iterator iter = _operations.iterator(); iter.hasNext();) { + iter.next().accept(visitor); } visitor.postVisit(this); } @@ -146,7 +146,7 @@ public void setParent(TWSDLExtensible parent) { private TWSDLExtensible parent; private Documentation _documentation; - private List _operations; - private Set _operationKeys; + private List _operations; + private Set _operationKeys; private ExtensibilityHelper _helper; } diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/document/Service.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/document/Service.java index 42c04f25f..a522f7035 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/document/Service.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/document/Service.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -31,7 +31,7 @@ public class Service extends GlobalEntity implements TWSDLExtensible { public Service(Defining defining, Locator locator, ErrorReceiver errReceiver) { super(defining, locator, errReceiver); - _ports = new ArrayList(); + _ports = new ArrayList<>(); _helper = new ExtensibilityHelper(); } @@ -64,16 +64,16 @@ public void setDocumentation(Documentation d) { @Override public void withAllSubEntitiesDo(EntityAction action) { - for (Iterator iter = _ports.iterator(); iter.hasNext();) { - action.perform((Entity) iter.next()); + for (Iterator iter = _ports.iterator(); iter.hasNext();) { + action.perform(iter.next()); } _helper.withAllSubEntitiesDo(action); } public void accept(WSDLDocumentVisitor visitor) throws Exception { visitor.preVisit(this); - for (Iterator iter = _ports.iterator(); iter.hasNext();) { - ((Port) iter.next()).accept(visitor); + for (Iterator iter = _ports.iterator(); iter.hasNext();) { + iter.next().accept(visitor); } _helper.accept(visitor); visitor.postVisit(this); diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/document/WSDLDocument.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/document/WSDLDocument.java index 5eed7a0b3..9f971481d 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/document/WSDLDocument.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/document/WSDLDocument.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -39,27 +39,27 @@ public void setDefinitions(Definitions d) { public QName[] getAllServiceQNames() { - ArrayList serviceQNames = new ArrayList(); + ArrayList serviceQNames = new ArrayList<>(); - for (Iterator iter = getDefinitions().services(); iter.hasNext();) { - Service next = (Service) iter.next(); + for (Iterator iter = getDefinitions().services(); iter.hasNext();) { + Service next = iter.next(); String targetNamespace = next.getDefining().getTargetNamespaceURI(); String localName = next.getName(); QName serviceQName = new QName(targetNamespace, localName); serviceQNames.add(serviceQName); } - return (QName[]) serviceQNames.toArray(new QName[0]); + return serviceQNames.toArray(new QName[0]); } public QName[] getAllPortQNames() { - ArrayList portQNames = new ArrayList(); + ArrayList portQNames = new ArrayList<>(); - for (Iterator iter = getDefinitions().services(); iter.hasNext();) { - Service next = (Service) iter.next(); + for (Iterator iter = getDefinitions().services(); iter.hasNext();) { + Service next = iter.next(); //Iterator ports = next.ports(); - for (Iterator piter = next.ports(); piter.hasNext();) { + for (Iterator piter = next.ports(); piter.hasNext();) { // If it's a relative import - Port pnext = (Port) piter.next(); + Port pnext = piter.next(); String targetNamespace = pnext.getDefining().getTargetNamespaceURI(); String localName = pnext.getName(); @@ -67,18 +67,18 @@ public QName[] getAllPortQNames() { portQNames.add(portQName); } } - return (QName[]) portQNames.toArray(new QName[0]); + return portQNames.toArray(new QName[0]); } public QName[] getPortQNames(String serviceNameLocalPart) { - ArrayList portQNames = new ArrayList(); + ArrayList portQNames = new ArrayList<>(); - for (Iterator iter = getDefinitions().services(); iter.hasNext();) { - Service next = (Service) iter.next(); + for (Iterator iter = getDefinitions().services(); iter.hasNext();) { + Service next = iter.next(); if (next.getName().equals(serviceNameLocalPart)) { - for (Iterator piter = next.ports(); piter.hasNext();) { - Port pnext = (Port) piter.next(); + for (Iterator piter = next.ports(); piter.hasNext();) { + Port pnext = piter.next(); String targetNamespace = pnext.getDefining().getTargetNamespaceURI(); String localName = pnext.getName(); @@ -87,7 +87,7 @@ public QName[] getPortQNames(String serviceNameLocalPart) { } } } - return (QName[]) portQNames.toArray(new QName[0]); + return portQNames.toArray(new QName[0]); } public void accept(WSDLDocumentVisitor visitor) throws Exception { diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/document/mime/MIMEMultipartRelated.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/document/mime/MIMEMultipartRelated.java index c49f1674e..9e9a28799 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/document/mime/MIMEMultipartRelated.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/document/mime/MIMEMultipartRelated.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -10,7 +10,6 @@ package com.sun.tools.ws.wsdl.document.mime; -import com.sun.tools.ws.wsdl.framework.Entity; import com.sun.tools.ws.wsdl.framework.EntityAction; import com.sun.tools.ws.wsdl.framework.ExtensionImpl; import com.sun.tools.ws.wsdl.framework.ExtensionVisitor; @@ -50,8 +49,8 @@ public Iterable getParts() { public void withAllSubEntitiesDo(EntityAction action) { super.withAllSubEntitiesDo(action); - for (Iterator iter = _parts.iterator(); iter.hasNext();) { - action.perform((Entity) iter.next()); + for (Iterator iter = _parts.iterator(); iter.hasNext();) { + action.perform(iter.next()); } } diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/document/soap/SOAPHeader.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/document/soap/SOAPHeader.java index 6264f7469..655173a24 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/document/soap/SOAPHeader.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/document/soap/SOAPHeader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -27,14 +27,14 @@ public class SOAPHeader extends ExtensionImpl { public SOAPHeader(Locator locator) { super(locator); - _faults = new ArrayList(); + _faults = new ArrayList<>(); } public void add(SOAPHeaderFault fault) { _faults.add(fault); } - public Iterator faults() { + public Iterator faults() { return _faults.iterator(); } @@ -95,8 +95,8 @@ public void setPart(String s) { public void withAllSubEntitiesDo(EntityAction action) { super.withAllSubEntitiesDo(action); - for (Iterator iter = _faults.iterator(); iter.hasNext();) { - action.perform((Entity) iter.next()); + for (Iterator iter = _faults.iterator(); iter.hasNext();) { + action.perform(iter.next()); } } @@ -112,8 +112,8 @@ public void withAllQNamesDo(QNameAction action) { @Override public void accept(ExtensionVisitor visitor) throws Exception { visitor.preVisit(this); - for (Iterator iter = _faults.iterator(); iter.hasNext();) { - ((SOAPHeaderFault) iter.next()).accept(visitor); + for (Iterator iter = _faults.iterator(); iter.hasNext();) { + iter.next().accept(visitor); } visitor.postVisit(this); } @@ -141,5 +141,5 @@ public void validateThis() { private String _part; private QName _message; private SOAPUse _use=SOAPUse.LITERAL; - private List _faults; + private List _faults; } diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/framework/Entity.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/framework/Entity.java index f391fa4f4..d17c65e6a 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/framework/Entity.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/framework/Entity.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -52,7 +52,7 @@ public void setProperty(String key, Object value) { } if (_properties == null) { - _properties = new HashMap(); + _properties = new HashMap<>(); } _properties.put(key, value); } @@ -87,5 +87,5 @@ protected void failValidation(String key, String arg) { arg, getElementName().getLocalPart()); } - private Map _properties; + private Map _properties; } diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/framework/ExtensibilityHelper.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/framework/ExtensibilityHelper.java index bb14d9541..d3896c29f 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/framework/ExtensibilityHelper.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/framework/ExtensibilityHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -21,20 +21,19 @@ * * @author WS Development Team */ +@SuppressWarnings({"deprecation"}) public class ExtensibilityHelper { public ExtensibilityHelper() { } - @SuppressWarnings({"deprecation"}) public void addExtension(TWSDLExtension e) { if (_extensions == null) { - _extensions = new ArrayList(); + _extensions = new ArrayList<>(); } _extensions.add(e); } - @SuppressWarnings({"deprecation"}) public Iterable extensions() { if (_extensions == null) { return new ArrayList<>(); @@ -45,7 +44,7 @@ public Iterable extensions() { public void withAllSubEntitiesDo(EntityAction action) { if (_extensions != null) { - for (Iterator iter = _extensions.iterator(); iter.hasNext();) { + for (Iterator iter = _extensions.iterator(); iter.hasNext();) { action.perform((Entity) iter.next()); } } @@ -53,12 +52,11 @@ public void withAllSubEntitiesDo(EntityAction action) { public void accept(ExtensionVisitor visitor) throws Exception { if (_extensions != null) { - for (Iterator iter = _extensions.iterator(); iter.hasNext();) { + for (Iterator iter = _extensions.iterator(); iter.hasNext();) { ((ExtensionImpl) iter.next()).accept(visitor); } } } - @SuppressWarnings({"deprecation"}) private List _extensions; } diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/framework/TWSDLParserContextImpl.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/framework/TWSDLParserContextImpl.java index d2c5b6a36..5a07a35ce 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/framework/TWSDLParserContextImpl.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/framework/TWSDLParserContextImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -130,37 +130,39 @@ public QName translateQualifiedName(Locator locator, String s) { return new QName(uri, XmlUtil.getLocalPart(s)); } + @SuppressWarnings({"unchecked"}) public void fireIgnoringExtension(Element e, Entity entity) { QName name = new QName(e.getNamespaceURI(), e.getLocalName()); QName parent = entity.getElementName(); - List _targets = null; + List _targets = null; synchronized (this) { if (_listeners != null) { - _targets = (List) _listeners.clone(); + _targets = (List) _listeners.clone(); } } if (_targets != null) { - for (Iterator iter = _targets.iterator(); iter.hasNext();) { - ParserListener l = (ParserListener) iter.next(); + for (Iterator iter = _targets.iterator(); iter.hasNext();) { + ParserListener l = iter.next(); l.ignoringExtension(entity, name, parent); } } } + @SuppressWarnings({"unchecked"}) public void fireDoneParsingEntity(QName element, Entity entity) { - List _targets = null; + List _targets = null; synchronized (this) { if (_listeners != null) { - _targets = (List) _listeners.clone(); + _targets = (List) _listeners.clone(); } } if (_targets != null) { - for (Iterator iter = _targets.iterator(); iter.hasNext();) { - ParserListener l = (ParserListener) iter.next(); + for (Iterator iter = _targets.iterator(); iter.hasNext();) { + ParserListener l = iter.next(); l.doneParsingEntity(element, entity); } } diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/parser/AbstractReferenceFinderImpl.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/parser/AbstractReferenceFinderImpl.java index 1f5ba8f7c..1c9634d99 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/parser/AbstractReferenceFinderImpl.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/parser/AbstractReferenceFinderImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -80,18 +80,11 @@ public void startElement(String namespaceURI, String localName, String qName, At // then parse this schema as well, // but don't mark this document as a root. parent.parse(ref,false); - } catch( URISyntaxException e ) { + } catch(URISyntaxException | IOException e ) { SAXParseException spe = new SAXParseException2( WsdlMessages.ABSTRACT_REFERENCE_FINDER_IMPL_UNABLE_TO_PARSE(relativeRef,e.getMessage()), locator, e ); - fatalError(spe); - throw spe; - } catch( IOException e ) { - SAXParseException spe = new SAXParseException2( - WsdlMessages.ABSTRACT_REFERENCE_FINDER_IMPL_UNABLE_TO_PARSE(relativeRef,e.getMessage()), - locator, e ); - fatalError(spe); throw spe; } diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/parser/DOMBuilder.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/parser/DOMBuilder.java index bbad2e61f..d1a0847c2 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/parser/DOMBuilder.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/parser/DOMBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -44,7 +44,7 @@ class DOMBuilder extends SAX2DOMEx implements LexicalHandler { * This set will receive newly found outermost * jaxb:bindings customizations. */ - public DOMBuilder( Document dom, LocatorTable ltable, Set outerMostBindings ) { + public DOMBuilder( Document dom, LocatorTable ltable, Set outerMostBindings ) { super( dom ); this.locatorTable = ltable; this.outerMostBindings = outerMostBindings; @@ -53,7 +53,7 @@ public DOMBuilder( Document dom, LocatorTable ltable, Set outerMostBindings ) { /** Location information will be stored into this object. */ private final LocatorTable locatorTable; - private final Set outerMostBindings; + private final Set outerMostBindings; private Locator locator; diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/parser/DOMForest.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/parser/DOMForest.java index 92c73561b..c97847f03 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/parser/DOMForest.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/parser/DOMForest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -201,8 +201,7 @@ public Map getReferencedEntityMap() { } public void addExternalReferences(String ref) { - if (!externalReferences.contains(ref)) - externalReferences.add(ref); + externalReferences.add(ref); } @@ -305,7 +304,7 @@ public Document get(String systemId) { */ private String getPath(String key) { key = key.substring(5); // skip 'file:' - while (key.length() > 0 && key.charAt(0) == '/') + while (!key.isEmpty() && key.charAt(0) == '/') key = key.substring(1); return key; } diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/parser/MemberSubmissionAddressingExtensionHandler.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/parser/MemberSubmissionAddressingExtensionHandler.java index bc56549c3..e3fed9d5d 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/parser/MemberSubmissionAddressingExtensionHandler.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/parser/MemberSubmissionAddressingExtensionHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -65,7 +65,7 @@ public boolean handleInputExtension(TWSDLParserContext context, TWSDLExtensible if (extensionModeOn) { warn(context.getLocation(e)); String actionValue = XmlUtil.getAttributeNSOrNull(e, MemberSubmissionAddressingConstants.WSA_ACTION_QNAME); - if (actionValue == null || actionValue.equals("")) { + if (actionValue == null || actionValue.isEmpty()) { return warnEmptyAction(parent, context.getLocation(e)); } ((Input) parent).setAction(actionValue); @@ -94,7 +94,7 @@ public boolean handleOutputExtension(TWSDLParserContext context, TWSDLExtensible if (extensionModeOn) { warn(context.getLocation(e)); String actionValue = XmlUtil.getAttributeNSOrNull(e, MemberSubmissionAddressingConstants.WSA_ACTION_QNAME); - if (actionValue == null || actionValue.equals("")) { + if (actionValue == null || actionValue.isEmpty()) { return warnEmptyAction(parent, context.getLocation(e)); } ((Output) parent).setAction(actionValue); @@ -110,7 +110,7 @@ public boolean handleFaultExtension(TWSDLParserContext context, TWSDLExtensible if (extensionModeOn) { warn(context.getLocation(e)); String actionValue = XmlUtil.getAttributeNSOrNull(e, MemberSubmissionAddressingConstants.WSA_ACTION_QNAME); - if (actionValue == null || actionValue.equals("")) { + if (actionValue == null || actionValue.isEmpty()) { errReceiver.warning(context.getLocation(e), WsdlMessages.WARNING_FAULT_EMPTY_ACTION(parent.getNameValue(), parent.getWSDLElementName().getLocalPart(), parent.getParent().getNameValue())); return false; // keep compiler happy } diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/parser/MetadataFinder.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/parser/MetadataFinder.java index 397cf991d..ed5e9a9ef 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/parser/MetadataFinder.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/parser/MetadataFinder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -92,8 +92,6 @@ public void parseWSDL(){ } catch (FileNotFoundException e) { errorReceiver.error(WsdlMessages.FILE_NOT_FOUND(systemID), e); return; - } catch (SAXParseException e) { - doc = getFromMetadataResolver(systemID, e); } catch (IOException | SAXException e) { doc = getFromMetadataResolver(systemID, e); } @@ -182,7 +180,7 @@ public InputSource resolveEntity(String publicId, String systemId) throws SAXExc if (code == 302 || code == 303) { //retry with the value in Location header List seeOther = httpConn.getHeaderFields().get("Location"); - if (seeOther != null && seeOther.size() > 0) { + if (seeOther != null && !seeOther.isEmpty()) { URL newurl = new URL(url, seeOther.get(0)); if (!newurl.equals(url)) { errorReceiver.info(new SAXParseException(WscompileMessages.WSIMPORT_HTTP_REDIRECT(code, seeOther.get(0)), null)); @@ -336,12 +334,10 @@ private Element parseMetadata(@NotNull String systemId, @NotNull ServiceDescript Element imp = (Element) nl.item(i); String loc = imp.getAttribute("location"); if (loc != null) { - if (!externalReferences.contains(loc)) - externalReferences.add(loc); + externalReferences.add(loc); } } - if (core.keySet().contains(systemId)) - core.remove(systemId); + core.remove(systemId); core.put(src.getSystemId(), doc); resolvedCache.put(systemId, doc.getDocumentURI()); isMexMetadata = true; diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/parser/Util.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/parser/Util.java index 832c592f7..f5683f669 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/parser/Util.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/parser/Util.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -111,7 +111,7 @@ public static Element nextElement(Iterator iter) { Node n = (Node) iter.next(); if (n instanceof Text) { Text t = (Text) n; - if (t.getData().trim().length() == 0) + if (t.getData().trim().isEmpty()) continue; fail("parsing.nonWhitespaceTextFound", t.getData().trim()); } diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/parser/VersionChecker.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/parser/VersionChecker.java index c6b6a0fde..ad9d580de 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/parser/VersionChecker.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/parser/VersionChecker.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -16,7 +16,6 @@ import org.xml.sax.helpers.LocatorImpl; import org.xml.sax.helpers.XMLFilterImpl; -import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; diff --git a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/parser/W3CAddressingMetadataExtensionHandler.java b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/parser/W3CAddressingMetadataExtensionHandler.java index b4b3c4863..f4ade362f 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/parser/W3CAddressingMetadataExtensionHandler.java +++ b/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/wsdl/parser/W3CAddressingMetadataExtensionHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -49,7 +49,7 @@ public String getNamespaceURI() { @Override public boolean handleInputExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) { String actionValue = XmlUtil.getAttributeNSOrNull(e, W3CAddressingMetadataConstants.WSAM_ACTION_QNAME); - if (actionValue == null || actionValue.equals("")) { + if (actionValue == null || actionValue.isEmpty()) { return warnEmptyAction(parent, context.getLocation(e)); } ((Input)parent).setAction(actionValue); @@ -59,7 +59,7 @@ public boolean handleInputExtension(TWSDLParserContext context, TWSDLExtensible @Override public boolean handleOutputExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) { String actionValue = XmlUtil.getAttributeNSOrNull(e, W3CAddressingMetadataConstants.WSAM_ACTION_QNAME); - if (actionValue == null || actionValue.equals("")) { + if (actionValue == null || actionValue.isEmpty()) { return warnEmptyAction(parent,context.getLocation(e)); } ((Output)parent).setAction(actionValue); @@ -69,7 +69,7 @@ public boolean handleOutputExtension(TWSDLParserContext context, TWSDLExtensible @Override public boolean handleFaultExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) { String actionValue = XmlUtil.getAttributeNSOrNull(e, W3CAddressingMetadataConstants.WSAM_ACTION_QNAME); - if (actionValue == null || actionValue.equals("")) { + if (actionValue == null || actionValue.isEmpty()) { errReceiver.warning(context.getLocation(e), WsdlMessages.WARNING_FAULT_EMPTY_ACTION(parent.getNameValue(), parent.getWSDLElementName().getLocalPart(), parent.getParent().getNameValue())); return false; // keep compiler happy } diff --git a/jaxws-ri/tools/wscompile/src/main/java/module-info.java b/jaxws-ri/tools/wscompile/src/main/java/module-info.java index 8e82cee0b..8936eb922 100644 --- a/jaxws-ri/tools/wscompile/src/main/java/module-info.java +++ b/jaxws-ri/tools/wscompile/src/main/java/module-info.java @@ -16,6 +16,7 @@ * * @since 2.4.0 */ +@SuppressWarnings({"deprecation"}) module com.sun.tools.ws.wscompile { requires transitive java.compiler; @@ -28,7 +29,7 @@ requires static com.sun.xml.ws.servlet; requires com.sun.istack.tools; - requires org.glassfish.jaxb.jxc; + requires transitive org.glassfish.jaxb.jxc; requires transitive org.glassfish.jaxb.xjc; exports com.sun.tools.ws; diff --git a/jaxws-ri/tools/wscompile/src/test/java/com/sun/tools/ws/test/ant/WsAntToolsTest.java b/jaxws-ri/tools/wscompile/src/test/java/com/sun/tools/ws/test/ant/WsAntToolsTest.java index 9e07a0f88..159adfe46 100644 --- a/jaxws-ri/tools/wscompile/src/test/java/com/sun/tools/ws/test/ant/WsAntToolsTest.java +++ b/jaxws-ri/tools/wscompile/src/test/java/com/sun/tools/ws/test/ant/WsAntToolsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -115,7 +115,7 @@ private String fixIfSNAPSHOT(String jar) { private void runVoidMethod(Class c, Object i, String name, String arg) { Method m = null; - Class parent = c; + Class parent = c; do { try { m = parent.getDeclaredMethod(name, String.class); @@ -137,7 +137,7 @@ private void runVoidMethod(Class c, Object i, String name, String arg) { private Object getField(Class c, Object i, String name) { Field f = null; - Class parent = c.getSuperclass(); + Class parent = c.getSuperclass(); do { try { f = parent.getDeclaredField(name); diff --git a/jaxws-ri/tools/wscompile/src/test/java/module-info.java b/jaxws-ri/tools/wscompile/src/test/java/module-info.java index 770fff6c2..87c4ff238 100644 --- a/jaxws-ri/tools/wscompile/src/test/java/module-info.java +++ b/jaxws-ri/tools/wscompile/src/test/java/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -8,6 +8,7 @@ * SPDX-License-Identifier: BSD-3-Clause */ +@SuppressWarnings({"deprecation"}) module com.sun.tools.ws.wscompile.test { requires java.xml; requires transitive com.sun.tools.ws.wscompile;