Return-Path: Delivered-To: apmail-xml-axis-dev-archive@xml.apache.org Received: (qmail 87892 invoked by uid 500); 17 Oct 2001 21:04:48 -0000 Mailing-List: contact axis-dev-help@xml.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-dev@xml.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list axis-dev@xml.apache.org Received: (qmail 87878 invoked by uid 500); 17 Oct 2001 21:04:48 -0000 Delivered-To: apmail-xml-axis-cvs@apache.org Date: 17 Oct 2001 20:58:41 -0000 Message-ID: <20011017205841.28960.qmail@icarus.apache.org> From: gdaniels@apache.org To: xml-axis-cvs@apache.org Subject: cvs commit: xml-axis/java/src/org/apache/axis/client AdminClient.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N gdaniels 01/10/17 13:58:41 Modified: java/src/org/apache/axis/client AdminClient.java Log: Replace mistakenly removed error check, throw exception. Revision Changes Path 1.37 +23 -18 xml-axis/java/src/org/apache/axis/client/AdminClient.java Index: AdminClient.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/AdminClient.java,v retrieving revision 1.36 retrieving revision 1.37 diff -u -r1.36 -r1.37 --- AdminClient.java 2001/10/17 20:20:24 1.36 +++ AdminClient.java 2001/10/17 20:58:41 1.37 @@ -89,14 +89,14 @@ public class AdminClient { protected PrintWriter _log; - + /** * Construct an admin client w/o a logger */ public AdminClient() { } - + /** * Construct an admin client with a logger */ @@ -104,7 +104,7 @@ { _log = log; } - + /** * Construct an admin client with a logger */ @@ -112,7 +112,7 @@ { _log = new PrintWriter(out); } - + /** * Logs a message if a logger has been provided */ @@ -124,7 +124,7 @@ _log.flush(); } } - + /** *

Processes a set of administration commands.

*

The following commands are available:

@@ -150,7 +150,7 @@ *

If -l or -h -p -s are not set, the * AdminClient will invoke * http://localhost:8080/axis/servlet/AxisServlet.

- * + * * @param args Commands to process * @return XML result or null in case of failure. In the case of multiple * commands, the XML results will be concatenated, separated by \n @@ -159,24 +159,24 @@ public String process (String[] args) throws Exception { StringBuffer sb = new StringBuffer(); - + Options opts = new Options( args ); - + if (opts.isFlagSet('d') > 0) { // Set log4j properties... !!! } - + args = opts.getRemainingArgs(); - + if ( args == null ) { log( "Usage: AdminClient xml-files | list" ); return null; } - + for ( int i = 0 ; i < args.length ; i++ ) { InputStream input = null; - + if ( args[i].equals("list") ) { log( "Doing a list" ); String str = "" ; @@ -201,7 +201,7 @@ log( "Processing file: " + args[i] ); input = new FileInputStream( args[i] ); } - + Service service = new Service(); Call call = (org.apache.axis.client.Call) service.createCall(); @@ -209,23 +209,28 @@ call.setProperty( HTTPConstants.MC_HTTP_SOAPACTION, "AdminService"); call.setProperty( Transport.USER, opts.getUser() ); call.setProperty( Transport.PASSWORD, opts.getPassword() ); - + String tName = opts.isValueSet( 't' ); if ( tName != null && !tName.equals("") ) call.setProperty( Call.TRANSPORT_NAME, tName ); - + Vector result = null ; Object[] params = new Object[] { new SOAPBodyElement(input) }; result = (Vector) call.invoke( params ); - + input.close(); + + if (result == null || result.isEmpty()) { + throw new AxisFault("Null response message!"); + } + SOAPBodyElement body = (SOAPBodyElement) result.elementAt(0); sb.append( body.toString() ); } - + return sb.toString(); } - + /** * Creates in instance of AdminClient and * invokes process(args).