Skip to content

Commit

Permalink
throw exception when authorization fails
Browse files Browse the repository at this point in the history
  • Loading branch information
wwelling committed Oct 11, 2019
1 parent 98b522d commit 07d7840
Showing 1 changed file with 3 additions and 0 deletions.
Expand Up @@ -259,6 +259,9 @@ protected String startTransaction() throws IOException {
for (String header : connection.getHeaderFields().keySet()) {
logger.debug("HTTP connection to open Fedora transaction got header \"" + header + "\" with value \"" + connection.getHeaderFields().get(header) + "\".");
}
if (connection.getResponseCode() == 401) {
throw new IOException("Authorization failed");
}
String transactionalUrl = connection.getHeaderField("Location");
String tid = transactionalUrl.substring(transactionalUrl.lastIndexOf("/") + 1);
transactionService.add(tid, Duration.ofMinutes(3));
Expand Down

0 comments on commit 07d7840

Please sign in to comment.