Rest 500 because of "java.io.EOFException: No content to map to Object due to end of input"
Asked by Artur:

Hello dear community,  
I am loosing some hair over this:

I have so far written several Rest Put requests in Katalon Studio for updating certain report pages in Confluence.  

3/4 cases work - the one which includes writting Issues / Exceptions et cetera fails.  
I noticed it may be because of "{" and "}" resulting in makros.  
Because of several reasons, I wanted to fix this by using a makro, the hope being that it would result in no errors, no matter what passes through.  

<br />

The current Json string is valid via e.g. <https://jsonformatter.curiousconcept.com/#>

In the Rest body value field I am writing markups / tables via HTML. In one of the table fields I am using a noformat markup (though I already tested multiple markups with no success).  
Now I can paste the HTML part (by hand) into the HTML Editor of a confluence page(\<\>) and it will work like a charm.

I have tried several methods to reduce issues:  
- replaceAll( problematicCharacters.. ) or   
- cap the String of each field to 100 chars  
- etc.  

Though it all seems fine, I still keep getting REST 500 / "java.io.EOFException: No content to map to Object due to end of input"  

It is surely no general server error since I can send different request resulting in 200.  

My Rest String right before passing it to HttpConnection is:  

{ "version": { "number": "169"}, "title":"_NOT_OK_", "type": "page", "body": {"storage":{"value": "\<p\>TEST RESULTS Mobile 'NOT OK' from DATE\</p\>\<table\>\<colgroup\>\<col /\>\<col /\>\<col /\>\<col /\>\<col /\>\<col /\>\</colgroup\>\<tbody\>\<tr\>\<th\>\<p\>OS\</p\>\</th\>\<th\>\<p\>Stage\</p\>\</th\>\<th\>\<p\>Testsuite\</p\>\</th\>\<th\>\<p\>Testcase\</p\>\</th\>\<th\>\<p\>Testresult\</p\>\</th\>\<th\>\<p\>Date\</p\>\</th\>\<th\>\<p\>Details\</p\>\</th\>\</tr\>\<tr\>\<td\>\<p\>ANDROID\</p\>\</td\>\<td\>\<p\>PRE\</p\>\</td\>\<td\>\<p\>XYApp\</p\>\</td\>\<td\>\<p\>XY\</p\>\</td\>\<td\>\<p\>FAIL\</p\>\</td\>\<td\>\<p\>2020-12-03 10:05:18\</p\>\</td\>\<td\>\<div class='content-wrapper'\> \<p class='auto-cursor-target'\>\<br/\>\</p\>\<ac:structured-macro ac:macro-id='33d138b1-6273-4af9-937f-e9fa3c9b91ad' ac:name='noformat' ac:schema-version='1'\>\<ac:parameter ac:name='nopanel'\>true\</ac:parameter\>\<ac:plain-text-body\>\<!\[CDATA\[ org.openqa.selenium.WebDriverException: \[ERROR MESSAGE\] Returned value cannot be converted to WebEle \]\]\>\</ac:plain-text-body\>\</ac:structured-macro\>\<p class='auto-cursor-target'\>\</p\>\</div\>\</td\>\</tr\>\<tr\>\<td\>\<p\>ANDROID\</p\>\</td\>\<td\>\<p\>PRE\</p\>\</td\>\<td\>\<p\>XY App\</p\>\</td\>\<td\>\<p\>TC_XY\</p\>\</td\>\<td\>\<p\>FAIL\</p\>\</td\>\<td\>\<p\>2020-12-03 09:55:04\</p\>\</td\>\<td\>\<div class='content-wrapper'\> \<p class='auto-cursor-target'\>\<br/\>\</p\>\<ac:structured-macro ac:macro-id='33d138b1-6273-4af9-937f-e9fa3c9b91ad' ac:name='noformat' ac:schema-version='1'\>\<ac:parameter ac:name='nopanel'\>true\</ac:parameter\>\<ac:plain-text-body\>\<!\[CDATA\[ org.openqa.selenium.WebDriverException: \[ERROR MESSAGE\] Returned value cannot be converted to WebEle \]\]\>\</ac:plain-text-body\>\</ac:structured-macro\>\<p class='auto-cursor-target'\>\</p\>\</div\>\</td\>\</tr\>\<tr\>\<td\>\<p\>ANDROID\</p\>\</td\>\<td\>\<p\>PRE\</p\>\</td\>\<td\>\<p\>XY App\</p\>\</td\>\<td\>\<p\>XY TESTCASE\</p\>\</td\>\<td\>\<p\>FAIL\</p\>\</td\>\<td\>\<p\>2020-12-03 09:53:00\</p\>\</td\>\<td\>\<div class='content-wrapper'\> \<p class='auto-cursor-target'\>\<br/\>\</p\>\<ac:structured-macro ac:macro-id='33d138b1-6273-4af9-937f-e9fa3c9b91ad' ac:name='noformat' ac:schema-version='1'\>\<ac:parameter ac:name='nopanel'\>true\</ac:parameter\>\<ac:plain-text-body\>\<!\[CDATA\[ org.openqa.selenium.WebDriverException: \[ERROR MESSAGE\] Returned value cannot be converted to WebEle \]\]\>\</ac:plain-text-body\>\</ac:structured-macro\>\<p class='auto-cursor-target'\>\</p\>\</div\>\</td\>\</tr\>\</tbody\>\</table\>", "representation": "storage" }}}  

Thanks in advance.  


Answers:
author: Artur
body: I guess I am a step further since my colleague successfully tested my REST String with a chrome REST expansion.  

In his opinion, it's the Java class **HttpURLConnection,** that seems to produce issues - even though I could send similar, but more simple PUT requests.  

He recommends using <http://javadox.com/org.codehaus.groovy.modules.http-builder/http-builder/0.6/groovyx/net/http/RESTClient.html>


Tags: confluence-server

exception

macro

rest

server