Browse Source

Externalize error message in ReftableWriter#throwIllegalEntry

Also use MessageFormat as done elsewhere.

Change-Id: I36a4df9002310fa28321de9d325ee213f3cbd433
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
tags/v5.5.0.201908280940-m3
Matthias Sohn 4 years ago
parent
commit
53160ee12b

+ 1
- 0
org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties View File

refAlreadyExists1=Ref {0} already exists refAlreadyExists1=Ref {0} already exists
reflogEntryNotFound=Entry {0} not found in reflog for ''{1}'' reflogEntryNotFound=Entry {0} not found in reflog for ''{1}''
refNotResolved=Ref {0} cannot be resolved refNotResolved=Ref {0} cannot be resolved
refTableRecordsMustIncrease=records must be increasing: last {0}, this {1}
refUpdateReturnCodeWas=RefUpdate return code was: {0} refUpdateReturnCodeWas=RefUpdate return code was: {0}
remoteConfigHasNoURIAssociated=Remote config "{0}" has no URIs associated remoteConfigHasNoURIAssociated=Remote config "{0}" has no URIs associated
remoteDoesNotHaveSpec=Remote does not have {0} available for fetch. remoteDoesNotHaveSpec=Remote does not have {0} available for fetch.

+ 1
- 0
org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java View File

/***/ public String refAlreadyExists1; /***/ public String refAlreadyExists1;
/***/ public String reflogEntryNotFound; /***/ public String reflogEntryNotFound;
/***/ public String refNotResolved; /***/ public String refNotResolved;
/***/ public String refTableRecordsMustIncrease;
/***/ public String refUpdateReturnCodeWas; /***/ public String refUpdateReturnCodeWas;
/***/ public String remoteConfigHasNoURIAssociated; /***/ public String remoteConfigHasNoURIAssociated;
/***/ public String remoteDoesNotHaveSpec; /***/ public String remoteDoesNotHaveSpec;

+ 4
- 2
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableWriter.java View File



import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.text.MessageFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.zip.CRC32; import java.util.zip.CRC32;


import org.eclipse.jgit.annotations.Nullable; import org.eclipse.jgit.annotations.Nullable;
import org.eclipse.jgit.internal.JGitText;
import org.eclipse.jgit.internal.storage.reftable.BlockWriter.DeleteLogEntry; import org.eclipse.jgit.internal.storage.reftable.BlockWriter.DeleteLogEntry;
import org.eclipse.jgit.internal.storage.reftable.BlockWriter.Entry; import org.eclipse.jgit.internal.storage.reftable.BlockWriter.Entry;
import org.eclipse.jgit.internal.storage.reftable.BlockWriter.IndexEntry; import org.eclipse.jgit.internal.storage.reftable.BlockWriter.IndexEntry;
} }


private void throwIllegalEntry(Entry last, Entry now) { private void throwIllegalEntry(Entry last, Entry now) {
throw new IllegalArgumentException(
String.format("records must be increasing: last %s, this %s",
throw new IllegalArgumentException(MessageFormat.format(
JGitText.get().refTableRecordsMustIncrease,
new String(last.key, UTF_8), new String(now.key, UTF_8))); new String(last.key, UTF_8), new String(now.key, UTF_8)));
} }



Loading…
Cancel
Save