From 04c342ec6a6657e5ede7382e4a6ecd6999f6789f Mon Sep 17 00:00:00 2001 From: zzz <zzz@mail.i2p> Date: Mon, 9 Dec 2013 16:38:00 +0000 Subject: [PATCH] PrivateKeyFile: Fix ISE (ticket #1145) broken in 0.9.9 --- core/java/src/net/i2p/data/PrivateKeyFile.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/core/java/src/net/i2p/data/PrivateKeyFile.java b/core/java/src/net/i2p/data/PrivateKeyFile.java index 2808f9a699..4e15b07d13 100644 --- a/core/java/src/net/i2p/data/PrivateKeyFile.java +++ b/core/java/src/net/i2p/data/PrivateKeyFile.java @@ -192,13 +192,21 @@ public class PrivateKeyFile { this.dest = d; } - /** change cert type - caller must also call write() */ + /** + * Change cert type - caller must also call write(). + * Side effect - creates new Destination object. + */ public Certificate setCertType(int t) { if (this.dest == null) throw new IllegalArgumentException("Dest is null"); Certificate c = new Certificate(); c.setCertificateType(t); - this.dest.setCertificate(c); + // dests now immutable, must create new + Destination newdest = new Destination(); + newdest.setPublicKey(dest.getPublicKey()); + newdest.setSigningPublicKey(dest.getSigningPublicKey()); + newdest.setCertificate(c); + dest = newdest; return c; } -- GitLab