summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorShawn Pearce <sop@google.com>2015-12-31 16:12:51 -0800
committerShawn Pearce <sop@google.com>2015-12-31 17:37:16 -0800
commit09500165a8592386c92c1f10a36bfd4fc4666a11 (patch)
treea60ff2ccff19949e2218ccd4d0bcfaa54d5c154c /org.eclipse.jgit
parentc426a964ed41001731288d4fb8c26bdda2cfe169 (diff)
downloadjgit-09500165a8592386c92c1f10a36bfd4fc4666a11.tar.gz
jgit-09500165a8592386c92c1f10a36bfd4fc4666a11.zip
Fix "remote: Counting objects: ..." formatting
Trailing whitespace is usually removed in properties files so JGitText did not supply a space between : and the remote message. Ensure the space exists at runtime by reading the localized string and appending a space if it is missing. Messages should be dynamically fetched and not held in a static class variable, as they can be changed using thread locals. Change-Id: If6a3707d64094253b1a5304fbfafcf195db7497a
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandInputStream.java19
1 files changed, 13 insertions, 6 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandInputStream.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandInputStream.java
index cf388e2718..fe9f2a3155 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandInputStream.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandInputStream.java
@@ -78,12 +78,8 @@ import org.eclipse.jgit.util.RawParseUtils;
* @see SideBandOutputStream
*/
class SideBandInputStream extends InputStream {
- private static final String PFX_REMOTE = JGitText.get().prefixRemote;
-
static final int CH_DATA = 1;
-
static final int CH_PROGRESS = 2;
-
static final int CH_ERROR = 3;
private static Pattern P_UNBOUNDED = Pattern
@@ -174,7 +170,7 @@ class SideBandInputStream extends InputStream {
continue;
case CH_ERROR:
eof = true;
- throw new TransportException(PFX_REMOTE + readString(available));
+ throw new TransportException(remote(readString(available)));
default:
throw new PackProtocolException(
MessageFormat.format(JGitText.get().invalidChannel,
@@ -241,7 +237,18 @@ class SideBandInputStream extends InputStream {
}
private void beginTask(final int totalWorkUnits) {
- monitor.beginTask(PFX_REMOTE + currentTask, totalWorkUnits);
+ monitor.beginTask(remote(currentTask), totalWorkUnits);
+ }
+
+ private static String remote(String msg) {
+ String prefix = JGitText.get().prefixRemote;
+ StringBuilder r = new StringBuilder(prefix.length() + msg.length() + 1);
+ r.append(prefix);
+ if (prefix.length() > 0 && prefix.charAt(prefix.length() - 1) != ' ') {
+ r.append(' ');
+ }
+ r.append(msg);
+ return r.toString();
}
private String readString(final int len) throws IOException {