[jbossws-commits] JBossWS SVN: r3549 - branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/tools/jaxws/impl.
jbossws-commits at lists.jboss.org
jbossws-commits at lists.jboss.org
Tue Jun 12 08:18:39 EDT 2007
Author: thomas.diesler at jboss.com
Date: 2007-06-12 08:18:39 -0400 (Tue, 12 Jun 2007)
New Revision: 3549
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/tools/jaxws/impl/SunRIConsumerImpl.java
Log:
Fix NPE on Exception
Modified: branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/tools/jaxws/impl/SunRIConsumerImpl.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/tools/jaxws/impl/SunRIConsumerImpl.java 2007-06-12 11:06:45 UTC (rev 3548)
+++ branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/tools/jaxws/impl/SunRIConsumerImpl.java 2007-06-12 12:18:39 UTC (rev 3549)
@@ -1,24 +1,24 @@
/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.jboss.ws.tools.jaxws.impl;
import com.sun.tools.ws.wscompile.WsimportTool;
@@ -39,81 +39,94 @@
*/
public class SunRIConsumerImpl extends WSContractConsumer
{
- private List<File> bindingFiles = null;
- private File catalog = null;
- private boolean generateSource = false;
+ private List<File> bindingFiles;
+ private File catalog;
+ private boolean generateSource;
private File outputDir = new File("output");
- private File sourceDir = null;
- private String targetPackage = null;
- private PrintStream messageStream = null;
- private String wsdlLocation = null;
- private List<String> additionalCompilerClassPath = null;
+ private File sourceDir;
+ private String targetPackage;
+ private PrintStream messageStream;
+ private String wsdlLocation;
+ private List<String> additionalCompilerClassPath;
@Override
- public void setBindingFiles(List<File> bindingFiles) {
+ public void setBindingFiles(List<File> bindingFiles)
+ {
this.bindingFiles = bindingFiles;
}
@Override
- public void setCatalog(File catalog) {
+ public void setCatalog(File catalog)
+ {
this.catalog = catalog;
}
@Override
- public void setGenerateSource(boolean generateSource) {
+ public void setGenerateSource(boolean generateSource)
+ {
this.generateSource = generateSource;
}
@Override
- public void setMessageStream(PrintStream messageStream) {
- // TODO Auto-generated method stub
+ public void setMessageStream(PrintStream messageStream)
+ {
this.messageStream = messageStream;
}
@Override
- public void setOutputDirectory(File directory) {
- // TODO Auto-generated method stub
+ public void setOutputDirectory(File directory)
+ {
outputDir = directory;
}
@Override
- public void setSourceDirectory(File directory) {
+ public void setSourceDirectory(File directory)
+ {
sourceDir = directory;
}
@Override
- public void setTargetPackage(String targetPackage) {
+ public void setTargetPackage(String targetPackage)
+ {
this.targetPackage = targetPackage;
}
@Override
- public void setWsdlLocation(String wsdlLocation) {
+ public void setWsdlLocation(String wsdlLocation)
+ {
this.wsdlLocation = wsdlLocation;
}
- public void setAdditionalCompilerClassPath(List<String> additionalCompilerClassPath) {
+ public void setAdditionalCompilerClassPath(List<String> additionalCompilerClassPath)
+ {
this.additionalCompilerClassPath = additionalCompilerClassPath;
}
@Override
- public void consume(URL wsdl) {
+ public void consume(URL wsdl)
+ {
List<String> args = new ArrayList<String>();
- if (bindingFiles != null) {
- for (File file : bindingFiles) {
+ if (bindingFiles != null)
+ {
+ for (File file : bindingFiles)
+ {
args.add("-b");
args.add(file.getAbsolutePath());
}
}
- if (catalog != null) {
+ if (catalog != null)
+ {
args.add("-catalog");
args.add(catalog.getAbsolutePath());
}
- if (generateSource) {
+ if (generateSource)
+ {
args.add("-keep");
- if (sourceDir != null) {
+ if (sourceDir != null)
+ {
if (!sourceDir.exists() && !sourceDir.mkdirs())
throw new IllegalStateException("Could not make directory: " + sourceDir.getName());
@@ -122,20 +135,25 @@
}
}
- if (targetPackage != null) {
+ if (targetPackage != null)
+ {
args.add("-p");
args.add(targetPackage);
}
- if (wsdlLocation != null) {
+ if (wsdlLocation != null)
+ {
args.add("-wsdllocation");
args.add(wsdlLocation);
}
PrintStream stream = messageStream;
- if (stream != null) {
+ if (stream != null)
+ {
args.add("-verbose");
- } else {
+ }
+ else
+ {
stream = new NullPrintStream();
}
@@ -150,20 +168,26 @@
try
{
// enforce woodstox
- if(null == System.getProperty("javax.xml.stream.XMLInputFactory"))
+ if (null == System.getProperty("javax.xml.stream.XMLInputFactory"))
System.setProperty("javax.xml.stream.XMLInputFactory", "com.ctc.wstx.stax.WstxInputFactory");
-
+
WsimportTool compileTool = new WsimportTool(stream);
boolean success = compileTool.run(args.toArray(new String[0]));
- if(!success) throw new IllegalStateException("WsImport invocation failed");
+ if (!success)
+ throw new IllegalStateException("WsImport invocation failed");
}
catch (Throwable t)
{
- messageStream.println("Failed to invoke WsImport");
- t.printStackTrace(messageStream);
+ if (messageStream != null)
+ {
+ messageStream.println("Failed to invoke WsImport");
+ t.printStackTrace(messageStream);
+ }
+ else
+ {
+ t.printStackTrace();
+ }
}
-
}
}
-
More information about the jbossws-commits
mailing list