Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am getting the following error by running the below code using j2bugzilla a

Code:
  GetLegalValues get = new GetLegalValues(Fields.COMPONENT);
       try {
        connect.executeMethod(get);
    } catch (BugzillaException e) {
        System.out.println("Failed to retrieve the fieldValue:"+e);
        }
       Set<String> values = get.getLegalValues();

       for(String value : values) {
           System.out.println("The value for given field:"+value);
       }

exception:

"main" java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
    at org.apache.xmlrpc.parser.XmlRpcResponseParser.addResult(XmlRpcResponseParser.java:61)
    at org.apache.xmlrpc.parser.RecursiveTypeParserImpl.endValueTag(RecursiveTypeParserImpl.java:78)
    at org.apache.xmlrpc.parser.XmlRpcResponseParser.endElement(XmlRpcResponseParser.java:186)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:606)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1741)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2898)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:607)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:116)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:488)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:835)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:123)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1210)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:568)
    at org.apache.xmlrpc.client.XmlRpcStreamTransport.readResponse(XmlRpcStreamTransport.java:186)
    at org.apache.xmlrpc.client.XmlRpcStreamTransport.sendRequest(XmlRpcStreamTransport.java:156)
    at org.apache.xmlrpc.client.XmlRpcHttpTransport.sendRequest(XmlRpcHttpTransport.java:143)
    at org.apache.xmlrpc.client.XmlRpcSunHttpTransport.sendRequest(XmlRpcSunHttpTransport.java:69)
    at org.apache.xmlrpc.client.XmlRpcClientWorker.execute(XmlRpcClientWorker.java:56)
    at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:167)
    at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:137)
    at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:126)
    at com.j2bugzilla.base.BugzillaConnector.executeMethod(BugzillaConnector.java:149)
    at Logging.LogginDefects1.fieldValue(LogginDefects1.java:235)
    at Logging.LoggingDefects.main(LoggingDefects.java:33)

source at LogginDefects1.java:235,this is the function to retrieve the field value form bugzilla public void fieldValue() {

   GetLegalValues get = new GetLegalValues(Fields.COMPONENT);
  try {

    connect.executeMethod(get);
} catch (BugzillaException e) {
    System.out.println("Failed to retrieve the fieldValue:"+e);
    }
   Set<String> values = get.getLegalValues();

   for(String value : values) {
       System.out.println("The value for given field:"+value);
   }

}

share|improve this question
1  
Please show the complete exception, rather than just the message. –  Jon Skeet Feb 24 at 11:11
    
I added full exception details please check it and help me out –  Anant patil Feb 24 at 11:26
    
At this point it looks like it's a Bugzilla API bug. I would try to have a look at what the request/response look like. It's possible that it's an error response which isn't being parsed properly, in which case you might be able to work around it by fixing the request to avoid it creating an error. –  Jon Skeet Feb 24 at 11:30
    
If you have any idea about this,please share it. –  Anant patil Feb 24 at 11:35
    
Well I've already given you an idea - look at what request/response is being sent/received (e.g. with Wireshark or Fiddler). –  Jon Skeet Feb 24 at 11:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.