diff --git a/pom.xml b/pom.xml index d65026a0..426b348d 100644 --- a/pom.xml +++ b/pom.xml @@ -195,4 +195,4 @@ - \ No newline at end of file + diff --git a/src/main/java/org/javaswift/joss/command/impl/core/AbstractCommand.java b/src/main/java/org/javaswift/joss/command/impl/core/AbstractCommand.java index 439f321f..343c5752 100644 --- a/src/main/java/org/javaswift/joss/command/impl/core/AbstractCommand.java +++ b/src/main/java/org/javaswift/joss/command/impl/core/AbstractCommand.java @@ -57,7 +57,7 @@ public N call() { } catch (IOException err) { throw new CommandException("Unable to execute the HTTP call or to convert the HTTP Response", err); } finally { - if (closeStreamAutomatically()) { + if (closeStreamAutomatically() || response.getStatusLine().getStatusCode()>=400) { try { close(); } catch (IOException err) { /* ignore */ } } }