You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2020/01/06 16:33:56 UTC

[cxf] branch master updated (9c48667 -> e72ad77)

This is an automated email from the ASF dual-hosted git repository.

coheigea pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git.


    from 9c48667  cxf-rt-frontend-jaxrs: fix warning 'boxed variable is never null'
     new eff15d9  Javadoc updates
     new e72ad77  CXF-8187 - Codegen-Plugin failed when maven is executed on jdk9+ with Toolchains specifying jdk 8

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../cxf/maven_plugin/AbstractCodegenMojo.java      | 78 +++++++++++++++++++---
 .../java/org/apache/cxf/aegis/AegisContext.java    |  7 +-
 .../org/apache/cxf/jaxrs/utils/JAXRSUtils.java     |  1 -
 .../org/apache/cxf/jaxrs/client/ClientState.java   |  6 +-
 .../cxf/rs/security/oauth2/common/OAuthError.java  |  1 -
 .../rs/security/oauth2/common/OAuthPermission.java |  2 +-
 .../org/apache/cxf/transport/http/Headers.java     | 13 ++--
 .../apache/cxf/transport/jms/uri/JMSEndpoint.java  | 18 ++---
 .../apache/cxf/ws/addressing/soap/MAPCodec.java    | 21 +++---
 .../java/org/apache/cxf/ws/rm/EncoderDecoder.java  | 21 +++---
 .../cxf/ws/rm/soap/RetransmissionQueueImpl.java    |  6 +-
 .../policyhandlers/AbstractBindingBuilder.java     | 24 +++----
 .../xkms/x509/repo/ldap/LdapCertificateRepo.java   |  4 +-
 13 files changed, 124 insertions(+), 78 deletions(-)


[cxf] 01/02: Javadoc updates

Posted by co...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

coheigea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit eff15d982722111d5da87591bd115cefefe944df
Author: Colm O hEigeartaigh <co...@apache.org>
AuthorDate: Mon Jan 6 11:31:45 2020 +0000

    Javadoc updates
---
 .../java/org/apache/cxf/aegis/AegisContext.java    |  7 +------
 .../org/apache/cxf/jaxrs/utils/JAXRSUtils.java     |  1 -
 .../org/apache/cxf/jaxrs/client/ClientState.java   |  6 +++---
 .../cxf/rs/security/oauth2/common/OAuthError.java  |  1 -
 .../rs/security/oauth2/common/OAuthPermission.java |  2 +-
 .../org/apache/cxf/transport/http/Headers.java     | 13 ++++++------
 .../apache/cxf/transport/jms/uri/JMSEndpoint.java  | 18 ++++++++--------
 .../apache/cxf/ws/addressing/soap/MAPCodec.java    | 21 +++++++++----------
 .../java/org/apache/cxf/ws/rm/EncoderDecoder.java  | 21 ++++++++-----------
 .../cxf/ws/rm/soap/RetransmissionQueueImpl.java    |  6 +++---
 .../policyhandlers/AbstractBindingBuilder.java     | 24 +++++++++++-----------
 .../xkms/x509/repo/ldap/LdapCertificateRepo.java   |  4 +---
 12 files changed, 55 insertions(+), 69 deletions(-)

