Question: Someone can explain me what is the following 2nd parameter tries to explain. I have look around stackoverflow. I haven't got satisfactory explanation. It would be appriciated if anyone can help me to understand. Thanks in advance. My following code is not working.

```
private void showDatePickerDialog() {
    DatePickerDialog datepickerdialog = null;
    datepickerdialog = new DatePickerDialog(this,datepickerdialog.OnDateSetListener(MainActivity.this),day,month,year);
    datepickerdialog.show();
}

```

Answer: 
I solved this by first doing the readEntity to a String entity and then using the Jackson ObjectMapper to actually deserialize to the target class.

Problematic code:

```
Transactions transObj = response.readEntity(Transactions.class);

```

Solution:

```
String stringEntity = response.readEntity(String.class);
Transactions transObj  = objectMapper.readValue(stringEntity, Transactions.class);

```

It seems this problem arises when the JSON string in the response entity stream is very long or complex possibly requiring multiple interactions thereon. 'Deserializing' to a string seems to only require a single bite. Once you have the string (and Jackson or GSON) de-serialization to target entity takes place without touching the response.
When you get your error 500 you probably get another exception in the console/log. You should start checking that and then trying to resolve this one. If you don't find anything in the log, could you please post more code?