From c9b8f4c2e99a9ce773a73d47e188663cae937fc9 Mon Sep 17 00:00:00 2001 From: ferncam1 Date: Tue, 28 Apr 2009 16:48:36 +0000 Subject: [PATCH] content type should only be set if content exists git-svn-id: http://jclouds.googlecode.com/svn/trunk@54 3d8758e0-26b5-11de-8745-db77d3ebf521 --- .../jclouds/http/JavaUrlHttpFutureCommandClient.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/org/jclouds/http/JavaUrlHttpFutureCommandClient.java b/core/src/main/java/org/jclouds/http/JavaUrlHttpFutureCommandClient.java index 3574852304..e17177ddda 100644 --- a/core/src/main/java/org/jclouds/http/JavaUrlHttpFutureCommandClient.java +++ b/core/src/main/java/org/jclouds/http/JavaUrlHttpFutureCommandClient.java @@ -76,8 +76,9 @@ public class JavaUrlHttpFutureCommandClient implements HttpFutureCommandClient { for (HttpRequestFilter filter : getRequestFilters()) { filter.filter(request); } - logger.trace("%1s - submitting request %2s", target, request); + logger.trace("%1s - converting request %2s", target, request); connection = openJavaConnection(request); + logger.trace("%1s - submitting request %2s", target, connection); HttpResponse response = getResponse(connection); logger.trace("%1s - received response %2s", target, response); @@ -100,7 +101,8 @@ public class JavaUrlHttpFutureCommandClient implements HttpFutureCommandClient { } operation.setException(e); } finally { - // DO NOT disconnect, as it will also close the unconsumed outputStream from above. + // DO NOT disconnect, as it will also close the unconsumed + // outputStream from above. // connection.disconnect(); } } @@ -135,9 +137,9 @@ public class JavaUrlHttpFutureCommandClient implements HttpFutureCommandClient { for (String value : request.getHeaders().get(header)) connection.setRequestProperty(header, value); } - connection.setRequestProperty(HttpConstants.CONTENT_TYPE, request - .getContentType()); if (request.getContent() != null) { + connection.setRequestProperty(HttpConstants.CONTENT_TYPE, request + .getContentType()); OutputStream out = connection.getOutputStream(); try { if (request.getContent() instanceof String) {