Github user denalex commented on a diff in the pull request: https://github.com/apache/incubator-hawq/pull/1334#discussion_r166099856 --- Diff: pxf/pxf-service/src/main/java/org/apache/hawq/pxf/service/rest/WritableResource.java --- @@ -143,36 +142,38 @@ private static synchronized Response synchronizedWriteResponse(Bridge bridge, private static Response writeResponse(Bridge bridge, String path, - InputStream inputStream) throws Exception { - - String returnMsg; - + InputStream inputStream) + throws Exception { // Open the output file bridge.beginIteration(); - long totalWritten = 0; + Exception ex = null; // dataStream will close automatically in the end of the try. // inputStream is closed by dataStream.close(). try (DataInputStream dataStream = new DataInputStream(inputStream)) { while (bridge.setNext(dataStream)) { ++totalWritten; } - } catch (ClientAbortException e) { - LOG.debug("Remote connection closed by HAWQ", e); - } catch (Exception ex) { - LOG.debug("totalWritten so far " + totalWritten + " to " + path); - throw ex; + } catch (ClientAbortException cae) { + LOG.error("Remote connection closed by HAWQ", cae); + } catch (Exception e) { + LOG.error("Exception: totalWritten so far " + totalWritten + " to " + path, e); + ex = e; } finally { try { bridge.endIteration(); } catch (Exception e) { - // ignore ... any significant errors should already have been handled + if (ex == null) + ex = e; } + // propagate any exceptions + if (ex != null) + throw ex; } String censuredPath = Utilities.maskNonPrintables(path); - returnMsg = "wrote " + totalWritten + " bulks to " + censuredPath; + String returnMsg = "wrote " + totalWritten + " bulks to " + censuredPath; --- End diff -- move string concat inside LOG.isDebugEnabled()
---