Repository: jclouds-karaf
Updated Branches:
  refs/heads/1.7.x 5ba935515 -> 48ce75e93


Do not cache System.out in commands.

If the System.out object is cached, callers that have invoked
System.setOut will observe that the new stream is not used and the
original file descriptor continues to be used by jclouds-karaf
commands.


Project: http://git-wip-us.apache.org/repos/asf/jclouds-karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds-karaf/commit/48ce75e9
Tree: http://git-wip-us.apache.org/repos/asf/jclouds-karaf/tree/48ce75e9
Diff: http://git-wip-us.apache.org/repos/asf/jclouds-karaf/diff/48ce75e9

Branch: refs/heads/1.7.x
Commit: 48ce75e9318d42c600a24307bee882eb2a10c2dc
Parents: 5ba9355
Author: Timur Alperovich <[email protected]>
Authored: Wed Jun 25 13:04:16 2014 -0700
Committer: Andrew Gaul <[email protected]>
Committed: Wed Jun 25 19:08:56 2014 -0700

----------------------------------------------------------------------
 .../jclouds/karaf/commands/blobstore/BlobListCommand.java    | 4 +---
 .../karaf/commands/blobstore/BlobMetadataCommand.java        | 8 +++-----
 .../karaf/commands/blobstore/ContainerMetadataCommand.java   | 8 +++-----
 3 files changed, 7 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds-karaf/blob/48ce75e9/commands/src/main/java/org/jclouds/karaf/commands/blobstore/BlobListCommand.java
----------------------------------------------------------------------
diff --git 
a/commands/src/main/java/org/jclouds/karaf/commands/blobstore/BlobListCommand.java
 
b/commands/src/main/java/org/jclouds/karaf/commands/blobstore/BlobListCommand.java
index 421dd56..87719d9 100644
--- 
a/commands/src/main/java/org/jclouds/karaf/commands/blobstore/BlobListCommand.java
+++ 
b/commands/src/main/java/org/jclouds/karaf/commands/blobstore/BlobListCommand.java
@@ -46,8 +46,6 @@ public class BlobListCommand extends 
BlobStoreCommandWithOptions {
    @Argument(index = 1, name = "directoryPath", description = "List blobs only 
in this directory path", required = false)
    String directoryPath;
 
-   private static final PrintStream out = System.out;
-
    @Override
    protected Object doExecute() throws Exception {
       BlobStore blobStore = getBlobStore();
@@ -69,7 +67,7 @@ public class BlobListCommand extends 
BlobStoreCommandWithOptions {
 
          Collections.sort(blobNames);
          for (String blobName : blobNames) {
-            out.println(blobName);
+            System.out.println(blobName);
          }
 
          String marker = blobStoreMetadatas.getNextMarker();

http://git-wip-us.apache.org/repos/asf/jclouds-karaf/blob/48ce75e9/commands/src/main/java/org/jclouds/karaf/commands/blobstore/BlobMetadataCommand.java
----------------------------------------------------------------------
diff --git 
a/commands/src/main/java/org/jclouds/karaf/commands/blobstore/BlobMetadataCommand.java
 
b/commands/src/main/java/org/jclouds/karaf/commands/blobstore/BlobMetadataCommand.java
index 0549e6b..09312ce 100644
--- 
a/commands/src/main/java/org/jclouds/karaf/commands/blobstore/BlobMetadataCommand.java
+++ 
b/commands/src/main/java/org/jclouds/karaf/commands/blobstore/BlobMetadataCommand.java
@@ -45,8 +45,6 @@ public class BlobMetadataCommand extends 
BlobStoreCommandWithOptions {
    @Argument(index = 1, name = "blobNames", description = "The name of the 
blobs", required = true, multiValued = true)
    List<String> blobNames = Lists.newArrayList();
 
-   private static final PrintStream out = System.out;
-
    @Override
    protected Object doExecute() throws Exception {
       BlobStore blobStore = getBlobStore();
@@ -58,7 +56,7 @@ public class BlobMetadataCommand extends 
BlobStoreCommandWithOptions {
          }
 
          ContentMetadata contentMetdata = blobMetadata.getContentMetadata();
-         out.println(blobName + ":");
+         System.out.println(blobName + ":");
 
          printMetadata("Content-Disposition", 
contentMetdata.getContentDisposition());
          printMetadata("Content-Encoding", 
contentMetdata.getContentEncoding());
@@ -72,14 +70,14 @@ public class BlobMetadataCommand extends 
BlobStoreCommandWithOptions {
          printMetadata("Expires", contentMetdata.getExpires());
          printMetadata("Length", contentMetdata.getContentLength());
 
-         out.println("");
+         System.out.println("");
       }
       return null;
    }
 
    private static void printMetadata(String key, Object value) {
       if (value != null) {
-         out.println(String.format("    %s: %s", key, value));
+         System.out.println(String.format("    %s: %s", key, value));
       }
    }
 }

http://git-wip-us.apache.org/repos/asf/jclouds-karaf/blob/48ce75e9/commands/src/main/java/org/jclouds/karaf/commands/blobstore/ContainerMetadataCommand.java
----------------------------------------------------------------------
diff --git 
a/commands/src/main/java/org/jclouds/karaf/commands/blobstore/ContainerMetadataCommand.java
 
b/commands/src/main/java/org/jclouds/karaf/commands/blobstore/ContainerMetadataCommand.java
index 3a991a7..3635f93 100644
--- 
a/commands/src/main/java/org/jclouds/karaf/commands/blobstore/ContainerMetadataCommand.java
+++ 
b/commands/src/main/java/org/jclouds/karaf/commands/blobstore/ContainerMetadataCommand.java
@@ -43,8 +43,6 @@ public class ContainerMetadataCommand extends 
BlobStoreCommandWithOptions {
    @Argument(index = 0, name = "containerName", description = "The name of the 
container", required = true, multiValued = true)
    final Collection<String> containerNames = Lists.newArrayList();
 
-   private static final PrintStream out = System.out;
-
    @Override
    protected Object doExecute() throws Exception {
       BlobStore blobStore = getBlobStore();
@@ -68,7 +66,7 @@ public class ContainerMetadataCommand extends 
BlobStoreCommandWithOptions {
    }
 
    private static void printContainerMetadata(StorageMetadata 
containerMetadata) {
-      out.println(containerMetadata.getName());
+      System.out.println(containerMetadata.getName());
       printMetadata("ETag", containerMetadata.getETag());
       printMetadata("Creation-Date", containerMetadata.getCreationDate());
       printMetadata("Last-Modified", containerMetadata.getLastModified());
@@ -81,12 +79,12 @@ public class ContainerMetadataCommand extends 
BlobStoreCommandWithOptions {
       for (Map.Entry<String, String> entry : 
containerMetadata.getUserMetadata().entrySet()) {
          printMetadata(entry.getKey(), entry.getValue());
       }
-      out.println("");
+      System.out.println("");
    }
 
    private static void printMetadata(String key, Object value) {
       if (value != null) {
-         out.println(String.format("    %s: %s", key, value));
+         System.out.println(String.format("    %s: %s", key, value));
       }
    }
 }

Reply via email to