diff src/org/tmatesoft/hg/repo/HgRuntimeException.java @ 485:cdd53e5884ae

Do not add anything to exception message in case no details are known
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 09 Aug 2012 15:45:18 +0200
parents 31a89587eb04
children
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/repo/HgRuntimeException.java	Wed Aug 08 14:41:44 2012 +0200
+++ b/src/org/tmatesoft/hg/repo/HgRuntimeException.java	Thu Aug 09 15:45:18 2012 +0200
@@ -90,11 +90,12 @@
 
 	@Override
 	public String toString() {
-		StringBuilder sb = new StringBuilder(super.toString());
-		sb.append(' ');
-		sb.append('(');
+		String base = super.toString();
+		StringBuilder sb = new StringBuilder();
 		details.appendDetails(sb);
-		sb.append(')');
-		return sb.toString();
+		if (sb.length() == 0) {
+			return base;
+		}
+		return new StringBuilder(base).append(' ').append('(').append(sb).append(')').toString();
 	}
 }