Externalize strings introduced in c9552aba

Change-Id: I81bb78344df61e6eb42622fcef6235d4da0ae052
This commit is contained in:
Matthias Sohn 2023-02-20 21:40:40 +01:00
parent 37dd45e8a9
commit 5d5a0d5376
4 changed files with 21 additions and 11 deletions

View File

@ -111,6 +111,7 @@ cannotPullOnARepoWithState=Cannot pull into a repository with state: {0}
cannotRead=Cannot read {0} cannotRead=Cannot read {0}
cannotReadBackDelta=Cannot read delta type {0} cannotReadBackDelta=Cannot read delta type {0}
cannotReadBlob=Cannot read blob {0} cannotReadBlob=Cannot read blob {0}
cannotReadByte=Cannot read byte from stream
cannotReadCommit=Cannot read commit {0} cannotReadCommit=Cannot read commit {0}
cannotReadFile=Cannot read file {0} cannotReadFile=Cannot read file {0}
cannotReadHEAD=cannot read HEAD: {0} {1} cannotReadHEAD=cannot read HEAD: {0} {1}
@ -538,6 +539,7 @@ nothingToPush=Nothing to push.
notMergedExceptionMessage=Branch was not deleted as it has not been merged yet; use the force option to delete it anyway notMergedExceptionMessage=Branch was not deleted as it has not been merged yet; use the force option to delete it anyway
notShallowedUnshallow=The server sent a unshallow for a commit that wasn''t marked as shallow: {0} notShallowedUnshallow=The server sent a unshallow for a commit that wasn''t marked as shallow: {0}
noXMLParserAvailable=No XML parser available. noXMLParserAvailable=No XML parser available.
numberDoesntFit=Number doesn't fit in a single byte
objectAtHasBadZlibStream=Object at {0} in {1} has bad zlib stream objectAtHasBadZlibStream=Object at {0} in {1} has bad zlib stream
objectIsCorrupt=Object {0} is corrupt: {1} objectIsCorrupt=Object {0} is corrupt: {1}
objectIsCorrupt3={0}: object {1}: {2} objectIsCorrupt3={0}: object {1}: {2}
@ -773,6 +775,7 @@ truncatedHunkOldLinesMissing=Truncated hunk, at least {0} old lines is missing
tSizeMustBeGreaterOrEqual1=tSize must be >= 1 tSizeMustBeGreaterOrEqual1=tSize must be >= 1
unableToCheckConnectivity=Unable to check connectivity. unableToCheckConnectivity=Unable to check connectivity.
unableToCreateNewObject=Unable to create new object: {0} unableToCreateNewObject=Unable to create new object: {0}
unableToReadFullInt=Unable to read a full int from the stream
unableToReadPackfile=Unable to read packfile {0} unableToReadPackfile=Unable to read packfile {0}
unableToRemovePath=Unable to remove path ''{0}'' unableToRemovePath=Unable to remove path ''{0}''
unableToWrite=Unable to write {0} unableToWrite=Unable to write {0}
@ -798,6 +801,7 @@ unknownObject=unknown object
unknownObjectInIndex=unknown object {0} found in index but not in pack file unknownObjectInIndex=unknown object {0} found in index but not in pack file
unknownObjectType=Unknown object type {0}. unknownObjectType=Unknown object type {0}.
unknownObjectType2=unknown unknownObjectType2=unknown
unknownPositionEncoding=Unknown position encoding %s
unknownRefStorageFormat=Unknown ref storage format "{0}" unknownRefStorageFormat=Unknown ref storage format "{0}"
unknownRepositoryFormat=Unknown repository format unknownRepositoryFormat=Unknown repository format
unknownRepositoryFormat2=Unknown repository format "{0}"; expected "0". unknownRepositoryFormat2=Unknown repository format "{0}"; expected "0".
@ -825,6 +829,7 @@ unsupportedPackIndexVersion=Unsupported pack index version {0}
unsupportedPackVersion=Unsupported pack version {0}. unsupportedPackVersion=Unsupported pack version {0}.
unsupportedReftableVersion=Unsupported reftable version {0}. unsupportedReftableVersion=Unsupported reftable version {0}.
unsupportedRepositoryDescription=Repository description not supported unsupportedRepositoryDescription=Repository description not supported
unsupportedSizesObjSizeIndex=Unsupported sizes in object-size-index
updateRequiresOldIdAndNewId=Update requires both old ID and new ID to be nonzero updateRequiresOldIdAndNewId=Update requires both old ID and new ID to be nonzero
updatingHeadFailed=Updating HEAD failed updatingHeadFailed=Updating HEAD failed
updatingReferences=Updating references updatingReferences=Updating references

