[JGIT PATCH 02/21] Do not show URIish passwords in TransportExceptions
- From
Shawn O. Pearce <spearce@spearce.org>
- Date
- Jun 29, 2008, 07:59 UTC
- Message-ID
- <1214726371-93520-3-git-send-email-spearce@spearce.org>
- In-Reply-To
- <1214726371-93520-2-git-send-email-spearce@spearce.org>
When construction a transport exception the message may be shown on screen. If a password was in the URIish then we may wind up showing the user's password, perhaps while there is someone else looking over the user's shoulder and reading their monitor. By setting the field to null we avoid displaying it.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org> --- .../spearce/jgit/errors/TransportException.java | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/org.spearce.jgit/src/org/spearce/jgit/errors/TransportException.java b/org.spearce.jgit/src/org/spearce/jgit/errors/TransportException.java index 4a8e37c..7fbbc5a 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/errors/TransportException.java +++ b/org.spearce.jgit/src/org/spearce/jgit/errors/TransportException.java @@ -58,7 +58,7 @@ public class TransportException extends IOException { * message */ public TransportException(final URIish uri, final String s) { - super(uri + ": " + s); + super(uri.setPass(null) + ": " + s); } /** @@ -74,7 +74,7 @@ public class TransportException extends IOException { */ public TransportException(final URIish uri, final String s, final Throwable cause) { - this(uri + ": " + s, cause); + this(uri.setPass(null) + ": " + s, cause); } /**
-- 1.5.6.74.g8a5e