cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asold...@apache.org
Subject svn commit: r796995 - in /cxf/trunk/tools: javato/ws/src/main/java/org/apache/cxf/tools/java2js/JavaToJS.java wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJava.java
Date Thu, 23 Jul 2009 09:57:25 GMT
Author: asoldano
Date: Thu Jul 23 09:57:25 2009
New Revision: 796995

URL: http://svn.apache.org/viewvc?rev=796995&view=rev
Log:
[CXF-2351] Allow jaxws tools output to be redirected to a given stream

Modified:
    cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2js/JavaToJS.java
    cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJava.java

Modified: cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2js/JavaToJS.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2js/JavaToJS.java?rev=796995&r1=796994&r2=796995&view=diff
==============================================================================
--- cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2js/JavaToJS.java (original)
+++ cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2js/JavaToJS.java Thu
Jul 23 09:57:25 2009
@@ -67,16 +67,16 @@
             if (ex.getCause() instanceof BadUsageException) {
                 printUsageException(TOOL_NAME, (BadUsageException)ex.getCause());
             }
-            System.err.println();
-            System.err.println("JavaToJS Error : " + ex.getMessage());
+            err.println();
+            err.println("JavaToJS Error : " + ex.getMessage());
             if (isVerboseOn()) {
-                ex.printStackTrace();
+                ex.printStackTrace(err);
             }
         } catch (Exception ex) {
-            System.err.println();
-            System.err.println("JavaToJS Error : " + ex.getMessage());
+            err.println();
+            err.println("JavaToJS Error : " + ex.getMessage());
             if (isVerboseOn()) {
-                ex.printStackTrace();
+                ex.printStackTrace(err);
             }
         } finally {
             tearDown();

Modified: cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJava.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJava.java?rev=796995&r1=796994&r2=796995&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJava.java
(original)
+++ cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJava.java
Thu Jul 23 09:57:25 2009
@@ -20,6 +20,8 @@
 package org.apache.cxf.tools.wsdlto;
 
 import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.PrintStream;
 import java.util.Arrays;
 import java.util.List;
 
@@ -41,6 +43,7 @@
     public static final String DEFAULT_DATABINDING_NAME = "jaxb";
 
     private String[] args;
+    private PrintStream out = System.out;
 
     private PluginLoader pluginLoader = PluginLoader.getInstance();
 
@@ -56,7 +59,7 @@
             name = DEFAULT_FRONTEND_NAME;
         }
         if (isVerbose()) {
-            System.out.println("Loading FrontEnd " + name + " ...");
+            out.println("Loading FrontEnd " + name + " ...");
         }
         return pluginLoader.getFrontEndProfile(name);
     }
@@ -66,7 +69,7 @@
             name = DEFAULT_DATABINDING_NAME;
         }
         if (isVerbose()) {
-            System.out.println("Loading DataBinding " + name + " ...");
+            out.println("Loading DataBinding " + name + " ...");
         }
         return pluginLoader.getDataBindingProfile(name);
     }
@@ -78,8 +81,15 @@
         }
         return "YES".equalsIgnoreCase(exit) || "TRUE".equalsIgnoreCase(exit);
     }
-
+    
     public void run(ToolContext context) throws Exception {
+        run(context, null);
+    }
+
+    public void run(ToolContext context, OutputStream os) throws Exception {
+        if (os != null) {
+            this.out = (os instanceof PrintStream) ? (PrintStream)os : new PrintStream(os);
+        }
         FrontEndProfile frontend = null;
         if (args != null) {
             context.put(ToolConstants.CFG_CMD_ARG, args);
@@ -105,7 +115,8 @@
                            false,
                            args,
                            isExitOnFinish(),
-                           context);
+                           context,
+                           os);
     }
 
     protected boolean isVerbose() {



Mime
View raw message