You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2008/09/11 22:51:54 UTC

svn commit: r694472 - in /cxf/branches/2.1.x-fixes: ./ maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java

Author: dkulp
Date: Thu Sep 11 13:51:54 2008
New Revision: 694472

URL: http://svn.apache.org/viewvc?rev=694472&view=rev
Log:
Merged revisions 694417 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r694417 | dkulp | 2008-09-11 14:50:36 -0400 (Thu, 11 Sep 2008) | 2 lines
  
  [CXF-1794] Fix problem with wsdlOptions not being applied correctly
........

Modified:
    cxf/branches/2.1.x-fixes/   (props changed)
    cxf/branches/2.1.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java

Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Sep 11 13:51:54 2008
@@ -1 +1 @@
-/cxf/trunk:686333-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891,687910,687914,688086,688102,688133,688596,688735,688870,689572,689596,689855,689924,690067,690289,691246,691271,691295,691355,691488,691602,691646,691706,691728,692116,692157,692310,692466,692499,693653,693819,694179,694263
+/cxf/trunk:686333-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891,687910,687914,688086,688102,688133,688596,688735,688870,689572,689596,689855,689924,690067,690289,691246,691271,691295,691355,691488,691602,691646,691706,691728,692116,692157,692310,692466,692499,693653,693819,694179,694263,694417

Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.1.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java?rev=694472&r1=694471&r2=694472&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java (original)
+++ cxf/branches/2.1.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java Thu Sep 11 13:51:54 2008
@@ -132,6 +132,47 @@
         return options;
     }
     
+    private void mergeOptions(List<WsdlOption> options) {
+        File outputDirFile = testSourceRoot == null ? sourceRoot : testSourceRoot;
+        for (WsdlOption o : wsdlOptions) {
+            if (o.getOutputDir() == null) {
+                o.setOutputDir(outputDirFile);
+            }
+            
+            File file = new File(o.getWsdl());
+            if (!file.exists()) {
+                file = new File(project.getBasedir(), o.getWsdl());
+            }
+            if (file.exists()) {
+                file = file.getAbsoluteFile();
+                for (WsdlOption o2 : options) {
+                    File file2 = null;
+                    try {
+                        URI uri = new URI(o2.getWsdl());
+                        if (uri.isAbsolute()) {
+                            file2 = new File(uri);
+                        }
+                    } catch (Exception e) {
+                        //ignore
+                    }
+                    if (file2 == null || !file2.exists()) {
+                        file2 = new File(o2.getWsdl());
+                    }
+                    if (file2 == null || !file2.exists()) {
+                        file2 = new File(project.getBasedir(), o2.getWsdl());
+                    }
+                    if (file2.exists() 
+                        && file2.getAbsoluteFile().equals(file)) {
+                        o.getExtraargs().addAll(0, o2.getExtraargs());
+                        options.remove(o2);
+                        break;
+                    }
+                }
+            }
+            options.add(0, o);
+        }        
+    }
+    
     public void execute() throws MojoExecutionException {
         if (includes == null) {
             includes = new String[] {"*.wsdl"};
@@ -150,26 +191,7 @@
         }
 
         if (wsdlOptions != null) {
-            File outputDirFile = testSourceRoot == null ? sourceRoot : testSourceRoot;
-            for (WsdlOption o : wsdlOptions) {
-                if (o.getOutputDir() == null) {
-                    o.setOutputDir(outputDirFile);
-                }
-                
-                File file = new File(project.getBasedir(), o.getWsdl());                
-                if (file.exists()) {
-                    for (WsdlOption o2 : options) {
-                        File file2 = new File(o2.getWsdl());
-                        if (file2.exists() 
-                            && file2.equals(file)) {
-                            o.getExtraargs().addAll(0, o2.getExtraargs());
-                            options.remove(o2);
-                            break;
-                        }
-                    }
-                }
-                options.add(o);
-            }
+            mergeOptions(options);
         }
         wsdlOptions = options.toArray(new WsdlOption[options.size()]);