Repository: jclouds-karaf
Updated Branches:
  refs/heads/master 3f1ed2fd5 -> 89fbcbc65


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/89fbcbc6
Tree: http://git-wip-us.apache.org/repos/asf/jclouds-karaf/tree/89fbcbc6
Diff: http://git-wip-us.apache.org/repos/asf/jclouds-karaf/diff/89fbcbc6

Branch: refs/heads/master
Commit: 89fbcbc65edf8c276559eff92df08d6791e02cd7
Parents: 3f1ed2f
Author: Timur Alperovich <[email protected]>
Authored: Wed Jun 25 13:04:16 2014 -0700
Committer: Andrew Gaul <[email protected]>
Committed: Wed Jun 25 19:06:29 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/89fbcbc6/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 4cb201d..d97204f 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
@@ -44,8 +44,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();
@@ -67,7 +65,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/89fbcbc6/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 a64f2e3..74ab083 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
@@ -43,8 +43,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();
@@ -56,7 +54,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());
@@ -70,14 +68,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/89fbcbc6/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 229711a..1b1fd63 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
@@ -41,8 +41,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();
@@ -66,7 +64,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());
@@ -79,12 +77,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