View File

@ -139,6 +139,7 @@ public static JGitText get() {
/***/ public String cannotRead; /***/ public String cannotRead;
/***/ public String cannotReadBackDelta; /***/ public String cannotReadBackDelta;
/***/ public String cannotReadBlob; /***/ public String cannotReadBlob;
/***/ public String cannotReadByte;
/***/ public String cannotReadCommit; /***/ public String cannotReadCommit;
/***/ public String cannotReadFile; /***/ public String cannotReadFile;
/***/ public String cannotReadHEAD; /***/ public String cannotReadHEAD;
@ -566,6 +567,7 @@ public static JGitText get() {
/***/ public String notMergedExceptionMessage; /***/ public String notMergedExceptionMessage;
/***/ public String notShallowedUnshallow; /***/ public String notShallowedUnshallow;
/***/ public String noXMLParserAvailable; /***/ public String noXMLParserAvailable;
/***/ public String numberDoesntFit;
/***/ public String objectAtHasBadZlibStream; /***/ public String objectAtHasBadZlibStream;
/***/ public String objectIsCorrupt; /***/ public String objectIsCorrupt;
/***/ public String objectIsCorrupt3; /***/ public String objectIsCorrupt3;
@ -801,6 +803,7 @@ public static JGitText get() {
/***/ public String tSizeMustBeGreaterOrEqual1; /***/ public String tSizeMustBeGreaterOrEqual1;
/***/ public String unableToCheckConnectivity; /***/ public String unableToCheckConnectivity;
/***/ public String unableToCreateNewObject; /***/ public String unableToCreateNewObject;
/***/ public String unableToReadFullInt;
/***/ public String unableToReadPackfile; /***/ public String unableToReadPackfile;
/***/ public String unableToRemovePath; /***/ public String unableToRemovePath;
/***/ public String unableToWrite; /***/ public String unableToWrite;
@ -826,6 +829,7 @@ public static JGitText get() {
/***/ public String unknownObjectInIndex; /***/ public String unknownObjectInIndex;
/***/ public String unknownObjectType; /***/ public String unknownObjectType;
/***/ public String unknownObjectType2; /***/ public String unknownObjectType2;
/***/ public String unknownPositionEncoding;
/***/ public String unknownRefStorageFormat; /***/ public String unknownRefStorageFormat;
/***/ public String unknownRepositoryFormat; /***/ public String unknownRepositoryFormat;
/***/ public String unknownRepositoryFormat2; /***/ public String unknownRepositoryFormat2;
@ -853,6 +857,7 @@ public static JGitText get() {
/***/ public String unsupportedPackVersion; /***/ public String unsupportedPackVersion;
/***/ public String unsupportedReftableVersion; /***/ public String unsupportedReftableVersion;
/***/ public String unsupportedRepositoryDescription; /***/ public String unsupportedRepositoryDescription;
/***/ public String unsupportedSizesObjSizeIndex;
/***/ public String updateRequiresOldIdAndNewId; /***/ public String updateRequiresOldIdAndNewId;
/***/ public String updatingHeadFailed; /***/ public String updatingHeadFailed;
/***/ public String updatingReferences; /***/ public String updatingReferences;

View File

@ -14,6 +14,7 @@
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.util.Arrays; import java.util.Arrays;
import org.eclipse.jgit.internal.JGitText;
import org.eclipse.jgit.util.NB; import org.eclipse.jgit.util.NB;
/** /**
@ -75,7 +76,7 @@ private PackObjectSizeIndexV1(IndexInputStreamReader stream, int threshold,
pos32 = stream.readIntArray(sz); pos32 = stream.readIntArray(sz);
} else { } else {
throw new UnsupportedEncodingException( throw new UnsupportedEncodingException(
String.format("Unknown position encoding %s", String.format(JGitText.get().unknownPositionEncoding,
Integer.toHexString(positionEncoding))); Integer.toHexString(positionEncoding)));
} }
} }
@ -92,7 +93,7 @@ private PackObjectSizeIndexV1(IndexInputStreamReader stream, int threshold,
int c128sizes = stream.readInt(); int c128sizes = stream.readInt();
if (c128sizes != 0) { if (c128sizes != 0) {
// this MUST be 0 (we don't support 128 bits sizes yet) // this MUST be 0 (we don't support 128 bits sizes yet)
throw new IOException("Unsupported sizes in object-size-index"); throw new IOException(JGitText.get().unsupportedSizesObjSizeIndex);
} }
} }
@ -145,8 +146,7 @@ private static class IndexInputStreamReader {
int readInt() throws IOException { int readInt() throws IOException {
int n = in.readNBytes(buffer, 0, 4); int n = in.readNBytes(buffer, 0, 4);
if (n < 4) { if (n < 4) {
throw new IOException( throw new IOException(JGitText.get().unableToReadFullInt);
"Unable to read a full int from the stream");
} }
return NB.decodeInt32(buffer, 0); return NB.decodeInt32(buffer, 0);
} }
@ -166,8 +166,7 @@ int[] readIntArray(int intsCount) throws IOException {
long readLong() throws IOException { long readLong() throws IOException {
int n = in.readNBytes(buffer, 0, 8); int n = in.readNBytes(buffer, 0, 8);
if (n < 8) { if (n < 8) {
throw new IOException( throw new IOException(JGitText.get().unableToReadFullInt);
"Unable to read a full int from the stream");
} }
return NB.decodeInt64(buffer, 0); return NB.decodeInt64(buffer, 0);
} }
@ -187,7 +186,7 @@ long[] readLongArray(int longsCount) throws IOException {
byte readByte() throws IOException { byte readByte() throws IOException {
int n = in.readNBytes(buffer, 0, 1); int n = in.readNBytes(buffer, 0, 1);
if (n != 1) { if (n != 1) {
throw new IOException("Cannot read byte from stream"); throw new IOException(JGitText.get().cannotReadByte);
} }
return buffer[0]; return buffer[0];
} }

View File

@ -14,6 +14,7 @@
import java.io.OutputStream; import java.io.OutputStream;
import java.util.List; import java.util.List;
import org.eclipse.jgit.internal.JGitText;
import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.transport.PackedObjectInfo; import org.eclipse.jgit.transport.PackedObjectInfo;
import org.eclipse.jgit.util.NB; import org.eclipse.jgit.util.NB;
@ -70,11 +71,11 @@ public abstract void write(List<? extends PackedObjectInfo> objs)
* Object size index v1. * Object size index v1.
* *
* Store position (in the main index) to size as parallel arrays. * Store position (in the main index) to size as parallel arrays.
* *
* <p>Positions in the main index fit well in unsigned 24 bits (16M) for most * <p>Positions in the main index fit well in unsigned 24 bits (16M) for most
* repositories, but some outliers have even more objects, so we need to * repositories, but some outliers have even more objects, so we need to
* store also 32 bits positions. * store also 32 bits positions.
* *
* <p>Sizes are stored as a first array parallel to positions. If a size * <p>Sizes are stored as a first array parallel to positions. If a size
* doesn't fit in an element of that array, then we encode there a position * doesn't fit in an element of that array, then we encode there a position
* on the next-size array. This "overflow" array doesn't have entries for * on the next-size array. This "overflow" array doesn't have entries for
@ -88,7 +89,7 @@ public abstract void write(List<? extends PackedObjectInfo> objs)
* / / * / /
* sizes (64 bits) [3GB, 6GB] * sizes (64 bits) [3GB, 6GB]
* </pre> * </pre>
* *
* <p>For sizes we use 32 bits as the first level and 64 for the rare objects * <p>For sizes we use 32 bits as the first level and 64 for the rare objects
* over 2GB. * over 2GB.
* *
@ -173,7 +174,7 @@ public void write(List<? extends PackedObjectInfo> allObjects)
private void writeUInt8(int i) throws IOException { private void writeUInt8(int i) throws IOException {
if (i > 255) { if (i > 255) {
throw new IllegalStateException( throw new IllegalStateException(
"Number doesn't fit in a single byte"); JGitText.get().numberDoesntFit);
} }
NB.encodeInt32(intBuffer, 0, i); NB.encodeInt32(intBuffer, 0, i);
os.write(intBuffer, 3, 1); os.write(intBuffer, 3, 1);