This is an automated email from the ASF dual-hosted git repository.

tbouron pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git


The following commit(s) were added to refs/heads/master by this push:
     new ee9970b  JcloudsLocation: don’t expose cloud identity in toString()
     new 2427be0  Merge pull request #1066 from 
alasdairhodge/remove-identity-from-location-tostring
ee9970b is described below

commit ee9970b02b9bf9692b8a8f80ba55e812263998a3
Author: Alasdair Hodge <git...@alasdairhodge.co.uk>
AuthorDate: Wed Oct 2 22:31:02 2019 +0100

    JcloudsLocation: don’t expose cloud identity in toString()
---
 .../brooklyn/location/jclouds/JcloudsLocation.java      | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git 
a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
 
b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
index 8d9a889..7cf9f0d 100644
--- 
a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
+++ 
b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
@@ -312,12 +312,21 @@ public class JcloudsLocation extends 
AbstractCloudMachineProvisioningLocation im
 
     @Override
     public String toString() {
-        Object identity = getIdentity();
+        String className = getClass().getSimpleName();
         String configDescription = config().getLocalBag().getDescription();
-        if (configDescription!=null && 
configDescription.startsWith(getClass().getSimpleName()))
+        String displayName = getDisplayName();
+
+        if (configDescription != null && 
configDescription.startsWith(className))
             return configDescription;
-        return getClass().getSimpleName()+"["+getDisplayName()+":"+(identity 
!= null ? identity : null)+
-                (configDescription!=null ? "/"+configDescription : "") + "@" + 
getId() + "]";
+
+        if (displayName != null)
+            return className + "['" + displayName + "']";
+
+        return className + "[" +
+                getIdentity() +
+                (configDescription == null ? "" : "/" + configDescription) +
+                "@" + getId() +
+                "]";
     }
 
     @Override

Reply via email to