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: 
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
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?