Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #27480

Unable to Overload toString for Object

Newsgroups comp.lang.java.programmer
Date 2014-02-10 22:59 -0800
Message-ID <705891c8-b170-44c0-866f-48eec7b38c4d@googlegroups.com> (permalink)
Subject Unable to Overload toString for Object
From Ojesh Dugar <ojesh.u@gmail.com>

Show all headers | View raw


Code:

package XMLRPC;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;

import org.apache.commons.httpclient.HttpClient;
import org.apache.xmlrpc.XmlRpcException;
import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
import org.apache.xmlrpc.client.XmlRpcCommonsTransportFactory;

public class Search {
	
 
	   @Override
	public String toString() {
		   //System.err.println ("Ojesh");
		   return String.format("oje"+"abx");
	}

	public static void main(String args[])
	      throws MalformedURLException, XmlRpcException {

		   
		   HttpClient httpClient = new HttpClient();
	        XmlRpcClient rpcClient = new XmlRpcClient();
	        XmlRpcCommonsTransportFactory factory = new XmlRpcCommonsTransportFactory(rpcClient);
	        XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();

	      factory.setHttpClient(httpClient);
	        rpcClient.setTransportFactory(factory);
	        config.setServerURL(new URL("http://abc2/bugzilla/xmlrpc.cgi"));
	        rpcClient.setConfig(config);

	        //map of the login data
	        Map loginMap = new HashMap();
	        loginMap.put("login", "abc@bag");
	        loginMap.put("password", "***");
	        loginMap.put("rememberlogin", "Bugzilla_remember");

	       
	        
	       
	        // login to bugzilla
	        Object loginResult = rpcClient.execute("User.login", new Object[]{loginMap});
	        System.err.println ("loginResult=" + loginResult);

	        // map of the bug data ok
	        Map bugMap = new HashMap();

	        bugMap.put("id", "350");
	        
	        //bugMap.put("status", "NEW");

	        // create bug
	        Object createResult = rpcClient.execute("Bug.search", new Object[]{bugMap});
	        //createResult.toString();
	       
	        System.err.println("createResult =" + createResult.toString());
	        
	       
	     }
	   
	   
	 }



Its not returnig OJEABX as expected. Instead bugs=[Ljava.lang.Object;@2ee5e48a being diplayed.
Where am i going wrong.??

Back to comp.lang.java.programmer | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Unable to Overload toString for Object Ojesh Dugar <ojesh.u@gmail.com> - 2014-02-10 22:59 -0800
  Re: Unable to Overload toString for Object leif.roar@invalid.com (Leif Roar Moldskred) - 2014-02-11 02:40 -0600
    Re: Unable to Overload toString for Object Ojesh Dugar <ojesh.u@gmail.com> - 2014-02-11 01:03 -0800
      Re: Unable to Overload toString for Object Lew <lewbloch@gmail.com> - 2014-02-11 15:49 -0800
        Re: Unable to Overload toString for Object Ojesh Dugar <ojesh.u@gmail.com> - 2014-02-12 00:38 -0800
          Re: Unable to Overload toString for Object markspace <markspace@nospam.nospam> - 2014-02-12 10:37 -0800
            Re: Unable to Overload toString for Object Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-02-12 13:57 -0500
              Re: Unable to Overload toString for Object Ojesh Dugar <ojesh.u@gmail.com> - 2014-02-12 20:24 -0800
                Re: Unable to Overload toString for Object Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-02-13 08:29 -0500
            Re: Unable to Overload toString for Object Ojesh Dugar <ojesh.u@gmail.com> - 2014-02-12 20:58 -0800
              Re: Unable to Overload toString for Object markspace <markspace@nospam.nospam> - 2014-02-12 21:29 -0800
                Re: Unable to Overload toString for Object Ojesh Dugar <ojesh.u@gmail.com> - 2014-02-13 00:59 -0800
  Re: Unable to Overload toString for Object Ojesh Dugar <ojesh.u@gmail.com> - 2014-02-11 01:06 -0800
    Re: Unable to Overload toString for Object Ojesh Dugar <ojesh.u@gmail.com> - 2014-02-11 01:27 -0800

csiph-web