Skip to content

Commit

Permalink
fix error handling so HttpUpload.prepare() will actually throw except…
Browse files Browse the repository at this point in the history
…ions
  • Loading branch information
pdowler committed Oct 31, 2023
1 parent 392d199 commit b35c9bc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 22 deletions.
2 changes: 1 addition & 1 deletion cadc-util/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ sourceCompatibility = 1.8

group = 'org.opencadc'

version = '1.10.0'
version = '1.10.1'

description = 'OpenCADC core utility library'
def git_url = 'https://github.com/opencadc/core'
Expand Down
24 changes: 3 additions & 21 deletions cadc-util/src/main/java/ca/nrc/cadc/net/HttpUpload.java
Original file line number Diff line number Diff line change
Expand Up @@ -260,21 +260,14 @@ protected void doAction()

doPut(conn);
this.responseStream = conn.getInputStream();
} catch (InterruptedException iex) {
// need to catch this or it looks like a failure instead of a cancel
this.go = false;
} catch (TransientException tex) {
log.debug("caught: " + tex);
throwTE = true;
throw tex;
} catch (Throwable t) {
failure = t;
log.debug("completed");
fireEvent(TransferEvent.COMPLETED);
} finally {
if (istream != null) {
log.debug("closing InputStream");
try {
istream.close();
} catch (Exception ignore) {
} catch (IOException ignore) {
// do nothing
}
}
Expand All @@ -290,17 +283,6 @@ protected void doAction()
this.thread = null;
}
}

if (!go) {
log.debug("cancelled");
fireEvent(TransferEvent.CANCELLED);
} else if (failure != null) {
log.debug("failed: " + failure);
fireEvent(failure);
} else if (!throwTE) {
log.debug("completed");
fireEvent(TransferEvent.COMPLETED);
}
}
}

Expand Down

0 comments on commit b35c9bc

Please sign in to comment.