diff --git a/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties b/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties index bdf35d8d7..72a3d1cde 100644 --- a/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties +++ b/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties @@ -111,6 +111,7 @@ cannotPullOnARepoWithState=Cannot pull into a repository with state: {0} cannotRead=Cannot read {0} cannotReadBackDelta=Cannot read delta type {0} cannotReadBlob=Cannot read blob {0} +cannotReadByte=Cannot read byte from stream cannotReadCommit=Cannot read commit {0} cannotReadFile=Cannot read file {0} 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 notShallowedUnshallow=The server sent a unshallow for a commit that wasn''t marked as shallow: {0} noXMLParserAvailable=No XML parser available. +numberDoesntFit=Number doesn't fit in a single byte objectAtHasBadZlibStream=Object at {0} in {1} has bad zlib stream objectIsCorrupt=Object {0} is corrupt: {1} objectIsCorrupt3={0}: object {1}: {2} @@ -773,6 +775,7 @@ truncatedHunkOldLinesMissing=Truncated hunk, at least {0} old lines is missing tSizeMustBeGreaterOrEqual1=tSize must be >= 1 unableToCheckConnectivity=Unable to check connectivity. unableToCreateNewObject=Unable to create new object: {0} +unableToReadFullInt=Unable to read a full int from the stream unableToReadPackfile=Unable to read packfile {0} unableToRemovePath=Unable to remove path ''{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 unknownObjectType=Unknown object type {0}. unknownObjectType2=unknown +unknownPositionEncoding=Unknown position encoding %s unknownRefStorageFormat=Unknown ref storage format "{0}" unknownRepositoryFormat=Unknown repository format unknownRepositoryFormat2=Unknown repository format "{0}"; expected "0". @@ -825,6 +829,7 @@ unsupportedPackIndexVersion=Unsupported pack index version {0} unsupportedPackVersion=Unsupported pack version {0}. unsupportedReftableVersion=Unsupported reftable version {0}. unsupportedRepositoryDescription=Repository description not supported +unsupportedSizesObjSizeIndex=Unsupported sizes in object-size-index updateRequiresOldIdAndNewId=Update requires both old ID and new ID to be nonzero updatingHeadFailed=Updating HEAD failed updatingReferences=Updating references diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java index b502a1a98..d8720be56 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java @@ -139,6 +139,7 @@ public static JGitText get() { /***/ public String cannotRead; /***/ public String cannotReadBackDelta; /***/ public String cannotReadBlob; + /***/ public String cannotReadByte; /***/ public String cannotReadCommit; /***/ public String cannotReadFile; /***/ public String cannotReadHEAD; @@ -566,6 +567,7 @@ public static JGitText get() { /***/ public String notMergedExceptionMessage; /***/ public String notShallowedUnshallow; /***/ public String noXMLParserAvailable; + /***/ public String numberDoesntFit; /***/ public String objectAtHasBadZlibStream; /***/ public String objectIsCorrupt; /***/ public String objectIsCorrupt3; @@ -801,6 +803,7 @@ public static JGitText get() { /***/ public String tSizeMustBeGreaterOrEqual1; /***/ public String unableToCheckConnectivity; /***/ public String unableToCreateNewObject; + /***/ public String unableToReadFullInt; /***/ public String unableToReadPackfile; /***/ public String unableToRemovePath; /***/ public String unableToWrite; @@ -826,6 +829,7 @@ public static JGitText get() { /***/ public String unknownObjectInIndex; /***/ public String unknownObjectType; /***/ public String unknownObjectType2; + /***/ public String unknownPositionEncoding; /***/ public String unknownRefStorageFormat; /***/ public String unknownRepositoryFormat; /***/ public String unknownRepositoryFormat2; @@ -853,6 +857,7 @@ public static JGitText get() { /***/ public String unsupportedPackVersion; /***/ public String unsupportedReftableVersion; /***/ public String unsupportedRepositoryDescription; + /***/ public String unsupportedSizesObjSizeIndex; /***/ public String updateRequiresOldIdAndNewId; /***/ public String updatingHeadFailed; /***/ public String updatingReferences; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackObjectSizeIndexV1.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackObjectSizeIndexV1.java index 68befc6ca..be2ff67e4 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackObjectSizeIndexV1.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackObjectSizeIndexV1.java @@ -14,6 +14,7 @@ import java.io.UnsupportedEncodingException; import java.util.Arrays; +import org.eclipse.jgit.internal.JGitText; import org.eclipse.jgit.util.NB; /** @@ -75,7 +76,7 @@ private PackObjectSizeIndexV1(IndexInputStreamReader stream, int threshold, pos32 = stream.readIntArray(sz); } else { throw new UnsupportedEncodingException( - String.format("Unknown position encoding %s", + String.format(JGitText.get().unknownPositionEncoding, Integer.toHexString(positionEncoding))); } } @@ -92,7 +93,7 @@ private PackObjectSizeIndexV1(IndexInputStreamReader stream, int threshold, int c128sizes = stream.readInt(); if (c128sizes != 0) { // 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 n = in.readNBytes(buffer, 0, 4); if (n < 4) { - throw new IOException( - "Unable to read a full int from the stream"); + throw new IOException(JGitText.get().unableToReadFullInt); } return NB.decodeInt32(buffer, 0); } @@ -166,8 +166,7 @@ int[] readIntArray(int intsCount) throws IOException { long readLong() throws IOException { int n = in.readNBytes(buffer, 0, 8); if (n < 8) { - throw new IOException( - "Unable to read a full int from the stream"); + throw new IOException(JGitText.get().unableToReadFullInt); } return NB.decodeInt64(buffer, 0); } @@ -187,7 +186,7 @@ long[] readLongArray(int longsCount) throws IOException { byte readByte() throws IOException { int n = in.readNBytes(buffer, 0, 1); if (n != 1) { - throw new IOException("Cannot read byte from stream"); + throw new IOException(JGitText.get().cannotReadByte); } return buffer[0]; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackObjectSizeIndexWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackObjectSizeIndexWriter.java index ae03797ca..65a065dd5 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackObjectSizeIndexWriter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackObjectSizeIndexWriter.java @@ -14,6 +14,7 @@ import java.io.OutputStream; import java.util.List; +import org.eclipse.jgit.internal.JGitText; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.transport.PackedObjectInfo; import org.eclipse.jgit.util.NB; @@ -70,11 +71,11 @@ public abstract void write(List objs) * Object size index v1. * * Store position (in the main index) to size as parallel arrays. - * + * *

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 * store also 32 bits positions. - * + * *

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 * on the next-size array. This "overflow" array doesn't have entries for @@ -88,7 +89,7 @@ public abstract void write(List objs) * / / * sizes (64 bits) [3GB, 6GB] * - * + * *

For sizes we use 32 bits as the first level and 64 for the rare objects * over 2GB. * @@ -173,7 +174,7 @@ public void write(List allObjects) private void writeUInt8(int i) throws IOException { if (i > 255) { throw new IllegalStateException( - "Number doesn't fit in a single byte"); + JGitText.get().numberDoesntFit); } NB.encodeInt32(intBuffer, 0, i); os.write(intBuffer, 3, 1);