Source:
<code>protected T readResponse(HttpWebRequest response) throws Exception { T serviceResponse; if (!response.getResponseContentType().startsWith("text/xml")) { String line = new BufferedReader(new InputStreamReader(ServiceRequestBase.getResponseStream(response))) .readLine(); throw new ServiceRequestException(Strings.ServiceResponseDoesNotContainXml); } try { this.getService().processHttpResponseHeaders( TraceFlags.EwsResponseHttpHeaders, response); if (this.getService().isTraceEnabledFor(TraceFlags.EwsResponse)) { ByteArrayOutputStream memoryStream = new ByteArrayOutputStream(); InputStream serviceResponseStream = ServiceRequestBase .getResponseStream(response); while (true) { <START> int data = serviceResponseStream.read(); <END> if (-1 == data) { break; } else { memoryStream.write(data); } } this.traceResponse(response, memoryStream); ByteArrayInputStream memoryStreamIn = new ByteArrayInputStream( memoryStream.toByteArray()); EwsServiceXmlReader ewsXmlReader = new EwsServiceXmlReader( memoryStreamIn, this.getService()); serviceResponse = this.readResponse(ewsXmlReader); serviceResponseStream.close(); memoryStream.flush(); } else { InputStream responseStream = ServiceRequestBase .getResponseStream(response); EwsServiceXmlReader ewsXmlReader = new EwsServiceXmlReader( responseStream, this.getService()); serviceResponse = this.readResponse(ewsXmlReader); } return serviceResponse; } catch (HTTPException e) { if (e.getMessage() != null) { this.getService().processHttpResponseHeaders( TraceFlags.EwsResponseHttpHeaders, response); } throw new ServiceRequestException(String.format( Strings.ServiceRequestFailed, e.getMessage()), e); } catch (IOException e) { throw new ServiceRequestException(String.format( Strings.ServiceRequestFailed, e.getMessage()), e); } finally { if (response != null) { response.close(); } } }</code><technical_language>This squashed in while-loop avoid "white(true)" stuff....</technical_language>

Target:
protected T readResponse(HttpWebRequest response) throws Exception { T serviceResponse; if (!response.getResponseContentType().startsWith("text/xml")) { String line = new BufferedReader(new InputStreamReader(ServiceRequestBase.getResponseStream(response))) .readLine(); throw new ServiceRequestException(Strings.ServiceResponseDoesNotContainXml); } try { this.getService().processHttpResponseHeaders( TraceFlags.EwsResponseHttpHeaders, response); if (this.getService().isTraceEnabledFor(TraceFlags.EwsResponse)) { ByteArrayOutputStream memoryStream = new ByteArrayOutputStream(); InputStream serviceResponseStream = ServiceRequestBase .getResponseStream(response); int data = serviceResponseStream.read(); while (data != -1) { memoryStream.write(data); data = serviceResponseStream.read(); } this.traceResponse(response, memoryStream); ByteArrayInputStream memoryStreamIn = new ByteArrayInputStream( memoryStream.toByteArray()); EwsServiceXmlReader ewsXmlReader = new EwsServiceXmlReader( memoryStreamIn, this.getService()); serviceResponse = this.readResponse(ewsXmlReader); serviceResponseStream.close(); memoryStream.flush(); } else { InputStream responseStream = ServiceRequestBase .getResponseStream(response); EwsServiceXmlReader ewsXmlReader = new EwsServiceXmlReader( responseStream, this.getService()); serviceResponse = this.readResponse(ewsXmlReader); } return serviceResponse; } catch (HTTPException e) { if (e.getMessage() != null) { this.getService().processHttpResponseHeaders( TraceFlags.EwsResponseHttpHeaders, response); } throw new ServiceRequestException(String.format( Strings.ServiceRequestFailed, e.getMessage()), e); } catch (IOException e) { throw new ServiceRequestException(String.format( Strings.ServiceRequestFailed, e.getMessage()), e); } finally { if (response != null) { response.close(); } } }