ffang closed pull request #402: [CXF-6324]ensure cxf-codegen-plugin can handle 
multiple wsdl with different classifier
URL: https://github.com/apache/cxf/pull/402
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java
 
b/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java
index 7a4f797456c..88f6019455f 100644
--- 
a/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java
+++ 
b/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java
@@ -894,22 +894,34 @@ private Artifact resolveArbitraryWsdl(Artifact artifact) {
     }
 
     private Artifact findWsdlArtifact(Artifact targetArtifact, 
Collection<Artifact> artifactSet) {
+        boolean artifactMatched = false;
         if (artifactSet != null && !artifactSet.isEmpty()) {
             for (Artifact pArtifact : artifactSet) {
-                if (targetArtifact.getGroupId().equals(pArtifact.getGroupId())
-                        && 
targetArtifact.getArtifactId().equals(pArtifact.getArtifactId())
-                        && 
targetArtifact.getVersion().equals(pArtifact.getVersion()) 
-                        && ("wsdl".equals(pArtifact.getType()) 
-                        || (
-                                targetArtifact.getClassifier() != null
-                                        && pArtifact.getType() != null
-                                        && (targetArtifact.getClassifier() + 
".wsdl").equals(pArtifact.getType())
-                        ))) {
+                artifactMatched = isArtifactMatched(targetArtifact, pArtifact);
+                if (targetArtifact.getClassifier() != null && 
pArtifact.getClassifier() != null 
+                        && 
targetArtifact.getClassifier().equals(pArtifact.getClassifier()) 
+                        && artifactMatched) {
+                       //handle multile classifiers
+                    return pArtifact;
+                } else if (artifactMatched && targetArtifact.getClassifier() 
== null) {
                     return pArtifact;
                 }
             }
         }
         return null;
     }
+    
+    private boolean isArtifactMatched(Artifact targetArtifact, Artifact 
pArtifact) {
+        return targetArtifact.getGroupId().equals(pArtifact.getGroupId())
+                && 
targetArtifact.getArtifactId().equals(pArtifact.getArtifactId())
+                && targetArtifact.getVersion().equals(pArtifact.getVersion())
+                && ("wsdl".equals(pArtifact.getType()) 
+                || (
+                        targetArtifact.getClassifier() != null
+                                && pArtifact.getType() != null
+                                && (targetArtifact.getClassifier() + 
".wsdl").equals(pArtifact.getType())
+                ));
+    }
 
 }
+


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to