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: 
According to [javaDoc](https://jersey.java.net/apidocs/2.7/jersey/javax/ws/rs/core/Response.html#readEntity(java.lang.Class)), a call to readEntity closes the response entity, so when you make another readEntity call you get IllegalStateException.

> 
> Unless the supplied entity type is an input stream, this method
> automatically closes the an unconsumed original response entity data
> stream if open.
> 
> 
> 

In my case, having the expression `response.readEntity(String.class)`
in the Expressions pane in the Debug perspective caused this exception when I ran the code in Debug mode. The evaluation of the expression consumed the entity and caused it to close.
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?