Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 20C059F82 for ; Tue, 8 May 2012 19:35:25 +0000 (UTC) Received: (qmail 36107 invoked by uid 500); 8 May 2012 19:35:24 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 36060 invoked by uid 500); 8 May 2012 19:35:24 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 36053 invoked by uid 99); 8 May 2012 19:35:24 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 May 2012 19:35:24 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 May 2012 19:35:21 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id B4EF723888EA; Tue, 8 May 2012 19:35:00 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1335712 - in /cxf/branches/2.5.x-fixes: ./ maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/WSDL2JavaMojo.java Date: Tue, 08 May 2012 19:35:00 -0000 To: commits@cxf.apache.org From: dkulp@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120508193500.B4EF723888EA@eris.apache.org> Author: dkulp Date: Tue May 8 19:35:00 2012 New Revision: 1335712 URL: http://svn.apache.org/viewvc?rev=1335712&view=rev Log: Merged revisions 1335709 via svnmerge from https://svn.apache.org/repos/asf/cxf/trunk ........ r1335709 | dkulp | 2012-05-08 15:34:00 -0400 (Tue, 08 May 2012) | 1 line Add an NPE guard ........ Modified: cxf/branches/2.5.x-fixes/ (props changed) cxf/branches/2.5.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/WSDL2JavaMojo.java Propchange: cxf/branches/2.5.x-fixes/ ------------------------------------------------------------------------------ svn:mergeinfo = /cxf/trunk:1335709 Propchange: cxf/branches/2.5.x-fixes/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: cxf/branches/2.5.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/WSDL2JavaMojo.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/WSDL2JavaMojo.java?rev=1335712&r1=1335711&r2=1335712&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/WSDL2JavaMojo.java (original) +++ cxf/branches/2.5.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/WSDL2JavaMojo.java Tue May 8 19:35:00 2012 @@ -58,7 +58,7 @@ public class WSDL2JavaMojo extends Abstr * @required */ File sourceRoot; - + /** * Options that specify WSDLs to process and/or control the processing of wsdls. * If you have enabled wsdl scanning, these elements attach options to particular wsdls. @@ -66,21 +66,21 @@ public class WSDL2JavaMojo extends Abstr * @parameter */ WsdlOption wsdlOptions[]; - + /** * Default options to be used when a wsdl has not had it's options explicitly specified. * * @parameter */ Option defaultOptions = new Option(); - + /** * Encoding to use for generated sources * * @parameter default-value="${project.build.sourceEncoding}" */ String encoding; - + /** * Merge WsdlOptions that point to the same file by adding the extraargs to the first option and deleting * the second from the options list @@ -90,8 +90,8 @@ public class WSDL2JavaMojo extends Abstr protected void mergeOptions(List effectiveWsdlOptions) { File outputDirFile = getGeneratedTestRoot() == null - ? getGeneratedSourceRoot() : getGeneratedTestRoot(); - + ? getGeneratedSourceRoot() : getGeneratedTestRoot(); + List newList = new ArrayList(); for (GenericWsdlOption go : effectiveWsdlOptions) { @@ -129,7 +129,7 @@ public class WSDL2JavaMojo extends Abstr effectiveWsdlOptions.clear(); effectiveWsdlOptions.addAll(newList); } - + /** * Determine if code should be generated from the given wsdl * @@ -170,9 +170,9 @@ public class WSDL2JavaMojo extends Abstr } return doWork; } - + protected List generateCommandLine(GenericWsdlOption wsdlOption) - throws MojoExecutionException { + throws MojoExecutionException { List ret = super.generateCommandLine(wsdlOption); if (encoding != null) { ret.add(0, "-encoding"); @@ -183,8 +183,8 @@ public class WSDL2JavaMojo extends Abstr @Override protected Bus generate(GenericWsdlOption genericWsdlOption, - Bus bus, - Set classPath) throws MojoExecutionException { + Bus bus, + Set classPath) throws MojoExecutionException { WsdlOption wsdlOption = (WsdlOption) genericWsdlOption; File outputDirFile = wsdlOption.getOutputDir(); outputDirFile.mkdirs(); @@ -199,11 +199,13 @@ public class WSDL2JavaMojo extends Abstr List list = wsdlOption.generateCommandLine(outputDirFile, basedir, wsdlURI, getLog().isDebugEnabled()); - list.add(0, "-encoding"); - list.add(1, encoding); + if (encoding != null) { + list.add(0, "-encoding"); + list.add(1, encoding); + } String[] args = list.toArray(new String[list.size()]); getLog().debug("Calling wsdl2java with args: " + Arrays.toString(args)); - + if (!"false".equals(fork)) { Set artifactsPath = new LinkedHashSet(); for (Artifact a : pluginArtifacts) { @@ -217,7 +219,7 @@ public class WSDL2JavaMojo extends Abstr } addPluginArtifact(artifactsPath); artifactsPath.addAll(classPath); - + runForked(artifactsPath, WSDLToJava.class.getName(), args); } else { @@ -230,9 +232,9 @@ public class WSDL2JavaMojo extends Abstr } catch (Throwable e) { getLog().debug(e); throw new MojoExecutionException(e.getMessage(), e); - } + } } - + try { doneFile.createNewFile(); @@ -249,21 +251,21 @@ public class WSDL2JavaMojo extends Abstr } return bus; } - + /** * @return effective WsdlOptions * @throws MojoExecutionException */ protected List createWsdlOptionsFromScansAndExplicitWsdlOptions() - throws MojoExecutionException { + throws MojoExecutionException { List effectiveWsdlOptions = new ArrayList(); - + if (wsdlOptions != null) { for (WsdlOption wo : wsdlOptions) { effectiveWsdlOptions.add(wo); } } - + List temp; if (wsdlRoot != null && wsdlRoot.exists() && !disableDirectoryScan) { temp = WsdlOptionLoader.loadWsdlOptionsFromFiles(wsdlRoot, includes, excludes,