Source:
<code><START> public GeoServerResponse doRequest(String request) { <END> GeoServerResponse result = null; URL url = null; try { url = new URL(this.fullURL + request); } catch (MalformedURLException e) { log.error("GeoServerResponse.doRequest() MalformedURLException : unable to create URL from request [" + request +"]. Exception: [" + e.getMessage() +"]"); return result; } InputStream responseStream = null; try { HttpURLConnection connection = (HttpURLConnection)url.openConnection(); responseStream = connection.getInputStream(); int status = connection.getResponseCode(); result = new GeoServerResponse(url, status); if(status == 200) { result.setResponseHeaders(connection.getHeaderFields()); result.setContentEncoding(connection.getContentEncoding()); result.setContentType(connection.getContentType()); result.setContentLength(connection.getContentLength()); String uuid = UUID.randomUUID().toString().replaceAll("-", ""); Path tempFile = Paths.get(System.getProperty("java.io.tmpdir"), uuid); long pureLength = Files.copy(responseStream, tempFile, java.nio.file.StandardCopyOption.REPLACE_EXISTING); result.setContentsRead(pureLength); result.setFilename(tempFile.toString()); } else { log.error("GeoServerResponse.doRequest() HTTP Result Code != 200 : [" + status + "] for request [" + request + "]"); } } catch (Exception e) { log.error("GeoServerResponse.doRequest() Exception : " + e.getMessage()); } finally { try { if(responseStream != null) { responseStream.close(); } } catch (IOException e) { log.warn("GeoServerResponse.doRequest() Closing response inputstream exception : " + e.getMessage()); } } return result; }</code><technical_language>I this signature needs include 'throws Exception'. Callers forced deal w/ error, especially Actions assume errors. logging, below, is OK, error thrown</technical_language>

Target:
public GeoServerResponse doRequest(String request) throws Exception { GeoServerResponse result = null; URL url = null; try { url = new URL(this.fullURL + request); } catch (MalformedURLException e) { String msg = "GeoServerResponse.doRequest() MalformedURLException : unable to create URL from request [" + request +"]. Exception: [" + e.getMessage() +"]"; log.error(msg); throw new Exception(msg); } InputStream responseStream = null; try { HttpURLConnection connection = (HttpURLConnection)url.openConnection(); responseStream = connection.getInputStream(); int status = connection.getResponseCode(); result = new GeoServerResponse(url, status); if(status == 200) { result.setResponseHeaders(connection.getHeaderFields()); result.setContentEncoding(connection.getContentEncoding()); result.setContentType(connection.getContentType()); result.setContentLength(connection.getContentLength()); String uuid = UUID.randomUUID().toString().replaceAll("-", ""); Path tempFile = Paths.get(System.getProperty("java.io.tmpdir"), uuid); long pureLength = Files.copy(responseStream, tempFile, java.nio.file.StandardCopyOption.REPLACE_EXISTING); result.setContentsRead(pureLength); result.setFilename(tempFile.toString()); } else { String msg = "GeoServerResponse.doRequest() HTTP Result Code != 200 : [" + status + "] for request [" + request + "]"; log.error(msg); throw new Exception(msg); } } catch (Exception e) { String msg = "GeoServerResponse.doRequest() Exception : " + e.getMessage(); log.error(msg); throw new Exception(msg); } finally { try { if(responseStream != null) { responseStream.close(); } } catch (IOException e) { log.warn("GeoServerResponse.doRequest() Closing response inputstream exception : " + e.getMessage()); } } return result; }