Преглед на файлове

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
tags/v4.2.0.201601211800-r
Shawn Pearce преди 8 години
родител
ревизия
09500165a8
променени са 1 файла, в които са добавени 13 реда и са изтрити 6 реда
  1. 13
    6
      org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandInputStream.java

+ 13
- 6
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 {

Loading…
Отказ
Запис