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.
Actually it is a issue with how are we defining the reference of Response object .
Solution is weird

Not Working one :

```
Response response;
if (condition) {
    response = 
} else {
    response = 
}
String resp = response.readEntity(String.class);
    if (response.getStatus() == 200) {}

```

Working One 

```
Response response = null;
if (condition) {
    response = 
} else {
    response = 
}
String resp = response.readEntity(String.class);
if (response.getStatus() == 200) {}

```

So basically if we wont assign anything to response initially , Stream will be closed