diff --git a/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/AegisContext.java b/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/AegisContext.java
index a00219e..2d5abdd 100644
--- a/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/AegisContext.java
+++ b/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/AegisContext.java
@@ -130,8 +130,6 @@ public class AegisContext {
     /**
      * Initialize the context. The encodingStyleURI allows .aegis.xml files to have multiple mappings for,
      * say, SOAP 1.1 versus SOAP 1.2. Passing null uses a default URI.
-     *
-     * @param mappingNamespaceURI URI to select mappings based on the encoding.
      */
     public void initialize() {
         // allow spring config of an alternative mapping.
@@ -226,9 +224,6 @@ public class AegisContext {
 
     /**
      * Examine a list of override classes, and register all of them.
-     *
-     * @param tm type manager for this binding
-     * @param classes list of class names
      */
     private void processRootTypes() {
         rootTypes = new HashSet<>();
@@ -360,7 +355,7 @@ public class AegisContext {
     /**
      * Set the configuration object. The configuration specifies default type mapping behaviors.
      *
-     * @param configuration The configuration to set.
+     * @param newConfiguration The configuration to set.
      */
     public void setTypeCreationOptions(TypeCreationOptions newConfiguration) {
         this.configuration = newConfiguration;
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
index 9e6154c..4ed018c 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
@@ -1273,7 +1273,6 @@ public final class JAXRSUtils {
 
     /**
      * Retrieve map of query parameters from the passed in message
-     * @param message
      * @return a Map of query parameters.
      */
     public static MultivaluedMap<String, String> getStructuredParams(String query,
diff --git a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/ClientState.java b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/ClientState.java
index 8fb6c0b..4cdc740 100644
--- a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/ClientState.java
+++ b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/ClientState.java
@@ -88,7 +88,7 @@ public interface ClientState {
      * Sets the map containing template name and value pairs
      * @param templates
      */
-    void setTemplates(MultivaluedMap<String, String> map);
+    void setTemplates(MultivaluedMap<String, String> templates);
 
     /**
      * Gets the templates map
@@ -116,7 +116,7 @@ public interface ClientState {
     ClientState newState(URI baseURI,
                          MultivaluedMap<String, String> headers,
                          MultivaluedMap<String, String> templates);
-    
+
     /**
      * The factory method for creating a new state.
      * Example, proxy and WebClient.fromClient will use this method when creating
@@ -125,7 +125,7 @@ public interface ClientState {
      * @param baseURI baseURI
      * @param headers request headers, can be null
      * @param templates initial templates map, can be null
-     * @param additional properties, could be null
+     * @param properties additional properties, could be null
      * @return client state
      */
     default ClientState newState(URI baseURI,
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/OAuthError.java b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/OAuthError.java
index 33c1a47..2958e9e 100644
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/OAuthError.java
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/OAuthError.java
@@ -85,7 +85,6 @@ public class OAuthError {
     /**
      * Gets the optional link to the page
      * describing the error in detail
-     * @param errorUri error page URI
      */
     public String getErrorUri() {
         return errorUri;
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/OAuthPermission.java b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/OAuthPermission.java
index 2ebfbf8..a8486ac 100644
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/OAuthPermission.java
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/OAuthPermission.java
@@ -141,7 +141,7 @@ public class OAuthPermission implements Serializable {
      * 'read' scope is always allocated. This can be presented at the UI level as follows:
      * the read-only check-box control will represent a 'read' scope and a user will be able to
      * optionally select 'add' and/or 'update' scopes, in addition to the default 'read' one.
-     * @param isDefault true if the permission has been allocated by default
+     * @param value true if the permission has been allocated by default
      */
     public void setDefaultPermission(boolean value) {
         this.isDefaultPermission = value;
diff --git a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Headers.java b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Headers.java
index 3790076..df0cca0 100644
--- a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Headers.java
+++ b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Headers.java
@@ -285,7 +285,7 @@ public class Headers {
                 String key = HttpHeaderHelper.getHeaderKey(entry.getKey());
                 List<String> old = headers.get(key);
                 if (old != null) {
-                    List<String> nl = new ArrayList<>(old.size() + entry.getValue().size()); 
+                    List<String> nl = new ArrayList<>(old.size() + entry.getValue().size());
                     nl.addAll(old);
                     nl.addAll(entry.getValue());
                     headers.put(key, nl);
@@ -306,7 +306,8 @@ public class Headers {
      *
      * @param logger     The Logger to log to.
      * @param level   The Logging Level.
-     * @param headers The Message protocol headers.
+     * @param headersMap The Message protocol headers.
+     * @param logSensitiveHeaders whether to log sensitive headers
      */
     static void logProtocolHeaders(Logger logger, Level level,
                                    Map<String, List<Object>> headersMap,
@@ -422,8 +423,7 @@ public class Headers {
     /**
      * Copy the request headers into the message.
      *
-     * @param message the current message
-     * @param headers the current set of headers
+     * @param req the current servlet request
      */
     protected void copyFromRequest(HttpServletRequest req) {
 
@@ -495,12 +495,11 @@ public class Headers {
     private boolean isSingleHeader(String header) {
         return HTTP_HEADERS_SETCOOKIE.equalsIgnoreCase(header) || HTTP_HEADERS_LINK.equalsIgnoreCase(header);
     }
-    
+
     /**
      * Copy the response headers into the response.
      *
-     * @param message the current message
-     * @param headers the current set of headers
+     * @param response the current ServletResponse
      */
     protected void copyToResponse(HttpServletResponse response) {
         String contentType = getContentTypeFromMessage();
diff --git a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSEndpoint.java b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSEndpoint.java
index a5627d1..7451785 100644
--- a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSEndpoint.java
+++ b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSEndpoint.java
@@ -101,7 +101,7 @@ public class JMSEndpoint {
     /**
      * Get the extensors from the wsdl and/or configuration that will
      * then be used to configure the JMSConfiguration object
-     * @param endpointUri
+     * @param endpointInfo
      * @param target
      */
     public JMSEndpoint(EndpointInfo endpointInfo, EndpointReferenceType target) {
@@ -109,14 +109,14 @@ public class JMSEndpoint {
     }
 
     /**
-     * @param ei
+     * @param endpointInfo
      * @param endpointUri
      */
-    public JMSEndpoint(EndpointInfo ei, String endpointUri) {
+    public JMSEndpoint(EndpointInfo endpointInfo, String endpointUri) {
         this.jmsVariant = JMSEndpoint.QUEUE;
 
-        if (ei != null) {
-            JMSEndpointWSDLUtil.retrieveWSDLInformation(this, ei);
+        if (endpointInfo != null) {
+            JMSEndpointWSDLUtil.retrieveWSDLInformation(this, endpointInfo);
         }
         if (!(StringUtils.isEmpty(endpointUri) || "jms://".equals(endpointUri) || !endpointUri.startsWith("jms"))) {
             this.endpointUri = endpointUri;
@@ -128,11 +128,11 @@ public class JMSEndpoint {
 
             // Use the properties like e.g. from JAXWS properties with "jms." prefix
             Map<String, Object> jmsProps = new HashMap<>();
-            if (ei != null) {
-                getJaxWsJmsProps(ei.getProperties(), jmsProps);
+            if (endpointInfo != null) {
+                getJaxWsJmsProps(endpointInfo.getProperties(), jmsProps);
             }
-            if (ei != null && ei.getBinding() != null) {
-                getJaxWsJmsProps(ei.getBinding().getProperties(), jmsProps);
+            if (endpointInfo != null && endpointInfo.getBinding() != null) {
+                getJaxWsJmsProps(endpointInfo.getBinding().getProperties(), jmsProps);
             }
             configureProperties(jmsProps);
         }
diff --git a/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java b/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java
index 2776212..2fa64da 100644
--- a/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java
+++ b/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java
@@ -78,7 +78,7 @@ import org.apache.cxf.ws.addressing.VersionTransformer.Names200408;
  */
 public class MAPCodec extends AbstractSoapInterceptor {
     public static final MAPCodec INSTANCE = new MAPCodec();
-    
+
     private static final Logger LOG = LogUtils.getL7dLogger(MAPCodec.class);
     private static final String IS_REFERENCE_PARAM_ATTR_NAME = "IsReferenceParameter";
     private static final ResourceBundle BUNDLE = LOG.getResourceBundle();
@@ -118,7 +118,7 @@ public class MAPCodec extends AbstractSoapInterceptor {
         }
         return mc;
     }
-    
+
     public Map<String, Exchange> getUncorrelatedExchanges() {
         return uncorrelatedExchanges;
     }
@@ -449,10 +449,10 @@ public class MAPCodec extends AbstractSoapInterceptor {
      *
      * @param maps the MAPs, where getNamespceURI() specifies the WS-Addressing
      *  version to expose
+     * @param message the SoapMessage
      * @param value the value to encode
      * @param name the QName for the header
      * @param clz the class
-     * @param header the SOAP header element
      * @param JAXBContext the JAXB context to use
      */
     private <T> void encodeAsExposed(AddressingProperties maps,
@@ -482,7 +482,7 @@ public class MAPCodec extends AbstractSoapInterceptor {
      * Decode the MAPs from protocol-specific headers.
      *
      * @param message the SOAP message
-     * @param the decoded MAPs
+     * @return the decoded MAPs
      * @exception SOAPFaultException if decoded MAPs are invalid
      */
     public AddressingProperties unmarshalMAPs(SoapMessage message) {
@@ -644,7 +644,7 @@ public class MAPCodec extends AbstractSoapInterceptor {
      * @param encodedAs specifies the encoded version
      * @param clz the class
      * @param headerElement the SOAP header element
-     * @param marshaller the JAXB marshaller to use
+     * @param unmarshaller the JAXB unmarshaller to use
      * @return the decoded value
      */
     public <T> T decodeAsNative(String encodedAs,
@@ -690,7 +690,7 @@ public class MAPCodec extends AbstractSoapInterceptor {
      * Decode the MAPs from protocol-specific headers.
      *
      * @param message the messsage
-     * @param the decoded MAPs
+     * @return the decoded MAPs
      * @exception SOAPFaultException if decoded MAPs are invalid
      */
     private AddressingProperties decode(SoapMessage message) {
@@ -706,8 +706,8 @@ public class MAPCodec extends AbstractSoapInterceptor {
      * @param value the value to encode
      * @param qname the QName for the header
      * @param clz the class
-     * @param header the SOAP header element
-     * @param marshaller the JAXB context to use
+     * @param ctx the JAXBContent
+     * @param mustUnderstand
      */
     protected <T> void encodeMAP(SoapMessage message,
                                  T value,
@@ -727,7 +727,7 @@ public class MAPCodec extends AbstractSoapInterceptor {
      *
      * @param clz the class
      * @param headerElement the SOAP header element
-     * @param marshaller the JAXB marshaller to use
+     * @param unmarshaller the JAXB unmarshaller to use
      * @return the decoded value
      */
     protected <T> T decodeMAP(Class<T> clz,
@@ -757,7 +757,7 @@ public class MAPCodec extends AbstractSoapInterceptor {
     }
 
     /**
-     * Propogate action to SOAPAction header
+     * Propagate action to SOAPAction header
      *
      * @param action the Action property
      * @param message the SOAP message
@@ -804,7 +804,6 @@ public class MAPCodec extends AbstractSoapInterceptor {
      * Create a SoapFault.
      *
      * @param localName the fault local name
-     * @param prefix the fault prefix
      * @param namespace the fault namespace
      * @param reason the fault reason
      * @return a new SoapFault
diff --git a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder.java b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder.java
index 6e8b184..69c5518 100644
--- a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder.java
+++ b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder.java
@@ -46,7 +46,7 @@ import org.apache.cxf.ws.rm.v200702.TerminateSequenceType;
  */
 public abstract class EncoderDecoder {
     protected volatile DataBinding databinding;
-    
+
     /**
      * Get context for JAXB marshalling/unmarshalling.
      *
@@ -54,7 +54,7 @@ public abstract class EncoderDecoder {
      * @throws JAXBException
      */
     protected abstract JAXBContext getContext() throws JAXBException;
-        
+
 
     /**
      * Get the WS-ReliableMessaging namespace used by this encoder/decoder.
@@ -105,7 +105,7 @@ public abstract class EncoderDecoder {
      */
     public abstract Class<?> getTerminateSequenceResponseType();
 
-    
+
     /**
      * Get the databinding used for the header objects
      * @return databinding
@@ -124,14 +124,13 @@ public abstract class EncoderDecoder {
         return result;
     }
 
-    
+
     /**
      * Builds an element containing WS-RM headers. This adds the appropriate WS-RM namespace declaration to the element,
      * and then adds any WS-RM headers set in the supplied properties as child elements.
      *
      * @param rmps
-     * @param qname constructed element name
-     * @return element (<code>null</code> if none)
+     * @param headers the list of headers
      */
     public void buildHeaders(RMProperties rmps, List<Header> headers) throws JAXBException {
 
@@ -151,12 +150,11 @@ public abstract class EncoderDecoder {
      * the element, and then adds the Fault as a child element.
      *
      * @param sf
-     * @param qname constructed element name
-     * @return element
+     * @return Header fault
      */
     public Header buildHeaderFault(SequenceFault sf) throws JAXBException {
         Object o = buildHeaderFaultObject(sf);
-        
+
         return new Header(new QName(getConstants().getWSRMNamespace(),
                                     RMConstants.SEQUENCE_FAULT_NAME),
                           o, getDataBinding());
@@ -169,8 +167,7 @@ public abstract class EncoderDecoder {
      * @param acks
      * @param reqs
      * @param last
-     * @param header
-     * @param marshaller
+     * @param headers
      * @throws JAXBException
      */
     protected abstract void buildHeaders(SequenceType seq, Collection<SequenceAcknowledgement> acks,
@@ -180,7 +177,7 @@ public abstract class EncoderDecoder {
      * Build a header fault, using the correct protocol variation.
      *
      * @param sf
-     * @return the object marshallable with the JAXContext 
+     * @return the object marshallable with the JAXContext
      */
     protected abstract Object buildHeaderFaultObject(SequenceFault sf);
 
diff --git a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java
index 5ad066b..e73ef73 100644
--- a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java
+++ b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java
@@ -330,7 +330,7 @@ public class RetransmissionQueueImpl implements RetransmissionQueue {
     /**
      * Accepts a new resend candidate.
      *
-     * @param ctx the message context.
+     * @param message the message object.
      * @return ResendCandidate
      */
     protected ResendCandidate cacheUnacknowledged(Message message) {
@@ -420,7 +420,7 @@ public class RetransmissionQueueImpl implements RetransmissionQueue {
         private boolean includeAckRequested;
 
         /**
-         * @param ctx message context for the unacked message
+         * @param m the unacked message
          */
         protected ResendCandidate(Message m) {
             message = m;
@@ -664,7 +664,7 @@ public class RetransmissionQueueImpl implements RetransmissionQueue {
          * Resend mechanics.
          *
          * @param message
-         * @param if a AckRequest should be included
+         * @param requestAcknowledge if a AckRequest should be included
          */
         void resend(Message message, boolean requestAcknowledge);
     }
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java
index 8cd7c24..f49061a 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java
@@ -1062,26 +1062,26 @@ public abstract class AbstractBindingBuilder extends AbstractCommonBindingHandle
      *
      * @return the generated or discovered wsu:Id attribute value
      */
-    public String addWsuIdToElement(Element elem) {
+    public String addWsuIdToElement(Element element) {
         String id;
 
         //first try to get the Id attr
-        Attr idAttr = elem.getAttributeNodeNS(null, "Id");
+        Attr idAttr = element.getAttributeNodeNS(null, "Id");
         if (idAttr == null) {
             //then try the wsu:Id value
-            idAttr = elem.getAttributeNodeNS(PolicyConstants.WSU_NAMESPACE_URI, "Id");
+            idAttr = element.getAttributeNodeNS(PolicyConstants.WSU_NAMESPACE_URI, "Id");
         }
 
         if (idAttr != null) {
             id = idAttr.getValue();
         } else {
             //Add an id
-            id = wssConfig.getIdAllocator().createId("_", elem);
+            id = wssConfig.getIdAllocator().createId("_", element);
             String pfx = null;
             try {
-                pfx = elem.lookupPrefix(PolicyConstants.WSU_NAMESPACE_URI);
+                pfx = element.lookupPrefix(PolicyConstants.WSU_NAMESPACE_URI);
             } catch (Throwable t) {
-                pfx = DOMUtils.getPrefixRecursive(elem, PolicyConstants.WSU_NAMESPACE_URI);
+                pfx = DOMUtils.getPrefixRecursive(element, PolicyConstants.WSU_NAMESPACE_URI);
             }
             boolean found = !StringUtils.isEmpty(pfx);
             int cnt = 0;
@@ -1090,9 +1090,9 @@ public abstract class AbstractBindingBuilder extends AbstractCommonBindingHandle
 
                 String ns;
                 try {
-                    ns = elem.lookupNamespaceURI(pfx);
+                    ns = element.lookupNamespaceURI(pfx);
                 } catch (Throwable t) {
-                    ns = DOMUtils.getNamespace(elem, pfx);
+                    ns = DOMUtils.getNamespace(element, pfx);
                 }
 
                 if (!StringUtils.isEmpty(ns)) {
@@ -1101,14 +1101,14 @@ public abstract class AbstractBindingBuilder extends AbstractCommonBindingHandle
                 }
             }
             if (!found) {
-                idAttr = elem.getOwnerDocument().createAttributeNS(WSDLConstants.NS_XMLNS, "xmlns:" + pfx);
+                idAttr = element.getOwnerDocument().createAttributeNS(WSDLConstants.NS_XMLNS, "xmlns:" + pfx);
                 idAttr.setValue(PolicyConstants.WSU_NAMESPACE_URI);
-                elem.setAttributeNodeNS(idAttr);
+                element.setAttributeNodeNS(idAttr);
             }
-            idAttr = elem.getOwnerDocument().createAttributeNS(PolicyConstants.WSU_NAMESPACE_URI,
+            idAttr = element.getOwnerDocument().createAttributeNS(PolicyConstants.WSU_NAMESPACE_URI,
                                                                pfx + ":Id");
             idAttr.setValue(id);
-            elem.setAttributeNodeNS(idAttr);
+            element.setAttributeNodeNS(idAttr);
         }
 
         return id;
diff --git a/services/xkms/xkms-x509-repo-ldap/src/main/java/org/apache/cxf/xkms/x509/repo/ldap/LdapCertificateRepo.java b/services/xkms/xkms-x509-repo-ldap/src/main/java/org/apache/cxf/xkms/x509/repo/ldap/LdapCertificateRepo.java
index 54fade9..2445ba8 100644
--- a/services/xkms/xkms-x509-repo-ldap/src/main/java/org/apache/cxf/xkms/x509/repo/ldap/LdapCertificateRepo.java
+++ b/services/xkms/xkms-x509-repo-ldap/src/main/java/org/apache/cxf/xkms/x509/repo/ldap/LdapCertificateRepo.java
@@ -59,10 +59,8 @@ public class LdapCertificateRepo implements CertificateRepo {
     /**
      *
      * @param ldapSearch
+     * @param ldapConfig
      * @param rootDN rootDN of the LDAP tree
-     * @param trustedAuthorityFilter
-     * @param intermediateFilter
-     * @param attrName
      */
     public LdapCertificateRepo(LdapSearch ldapSearch, LdapSchemaConfig ldapConfig, String rootDN) {
         this.ldapSearch = ldapSearch;


[cxf] 02/02: CXF-8187 - Codegen-Plugin failed when maven is executed on jdk9+ with Toolchains specifying jdk 8

Posted by co...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

coheigea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit e72ad770c9a8f4439b93e2c19e61c43562ac5877
Author: Colm O hEigeartaigh <co...@apache.org>
AuthorDate: Mon Jan 6 15:36:49 2020 +0000

    CXF-8187 - Codegen-Plugin failed when maven is executed on jdk9+ with Toolchains specifying jdk 8
---
 .../cxf/maven_plugin/AbstractCodegenMojo.java      | 78 +++++++++++++++++++---
 1 file changed, 69 insertions(+), 9 deletions(-)

diff --git a/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMojo.java b/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMojo.java
index 8b96592..c47bb06 100644
--- a/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMojo.java
+++ b/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMojo.java
@@ -209,14 +209,6 @@ public abstract class AbstractCodegenMojo extends AbstractMojo {
     public void execute() throws MojoExecutionException {
         if (JavaUtils.isJava9Compatible()) {
             fork = "true";
-            additionalJvmArgs = "--add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED "
-                    + "--add-exports=java.xml/com.sun.org.apache.xerces.internal.impl.xs=ALL-UNNAMED "
-                    + "--add-opens java.base/java.security=ALL-UNNAMED "
-                    + "--add-opens java.base/java.net=ALL-UNNAMED "
-                    + "--add-opens java.base/java.lang=ALL-UNNAMED "
-                    + "--add-opens java.base/java.util=ALL-UNNAMED "
-                    + "--add-opens java.base/java.util.concurrent=ALL-UNNAMED "
-                    + (additionalJvmArgs == null ? "" : additionalJvmArgs);
         }
         System.setProperty("org.apache.cxf.JDKBugHacks.defaultUsesCaches", "true");
 
@@ -617,8 +609,10 @@ public abstract class AbstractCodegenMojo extends AbstractMojo {
         Commandline cmd = new Commandline();
         cmd.getShell().setQuotedArgumentsEnabled(true); // for JVM args
         cmd.setWorkingDirectory(project.getBuild().getDirectory());
-        cmd.setExecutable(getJavaExecutable().getAbsolutePath());
+        String javaPath = getJavaExecutable().getAbsolutePath();
+        cmd.setExecutable(javaPath);
 
+        setJvmForkArgs(javaPath);
         cmd.createArg().setLine(additionalJvmArgs);
 
         File file = null;
@@ -706,6 +700,72 @@ public abstract class AbstractCodegenMojo extends AbstractMojo {
     }
 
     /**
+     * Run the JDK version (could be set via the toolchain) and see if we need to configure the JvmArgs
+     * accordingly. Once we remove JDK8 support we can just add the additional args by default and remove
+     * this method.
+     */
+    private void setJvmForkArgs(String javaExecutablePath) {
+        Commandline cmd = new Commandline();
+        cmd.getShell().setQuotedArgumentsEnabled(true); // for JVM args
+        cmd.setWorkingDirectory(project.getBuild().getDirectory());
+        cmd.setExecutable(javaExecutablePath);
+        Java9StreamConsumer consumer = new Java9StreamConsumer();
+        try {
+            cmd.createArg().setValue("-XshowSettings:properties -version");
+            CommandLineUtils.executeCommandLine(cmd, null, consumer);
+        } catch (Exception e2) {
+            e2.printStackTrace();
+        }
+
+        if (additionalJvmArgs == null) {
+            additionalJvmArgs = "";
+        }
+        if (consumer.isJava9Plus()) {
+            additionalJvmArgs = "--add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED "
+                                + "--add-exports=java.xml/com.sun.org.apache.xerces.internal.impl.xs=ALL-UNNAMED "
+                                + "--add-opens java.base/java.security=ALL-UNNAMED "
+                                + "--add-opens java.base/java.net=ALL-UNNAMED "
+                                + "--add-opens java.base/java.lang=ALL-UNNAMED "
+                                + "--add-opens java.base/java.util=ALL-UNNAMED "
+                                + "--add-opens java.base/java.util.concurrent=ALL-UNNAMED "
+                                + additionalJvmArgs;
+        }
+    }
+
+    /**
+     * Parse each line of the output for "java.version" and see if the version is >= 9
+     */
+    private static class Java9StreamConsumer implements StreamConsumer {
+        boolean java9;
+
+        public void consumeLine(String line) {
+            if (!java9 && line.contains("java.version")) {
+                String version = line.trim().substring("java.version = ".length());
+                if (version != null) {
+                    if (version.indexOf('.') > 0) {
+                        version = version.substring(0, version.indexOf('.'));
+                    }
+                    if (version.indexOf('-') > 0) {
+                        version = version.substring(0, version.indexOf('-'));
+                    }
+
+                    try {
+                        if (Integer.valueOf(version) >= 9) {
+                            java9 = true;
+                        }
+                    } catch (NumberFormatException ex) {
+                        // ignore
+                    }
+                }
+            }
+        }
+
+        public boolean isJava9Plus() {
+            return java9;
+        }
+    }
+
+    /**
      * Determine if code should be generated from the given wsdl
      *
      * @param wsdlOption