SOAP API: What causes this strange SAXException when invoking getWorkItemByURI() or getWorkItemById() in Java?

Description
ALMighty
Posts: 75
Joined: Wed Apr 27, 2016 10:34 am
Location: Austria

SOAP API: What causes this strange SAXException when invoking getWorkItemByURI() or getWorkItemById() in Java?

Postby ALMighty » Tue Mar 27, 2018 12:54 pm

Greetings altogether,

I encountered a very strange SAXException today when playing around in Java with the SOAP API of Polarion.

Here in short what my test programme does in which the exception was thrown:
1.) Querying a bunch of work items and going through them in for loop.
2.) Getting the linked work items and backlinked work items of each item
3.) Each linked item, since it is of datatype LinkedWorkItem (btw is that why for god sake?) is
then fetched again through getWorkItemByUri() in order to get it as an WorkItem object. Then input parameter for that is fetched through getWorkItemURI() on the LinkedWorkItem.
4.) The application cycles through a lot of items and prints them but suddenly I get this exception and yas you scroll through that log, you can see that getWorkItemByUri is the root cause of this:

Code: Select all

[ERROR] Call - Exception: <org.xml.sax.SAXException: For input string: "28d 2h"
java.lang.NumberFormatException: For input string: "28d 2h">org.xml.sax.SAXException: For input string: "28d 2h"
java.lang.NumberFormatException: For input string: "28d 2h"
   at org.apache.axis.encoding.ser.SimpleDeserializer.onEndElement(SimpleDeserializer.java:180)
   at org.apache.axis.encoding.DeserializerImpl.endElement(DeserializerImpl.java:502)
   at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
   at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:171)
   at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)
   at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236)
   at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
   at org.apache.axis.client.Call.invoke(Call.java:2467)
   at org.apache.axis.client.Call.invoke(Call.java:2366)
   at org.apache.axis.client.Call.invoke(Call.java:1812)
   at com.polarion.alm.ws.client.tracker.TrackerWebServiceSoapBindingStub.getWorkItemByUri(TrackerWebServiceSoapBindingStub.java:9627)
   at ourSite.conobjects.OurClassHoldingTheTrackerWebService.getWorkItemByUri(OurClassHoldingTheTrackerWebService.java:199)
   at Main.Main.main(Main.java:89)
Caused by: java.lang.NumberFormatException: For input string: "28d 2h"
   at java.lang.NumberFormatException.forInputString(Unknown Source)
   at java.lang.Integer.parseInt(Unknown Source)
   at java.lang.Integer.<init>(Unknown Source)
   at org.apache.axis.encoding.ser.SimpleDeserializer.makeBasicValue(SimpleDeserializer.java:305)
   at org.apache.axis.encoding.ser.SimpleDeserializer.makeValue(SimpleDeserializer.java:209)
   at org.apache.axis.encoding.ser.SimpleDeserializer.onEndElement(SimpleDeserializer.java:172)
   ... 12 more


The exception can be caught with try-catch however. Furthermore the same exception is thrown if I invoke getWorkItemById() with the work item ID I extracted through String operations from the URI.

Any clues what the cuase of this exception could be? :?
---------------------------------------------------------------------------------------------------
Playing a good game is never lame. :D
Image

ALMighty
Posts: 75
Joined: Wed Apr 27, 2016 10:34 am
Location: Austria

Re: SOAP API: What causes this strange SAXException when invoking getWorkItemByURI() or getWorkItemById() in Java?

Postby ALMighty » Tue Mar 27, 2018 1:19 pm

A short update: The exception could be avoided by using the method getWorkItemByIdsWithFields() instead of using getWorkItemByUri or getWorkItemById.

In return, this means that there is somewhere a value in that work item which the API cannot process
It seems I have to do some testing in order to find out which field it is. :(
---------------------------------------------------------------------------------------------------
Playing a good game is never lame. :D
Image


Return to “Polarion Application Lifecycle Management (ALM)”

Who is online

Users browsing this forum: Google [Bot] and 2 guests