From 3d7561e3b6b032da1127ce65cf835e4c240c8b18 Mon Sep 17 00:00:00 2001 From: benoit charret Date: Sun, 6 Dec 2015 20:51:47 +0100 Subject: [PATCH 1/2] Release connection of the pool on 4xx error --- pom.xml | 2 +- .../org/javaswift/joss/command/impl/core/AbstractCommand.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index d65026a0..da81f5da 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ org.javaswift joss - 0.9.8 + 0.9.8-patch-SNAPSHOT jar Java OpenStack Storage Java Client library for OpenStack Storage (Swift) 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 */ } } } From a96b15a2be50320f5d52f1e59996f087d7d9461c Mon Sep 17 00:00:00 2001 From: benoit charret Date: Sun, 6 Dec 2015 20:51:47 +0100 Subject: [PATCH 2/2] Release connection of the pool on 4xx error --- .../org/javaswift/joss/command/impl/core/AbstractCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 */ } } }