PushCertificate: Omit null pushee from text representation

Change-Id: Ie9546f2e0e9ee62e0a3c919572153b6076355195
This commit is contained in:
Dave Borowitz 2015-07-28 10:53:07 -07:00
parent ffa3d4bdb4
commit 94812ef1e9
2 changed files with 6 additions and 3 deletions

View File

@ -360,6 +360,7 @@ public void testMissingPusheeField() throws Exception {
PushCertificate cert = parser.build();
assertEquals("0.1", cert.getVersion());
assertNull(cert.getPushee());
assertFalse(cert.toText().contains(PushCertificateParser.PUSHEE));
}
private static String concatPacketLines(String input, int begin, int end)

View File

@ -219,9 +219,11 @@ private StringBuilder toStringBuilder() {
StringBuilder sb = new StringBuilder()
.append(VERSION).append(' ').append(version).append('\n')
.append(PUSHER).append(' ').append(getPusher())
.append('\n')
.append(PUSHEE).append(' ').append(pushee).append('\n')
.append(NONCE).append(' ').append(nonce).append('\n')
.append('\n');
if (pushee != null) {
sb.append(PUSHEE).append(' ').append(pushee).append('\n');
}
sb.append(NONCE).append(' ').append(nonce).append('\n')
.append('\n');
for (ReceiveCommand cmd : commands) {
sb.append(cmd.getOldId().name())