openstack-nova: fixing NPE in toString()

This commit is contained in:
Adam Lowe 2012-05-09 16:21:26 +01:00
parent 404dc93140
commit 2c82ab2832
1 changed files with 3 additions and 5 deletions

View File

@ -133,9 +133,10 @@ public class CreateServerOptions implements MapBinder {
} }
protected ToStringHelper string() { protected ToStringHelper string() {
return toStringHelper("").add("keyName", "keyName").add("securityGroupNames", securityGroupNames) return toStringHelper("").add("keyName", keyName).add("securityGroupNames", securityGroupNames)
.add("metadata", metadata).add("personality", personality) .add("metadata", metadata).add("personality", personality)
.add("adminPassPresent", adminPass != null).add("userData", new String(userData)); .add("adminPassPresent", adminPass != null)
.add("userData", userData == null ? null : new String(userData));
} }
@Override @Override
@ -258,9 +259,6 @@ public class CreateServerOptions implements MapBinder {
/** /**
* A keypair name can be defined when creating a server. This key will be * A keypair name can be defined when creating a server. This key will be
* linked to the server and used to SSH connect to the machine * linked to the server and used to SSH connect to the machine
*
* @param keyName
* @return
*/ */
public String getKeyPairName() { public String getKeyPairName() {
return keyName; return keyName;