cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

Unable To Convert From java.lang.String to LONG

PalakSoni1907
5-Regular Member

Unable To Convert From java.lang.String to LONG

Hi all,

 

While running the script through automation run  

I'm receiving the error Unable To Convert From java.lang.String to LONG when i'm using the webservice to get Equipment Network from PTC.SCA.SCO.ContextUtils Thing ( in SCO and Manf APP project )  

after that getting text from infotable 

putting getEquipmentNetwork response below 

InfoTable responseInfoTable = InfoTableUtil.fromJSON(response.as(JSONObject.class));
ValueCollection query = new ValueCollection();
query.SetStringValue(jsonKey1, value1);
ValueCollection collection = responseInfoTable.find(query);
if (collection == null) {
query = new ValueCollection();
query.SetLongValue(jsonKey1, value1);
collection = responseInfoTable.find(query);
if (collection == null) {
throw new RuntimeException("Provide Valid key1=" + jsonKey1);
}
}
return collection.getStringValue(jsonKey2);

 

Failing at line Bold line through automation run collection value going null and throwing the error. 

If we normally run the automation same code working fine. 

 

0 REPLIES 0
Top Tags