From 17fb542e9eaca9dffc4c84a6d23608dadb4b1ea1 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 8 May 2012 21:42:53 -0700 Subject: [PATCH] Remove 86 boxing warnings Use Integer, Character, and Long valueOf methods when passing parameters to MessageFormat and other places that expect objects instead of primitives Change-Id: I5942fbdbca6a378136c00d951ce61167f2366ca4 --- .../src/org/eclipse/jgit/diff/MyersDiff.java | 6 +-- .../org/eclipse/jgit/dircache/DirCache.java | 14 ++++-- .../jgit/errors/LargeObjectException.java | 2 +- .../errors/TooLargeObjectInPackException.java | 4 +- .../eclipse/jgit/lib/AbbreviatedObjectId.java | 6 ++- .../src/org/eclipse/jgit/lib/Config.java | 4 +- .../src/org/eclipse/jgit/lib/Constants.java | 6 ++- .../org/eclipse/jgit/lib/ObjectChecker.java | 3 +- .../jgit/patch/CombinedHunkHeader.java | 8 +++- .../org/eclipse/jgit/patch/FileHeader.java | 4 +- .../org/eclipse/jgit/patch/HunkHeader.java | 6 ++- .../eclipse/jgit/revplot/PlotCommitList.java | 2 +- .../org/eclipse/jgit/revwalk/ObjectWalk.java | 10 ++-- .../eclipse/jgit/revwalk/RevObjectList.java | 4 +- .../src/org/eclipse/jgit/revwalk/RevWalk.java | 10 ++-- .../eclipse/jgit/storage/file/PackFile.java | 47 +++++++++++-------- .../eclipse/jgit/storage/file/PackIndex.java | 4 +- .../jgit/storage/file/PackIndexWriter.java | 3 +- .../jgit/storage/file/PackReverseIndex.java | 14 +++--- .../eclipse/jgit/storage/pack/PackWriter.java | 4 +- .../org/eclipse/jgit/transport/AmazonS3.java | 11 +++-- .../transport/BasePackPushConnection.java | 4 +- .../eclipse/jgit/transport/PackParser.java | 40 +++++++++------- .../jgit/transport/SideBandInputStream.java | 4 +- .../jgit/transport/SideBandOutputStream.java | 12 +++-- .../eclipse/jgit/transport/TransportHttp.java | 3 +- .../eclipse/jgit/transport/TransportSftp.java | 2 +- .../jgit/transport/WalkFetchConnection.java | 6 ++- .../src/org/eclipse/jgit/util/Base64.java | 4 +- .../eclipse/jgit/util/io/InterruptTimer.java | 3 +- .../jgit/util/io/TimeoutInputStream.java | 3 +- .../jgit/util/io/TimeoutOutputStream.java | 3 +- 32 files changed, 160 insertions(+), 96 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/MyersDiff.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/MyersDiff.java index 6f04593b8..94acd4325 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/MyersDiff.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/MyersDiff.java @@ -301,21 +301,21 @@ public class MyersDiff { final int getIndex(int d, int k) { // TODO: remove if (((d + k - middleK) % 2) != 0) - throw new RuntimeException(MessageFormat.format(JGitText.get().unexpectedOddResult, d, k, middleK)); + throw new RuntimeException(MessageFormat.format(JGitText.get().unexpectedOddResult, Integer.valueOf(d), Integer.valueOf(k), Integer.valueOf(middleK))); return (d + k - middleK) / 2; } final int getX(int d, int k) { // TODO: remove if (k < beginK || k > endK) - throw new RuntimeException(MessageFormat.format(JGitText.get().kNotInRange, k, beginK, endK)); + throw new RuntimeException(MessageFormat.format(JGitText.get().kNotInRange, Integer.valueOf(k), Integer.valueOf(beginK), Integer.valueOf(endK))); return x.get(getIndex(d, k)); } final long getSnake(int d, int k) { // TODO: remove if (k < beginK || k > endK) - throw new RuntimeException(MessageFormat.format(JGitText.get().kNotInRange, k, beginK, endK)); + throw new RuntimeException(MessageFormat.format(JGitText.get().kNotInRange, Integer.valueOf(k), Integer.valueOf(beginK), Integer.valueOf(endK))); return snake.get(getIndex(d, k)); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java index d8afd858b..f139b0f7f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java @@ -398,7 +398,8 @@ public class DirCache { if (ver == 3) extended = true; else if (ver != 2) - throw new CorruptObjectException(MessageFormat.format(JGitText.get().unknownDIRCVersion, ver)); + throw new CorruptObjectException(MessageFormat.format( + JGitText.get().unknownDIRCVersion, Integer.valueOf(ver))); entryCnt = NB.decodeInt32(hdr, 8); if (entryCnt < 0) throw new CorruptObjectException(JGitText.get().DIRCHasTooManyEntries); @@ -433,8 +434,9 @@ public class DirCache { switch (NB.decodeInt32(hdr, 0)) { case EXT_TREE: { if (Integer.MAX_VALUE < sz) { - throw new CorruptObjectException(MessageFormat.format(JGitText.get().DIRCExtensionIsTooLargeAt - , formatExtensionName(hdr), sz)); + throw new CorruptObjectException(MessageFormat.format( + JGitText.get().DIRCExtensionIsTooLargeAt, + formatExtensionName(hdr), Long.valueOf(sz))); } final byte[] raw = new byte[(int) sz]; IO.readFully(in, raw, 0, raw.length); @@ -474,8 +476,10 @@ public class DirCache { while (0 < sz) { int n = in.read(b, 0, (int) Math.min(b.length, sz)); if (n < 0) { - throw new EOFException(MessageFormat.format(JGitText.get().shortReadOfOptionalDIRCExtensionExpectedAnotherBytes - , formatExtensionName(hdr), sz)); + throw new EOFException( + MessageFormat.format( + JGitText.get().shortReadOfOptionalDIRCExtensionExpectedAnotherBytes, + formatExtensionName(hdr), Long.valueOf(sz))); } md.update(b, 0, n); sz -= n; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/errors/LargeObjectException.java b/org.eclipse.jgit/src/org/eclipse/jgit/errors/LargeObjectException.java index f12ec5648..a69bdc481 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/errors/LargeObjectException.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/errors/LargeObjectException.java @@ -157,7 +157,7 @@ public class LargeObjectException extends RuntimeException { @Override public String getMessage() { return MessageFormat.format(JGitText.get().largeObjectExceedsLimit, - getObjectName(), limit, size); + getObjectName(), Long.valueOf(limit), Long.valueOf(size)); } } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/errors/TooLargeObjectInPackException.java b/org.eclipse.jgit/src/org/eclipse/jgit/errors/TooLargeObjectInPackException.java index d20cd056a..79515fcd7 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/errors/TooLargeObjectInPackException.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/errors/TooLargeObjectInPackException.java @@ -64,7 +64,7 @@ public class TooLargeObjectInPackException extends IOException { */ public TooLargeObjectInPackException(long maxObjectSizeLimit) { super(MessageFormat.format(JGitText.get().receivePackObjectTooLarge1, - maxObjectSizeLimit)); + Long.valueOf(maxObjectSizeLimit))); } /** @@ -77,6 +77,6 @@ public class TooLargeObjectInPackException extends IOException { public TooLargeObjectInPackException(long objectSize, long maxObjectSizeLimit) { super(MessageFormat.format(JGitText.get().receivePackObjectTooLarge2, - objectSize, maxObjectSizeLimit)); + Long.valueOf(objectSize), Long.valueOf(maxObjectSizeLimit))); } } \ No newline at end of file diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/AbbreviatedObjectId.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/AbbreviatedObjectId.java index bd9d28e47..44460fe65 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/AbbreviatedObjectId.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/AbbreviatedObjectId.java @@ -101,8 +101,10 @@ public final class AbbreviatedObjectId implements Serializable { public static final AbbreviatedObjectId fromString(final byte[] buf, final int offset, final int end) { if (end - offset > Constants.OBJECT_ID_STRING_LENGTH) - throw new IllegalArgumentException(MessageFormat.format(JGitText.get().invalidIdLength - , end - offset, Constants.OBJECT_ID_STRING_LENGTH)); + throw new IllegalArgumentException(MessageFormat.format( + JGitText.get().invalidIdLength, + Integer.valueOf(end - offset), + Integer.valueOf(Constants.OBJECT_ID_STRING_LENGTH))); return fromHexString(buf, offset, end); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java index 1619b589c..15bd37e69 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java @@ -1204,7 +1204,9 @@ public class Config { value.append('"'); continue; default: - throw new ConfigInvalidException(MessageFormat.format(JGitText.get().badEscape, ((char) c))); + throw new ConfigInvalidException(MessageFormat.format( + JGitText.get().badEscape, + Character.valueOf(((char) c)))); } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java index 70d63fa1e..5332ffa71 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java @@ -375,7 +375,8 @@ public final class Constants { case OBJ_TAG: return TYPE_TAG; default: - throw new IllegalArgumentException(MessageFormat.format(JGitText.get().badObjectType, typeCode)); + throw new IllegalArgumentException(MessageFormat.format( + JGitText.get().badObjectType, Integer.valueOf(typeCode))); } } @@ -399,7 +400,8 @@ public final class Constants { case OBJ_TAG: return ENCODED_TYPE_TAG; default: - throw new IllegalArgumentException(MessageFormat.format(JGitText.get().badObjectType, typeCode)); + throw new IllegalArgumentException(MessageFormat.format( + JGitText.get().badObjectType, Integer.valueOf(typeCode))); } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectChecker.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectChecker.java index 1b8457883..5fc1e8325 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectChecker.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectChecker.java @@ -127,7 +127,8 @@ public class ObjectChecker { break; default: throw new CorruptObjectException(MessageFormat.format( - JGitText.get().corruptObjectInvalidType2, objType)); + JGitText.get().corruptObjectInvalidType2, + Integer.valueOf(objType))); } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/patch/CombinedHunkHeader.java b/org.eclipse.jgit/src/org/eclipse/jgit/patch/CombinedHunkHeader.java index 9955519c7..eb2bfac1b 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/patch/CombinedHunkHeader.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/patch/CombinedHunkHeader.java @@ -186,13 +186,17 @@ public class CombinedHunkHeader extends HunkHeader { if (cmp < o.lineCount) { final int missingCnt = o.lineCount - cmp; script.error(buf, startOffset, MessageFormat.format( - JGitText.get().truncatedHunkLinesMissingForAncestor, missingCnt, (ancestor + 1))); + JGitText.get().truncatedHunkLinesMissingForAncestor, + Integer.valueOf(missingCnt), + Integer.valueOf(ancestor + 1))); } } if (nContext + nAdded < newLineCount) { final int missingCount = newLineCount - (nContext + nAdded); - script.error(buf, startOffset, MessageFormat.format(JGitText.get().truncatedHunkNewLinesMissing, missingCount)); + script.error(buf, startOffset, MessageFormat.format( + JGitText.get().truncatedHunkNewLinesMissing, + Integer.valueOf(missingCount))); } return c; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/patch/FileHeader.java b/org.eclipse.jgit/src/org/eclipse/jgit/patch/FileHeader.java index 3404ef551..ff30a8cbc 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/patch/FileHeader.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/patch/FileHeader.java @@ -218,7 +218,9 @@ public class FileHeader extends DiffEntry { } if (charsetGuess != null && charsetGuess.length != getParentCount() + 1) - throw new IllegalArgumentException(MessageFormat.format(JGitText.get().expectedCharacterEncodingGuesses, (getParentCount() + 1))); + throw new IllegalArgumentException(MessageFormat.format( + JGitText.get().expectedCharacterEncodingGuesses, + Integer.valueOf(getParentCount() + 1))); if (trySimpleConversion(charsetGuess)) { Charset cs = charsetGuess != null ? charsetGuess[0] : null; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/patch/HunkHeader.java b/org.eclipse.jgit/src/org/eclipse/jgit/patch/HunkHeader.java index 43e7a6f9e..b7a93933f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/patch/HunkHeader.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/patch/HunkHeader.java @@ -300,12 +300,14 @@ public class HunkHeader { if (nContext + old.nDeleted < old.lineCount) { final int missingCount = old.lineCount - (nContext + old.nDeleted); script.error(buf, startOffset, MessageFormat.format( - JGitText.get().truncatedHunkOldLinesMissing, missingCount)); + JGitText.get().truncatedHunkOldLinesMissing, + Integer.valueOf(missingCount))); } else if (nContext + old.nAdded < newLineCount) { final int missingCount = newLineCount - (nContext + old.nAdded); script.error(buf, startOffset, MessageFormat.format( - JGitText.get().truncatedHunkNewLinesMissing, missingCount)); + JGitText.get().truncatedHunkNewLinesMissing, + Integer.valueOf(missingCount))); } else if (nContext + old.nDeleted > old.lineCount || nContext + old.nAdded > newLineCount) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommitList.java b/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommitList.java index 2e292fac7..3ad56d184 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommitList.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommitList.java @@ -231,7 +231,7 @@ public class PlotCommitList extends } if (newPos == -1) newPos = positionsAllocated++; - freePositions.add(commit.lane.getPosition()); + freePositions.add(Integer.valueOf(commit.lane.getPosition())); activeLanes.remove(commit.lane); commit.lane.position = newPos; activeLanes.add(commit.lane); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java index b539b50d6..18e26da66 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java @@ -351,7 +351,8 @@ public class ObjectWalk extends RevWalk { default: throw new CorruptObjectException(MessageFormat.format( JGitText.get().corruptObjectInvalidMode3, - String.format("%o", mode), idBuffer.name(), + String.format("%o", Integer.valueOf(mode)), + idBuffer.name(), RawParseUtils.decode(buf, tv.namePtr, tv.nameEnd), tv.obj)); } @@ -702,9 +703,10 @@ public class ObjectWalk extends RevWalk { default: idBuffer.fromRaw(raw, ptr); - throw new CorruptObjectException(MessageFormat.format(JGitText - .get().corruptObjectInvalidMode3, String.format("%o", - mode), idBuffer.name(), "", tree)); + throw new CorruptObjectException(MessageFormat.format( + JGitText.get().corruptObjectInvalidMode3, + String.format("%o", Integer.valueOf(mode)), + idBuffer.name(), "", tree)); } ptr += ID_SZ; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevObjectList.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevObjectList.java index 2e63e74b5..a05cc9046 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevObjectList.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevObjectList.java @@ -80,7 +80,9 @@ public class RevObjectList extends AbstractList { public void add(final int index, final E element) { if (index != size) - throw new UnsupportedOperationException(MessageFormat.format(JGitText.get().unsupportedOperationNotAddAtEnd, index)); + throw new UnsupportedOperationException(MessageFormat.format( + JGitText.get().unsupportedOperationNotAddAtEnd, + Integer.valueOf(index))); set(index, element); size++; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java index 9b018f479..0ef40d96e 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java @@ -682,7 +682,8 @@ public class RevWalk implements Iterable { r = new RevTag(id); break; default: - throw new IllegalArgumentException(MessageFormat.format(JGitText.get().invalidGitType, type)); + throw new IllegalArgumentException(MessageFormat.format( + JGitText.get().invalidGitType, Integer.valueOf(type))); } objects.add(r); } @@ -843,8 +844,8 @@ public class RevWalk implements Iterable { break; } default: - throw new IllegalArgumentException(MessageFormat.format(JGitText - .get().badObjectType, type)); + throw new IllegalArgumentException(MessageFormat.format( + JGitText.get().badObjectType, Integer.valueOf(type))); } objects.add(r); return r; @@ -1026,7 +1027,8 @@ public class RevWalk implements Iterable { int allocFlag() { if (freeFlags == 0) throw new IllegalArgumentException(MessageFormat.format( - JGitText.get().flagsAlreadyCreated, 32 - RESERVED_FLAGS)); + JGitText.get().flagsAlreadyCreated, + Integer.valueOf(32 - RESERVED_FLAGS))); final int m = Integer.lowestOneBit(freeFlags); freeFlags &= ~m; return m; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackFile.java index 95ca4a41f..3aa3c8f84 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackFile.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackFile.java @@ -306,7 +306,9 @@ public class PackFile implements Iterable { } if (curs.inflate(this, position, dstbuf, 0) != sz) - throw new EOFException(MessageFormat.format(JGitText.get().shortCompressedStreamAt, position)); + throw new EOFException(MessageFormat.format( + JGitText.get().shortCompressedStreamAt, + Long.valueOf(position))); return dstbuf; } @@ -406,7 +408,7 @@ public class PackFile implements Iterable { setCorrupt(src.offset); throw new CorruptObjectException(MessageFormat.format( JGitText.get().objectAtHasBadZlibStream, - src.offset, getPackFile())); + Long.valueOf(src.offset), getPackFile())); } } else if (validate) { // We don't have a CRC32 code in the index, so compute it @@ -435,7 +437,7 @@ public class PackFile implements Iterable { setCorrupt(src.offset); throw new EOFException(MessageFormat.format( JGitText.get().shortCompressedStreamAt, - src.offset)); + Long.valueOf(src.offset))); } expectedCRC = crc1.getValue(); } else { @@ -447,7 +449,7 @@ public class PackFile implements Iterable { CorruptObjectException corruptObject = new CorruptObjectException( MessageFormat.format( JGitText.get().objectAtHasBadZlibStream, - src.offset, getPackFile())); + Long.valueOf(src.offset), getPackFile())); corruptObject.initCause(dataFormat); StoredObjectRepresentationNotAvailableException gone; @@ -503,9 +505,9 @@ public class PackFile implements Iterable { cnt -= n; } if (validate && crc2.getValue() != expectedCRC) { - throw new CorruptObjectException(MessageFormat.format(JGitText - .get().objectAtHasBadZlibStream, src.offset, - getPackFile())); + throw new CorruptObjectException(MessageFormat.format( + JGitText.get().objectAtHasBadZlibStream, + Long.valueOf(src.offset), getPackFile())); } } } @@ -650,11 +652,14 @@ public class PackFile implements Iterable { final long vers = NB.decodeUInt32(buf, 4); final long packCnt = NB.decodeUInt32(buf, 8); if (vers != 2 && vers != 3) - throw new IOException(MessageFormat.format(JGitText.get().unsupportedPackVersion, vers)); + throw new IOException(MessageFormat.format( + JGitText.get().unsupportedPackVersion, Long.valueOf(vers))); if (packCnt != idx.getObjectCount()) throw new PackMismatchException(MessageFormat.format( - JGitText.get().packObjectCountMismatch, packCnt, idx.getObjectCount(), getPackFile())); + JGitText.get().packObjectCountMismatch, + Long.valueOf(packCnt), Long.valueOf(idx.getObjectCount()), + getPackFile())); fd.seek(length - 20); fd.readFully(buf, 0, 20); @@ -753,7 +758,8 @@ public class PackFile implements Iterable { default: throw new IOException(MessageFormat.format( - JGitText.get().unknownObjectType, typeCode)); + JGitText.get().unknownObjectType, + Integer.valueOf(typeCode))); } } @@ -801,8 +807,8 @@ public class PackFile implements Iterable { } catch (DataFormatException dfe) { CorruptObjectException coe = new CorruptObjectException( MessageFormat.format( - JGitText.get().objectAtHasBadZlibStream, pos, - getPackFile())); + JGitText.get().objectAtHasBadZlibStream, + Long.valueOf(pos), getPackFile())); coe.initCause(dfe); throw coe; } @@ -906,8 +912,9 @@ public class PackFile implements Iterable { } default: - throw new IOException(MessageFormat.format( - JGitText.get().unknownObjectType, type)); + throw new IOException( + MessageFormat.format(JGitText.get().unknownObjectType, + Integer.valueOf(type))); } } } @@ -954,14 +961,15 @@ public class PackFile implements Iterable { default: throw new IOException(MessageFormat.format( - JGitText.get().unknownObjectType, type)); + JGitText.get().unknownObjectType, Integer.valueOf(type))); } try { return BinaryDelta.getResultSize(getDeltaHeader(curs, deltaAt)); } catch (DataFormatException e) { - throw new CorruptObjectException(MessageFormat.format(JGitText - .get().objectAtHasBadZlibStream, pos, getPackFile())); + throw new CorruptObjectException(MessageFormat.format( + JGitText.get().objectAtHasBadZlibStream, Long.valueOf(pos), + getPackFile())); } } @@ -1009,8 +1017,9 @@ public class PackFile implements Iterable { } default: - throw new IOException(MessageFormat.format( - JGitText.get().unknownObjectType, typeCode)); + throw new IOException( + MessageFormat.format(JGitText.get().unknownObjectType, + Integer.valueOf(typeCode))); } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackIndex.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackIndex.java index a39da7935..ef987fa96 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackIndex.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackIndex.java @@ -136,7 +136,9 @@ public abstract class PackIndex implements Iterable { case 2: return new PackIndexV2(fd); default: - throw new IOException(MessageFormat.format(JGitText.get().unsupportedPackIndexVersion, v)); + throw new IOException(MessageFormat.format( + JGitText.get().unsupportedPackIndexVersion, + Integer.valueOf(v))); } } return new PackIndexV1(fd, hdr); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackIndexWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackIndexWriter.java index da140ae9d..b78c5ae26 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackIndexWriter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackIndexWriter.java @@ -137,7 +137,8 @@ public abstract class PackIndexWriter { return new PackIndexWriterV2(dst); default: throw new IllegalArgumentException(MessageFormat.format( - JGitText.get().unsupportedPackIndexVersion, version)); + JGitText.get().unsupportedPackIndexVersion, + Integer.valueOf(version))); } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackReverseIndex.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackReverseIndex.java index 180bf60bf..990106b93 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackReverseIndex.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackReverseIndex.java @@ -169,9 +169,10 @@ public class PackReverseIndex { if (offset <= Integer.MAX_VALUE) { final int i32 = Arrays.binarySearch(offsets32, (int) offset); if (i32 < 0) - throw new CorruptObjectException(MessageFormat.format( - JGitText.get().cantFindObjectInReversePackIndexForTheSpecifiedOffset - , offset)); + throw new CorruptObjectException( + MessageFormat.format( + JGitText.get().cantFindObjectInReversePackIndexForTheSpecifiedOffset, + Long.valueOf(offset))); if (i32 + 1 == offsets32.length) { if (offsets64.length > 0) @@ -182,9 +183,10 @@ public class PackReverseIndex { } else { final int i64 = Arrays.binarySearch(offsets64, offset); if (i64 < 0) - throw new CorruptObjectException(MessageFormat.format( - JGitText.get().cantFindObjectInReversePackIndexForTheSpecifiedOffset - , offset)); + throw new CorruptObjectException( + MessageFormat.format( + JGitText.get().cantFindObjectInReversePackIndexForTheSpecifiedOffset, + Long.valueOf(offset))); if (i64 + 1 == offsets64.length) return maxOffset; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java index 1a056e3c1..03cf649a2 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java @@ -2185,8 +2185,8 @@ public class PackWriter { /** @return formatted message string for display to clients. */ public String getMessage() { return MessageFormat.format(JGitText.get().packWriterStatistics, // - totalObjects, totalDeltas, // - reusedObjects, reusedDeltas); + Long.valueOf(totalObjects), Long.valueOf(totalDeltas), // + Long.valueOf(reusedObjects), Long.valueOf(reusedDeltas)); } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java index f5934d3b0..8a595db33 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java @@ -510,8 +510,10 @@ public class AmazonS3 { private IOException error(final String action, final String key, final HttpURLConnection c) throws IOException { - final IOException err = new IOException(MessageFormat.format(JGitText.get().amazonS3ActionFailed - , action, key, HttpSupport.response(c), c.getResponseMessage())); + final IOException err = new IOException(MessageFormat.format( + JGitText.get().amazonS3ActionFailed, action, key, + Integer.valueOf(HttpSupport.response(c)), + c.getResponseMessage())); final InputStream errorStream = c.getErrorStream(); if (errorStream == null) return err; @@ -532,8 +534,9 @@ public class AmazonS3 { } private IOException maxAttempts(final String action, final String key) { - return new IOException(MessageFormat.format(JGitText.get().amazonS3ActionFailedGivingUp - , action, key, maxAttempts)); + return new IOException(MessageFormat.format( + JGitText.get().amazonS3ActionFailedGivingUp, action, key, + Integer.valueOf(maxAttempts))); } private HttpURLConnection open(final String method, final String bucket, diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java index b042dabe9..8bf030bb8 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java @@ -181,7 +181,9 @@ public abstract class BasePackPushConnection extends BasePackConnection implemen // int b = in.read(); if (0 <= b) - throw new TransportException(uri, MessageFormat.format(JGitText.get().expectedEOFReceived, (char) b)); + throw new TransportException(uri, MessageFormat.format( + JGitText.get().expectedEOFReceived, + Character.valueOf((char) b))); } } } catch (TransportException e) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java index 584d9337e..6b4bf2a41 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java @@ -506,17 +506,17 @@ public abstract class PackParser { resolveDeltas(resolving); if (entryCount < objectCount) { if (!isAllowThin()) { - throw new IOException(MessageFormat.format(JGitText - .get().packHasUnresolvedDeltas, - (objectCount - entryCount))); + throw new IOException(MessageFormat.format( + JGitText.get().packHasUnresolvedDeltas, + Long.valueOf(objectCount - entryCount))); } resolveDeltasWithExternalBases(resolving); if (entryCount < objectCount) { - throw new IOException(MessageFormat.format(JGitText - .get().packHasUnresolvedDeltas, - (objectCount - entryCount))); + throw new IOException(MessageFormat.format( + JGitText.get().packHasUnresolvedDeltas, + Long.valueOf(objectCount - entryCount))); } } resolving.endTask(); @@ -573,13 +573,14 @@ public abstract class PackParser { break; default: throw new IOException(MessageFormat.format( - JGitText.get().unknownObjectType, info.type)); + JGitText.get().unknownObjectType, + Integer.valueOf(info.type))); } if (!checkCRC(oe.getCRC())) { throw new IOException(MessageFormat.format( - JGitText.get().corruptionDetectedReReadingAt, oe - .getOffset())); + JGitText.get().corruptionDetectedReReadingAt, + Long.valueOf(oe.getOffset()))); } resolveDeltas(visit.next(), info.type, info, progress); @@ -598,7 +599,8 @@ public abstract class PackParser { default: throw new IOException(MessageFormat.format( - JGitText.get().unknownObjectType, info.type)); + JGitText.get().unknownObjectType, + Integer.valueOf(info.type))); } byte[] delta = inflateAndReturn(Source.DATABASE, info.size); @@ -610,7 +612,7 @@ public abstract class PackParser { if (!checkCRC(visit.delta.crc)) throw new IOException(MessageFormat.format( JGitText.get().corruptionDetectedReReadingAt, - visit.delta.position)); + Long.valueOf(visit.delta.position))); objectDigest.update(Constants.encodedTypeString(type)); objectDigest.update((byte) ' '); @@ -649,7 +651,8 @@ public abstract class PackParser { default: throw new IOException(MessageFormat.format( - JGitText.get().unknownObjectType, typeCode)); + JGitText.get().unknownObjectType, + Integer.valueOf(typeCode))); } } @@ -713,7 +716,8 @@ public abstract class PackParser { default: throw new IOException(MessageFormat.format( - JGitText.get().unknownObjectType, info.type)); + JGitText.get().unknownObjectType, + Integer.valueOf(info.type))); } return info; } @@ -831,7 +835,7 @@ public abstract class PackParser { final long vers = NB.decodeUInt32(buf, p + 4); if (vers != 2 && vers != 3) throw new IOException(MessageFormat.format( - JGitText.get().unsupportedPackVersion, vers)); + JGitText.get().unsupportedPackVersion, Long.valueOf(vers))); objectCount = NB.decodeUInt32(buf, p + 8); use(hdrln); @@ -952,8 +956,9 @@ public abstract class PackParser { } default: - throw new IOException(MessageFormat.format( - JGitText.get().unknownObjectType, typeCode)); + throw new IOException( + MessageFormat.format(JGitText.get().unknownObjectType, + Integer.valueOf(typeCode))); } } @@ -1038,7 +1043,8 @@ public abstract class PackParser { if (info.type != Constants.OBJ_BLOB) throw new IOException(MessageFormat.format( - JGitText.get().unknownObjectType, info.type)); + JGitText.get().unknownObjectType, + Integer.valueOf(info.type))); ObjectStream cur = readCurs.open(obj, info.type).openStream(); try { 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 5feeeaf21..bc9f64995 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandInputStream.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandInputStream.java @@ -172,7 +172,9 @@ class SideBandInputStream extends InputStream { eof = true; throw new TransportException(PFX_REMOTE + readString(available)); default: - throw new PackProtocolException(MessageFormat.format(JGitText.get().invalidChannel, channel)); + throw new PackProtocolException( + MessageFormat.format(JGitText.get().invalidChannel, + Integer.valueOf(channel))); } } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandOutputStream.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandOutputStream.java index 521aea0d7..8fe78b680 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandOutputStream.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandOutputStream.java @@ -102,11 +102,17 @@ public class SideBandOutputStream extends OutputStream { */ public SideBandOutputStream(final int chan, final int sz, final OutputStream os) { if (chan <= 0 || chan > 255) - throw new IllegalArgumentException(MessageFormat.format(JGitText.get().channelMustBeInRange0_255, chan)); + throw new IllegalArgumentException(MessageFormat.format( + JGitText.get().channelMustBeInRange0_255, + Integer.valueOf(chan))); if (sz <= HDR_SIZE) - throw new IllegalArgumentException(MessageFormat.format(JGitText.get().packetSizeMustBeAtLeast, sz, HDR_SIZE)); + throw new IllegalArgumentException(MessageFormat.format( + JGitText.get().packetSizeMustBeAtLeast, + Integer.valueOf(sz), Integer.valueOf(HDR_SIZE))); else if (MAX_BUF < sz) - throw new IllegalArgumentException(MessageFormat.format(JGitText.get().packetSizeMustBeAtMost, sz, MAX_BUF)); + throw new IllegalArgumentException(MessageFormat.format( + JGitText.get().packetSizeMustBeAtMost, Integer.valueOf(sz), + Integer.valueOf(MAX_BUF))); out = os; buffer = new byte[sz]; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java index 862d08307..71f5bcb51 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java @@ -344,7 +344,8 @@ public class TransportHttp extends HttpTransport implements WalkTransport, default: throw new TransportException(uri, MessageFormat.format( - JGitText.get().cannotReadHEAD, status, conn.getResponseMessage())); + JGitText.get().cannotReadHEAD, Integer.valueOf(status), + conn.getResponseMessage())); } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportSftp.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportSftp.java index 26498d2d8..dec6a4f40 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportSftp.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportSftp.java @@ -242,7 +242,7 @@ public class TransportSftp extends SshTransport implements WalkTransport { if (!files.containsKey(in)) continue; - mtimes.put(n, ent.getAttrs().getMTime()); + mtimes.put(n, Integer.valueOf(ent.getAttrs().getMTime())); packs.add(n); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java index ed12937c8..f1710bd5c 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java @@ -638,8 +638,10 @@ class WalkFetchConnection extends BaseFetchConnection { ObjectId act = inserter.insert(type, raw); if (!AnyObjectId.equals(id, act)) { - throw new TransportException(MessageFormat.format(JGitText.get().incorrectHashFor - , id.name(), act.name(), Constants.typeString(type), compressed.length)); + throw new TransportException(MessageFormat.format( + JGitText.get().incorrectHashFor, id.name(), act.name(), + Constants.typeString(type), + Integer.valueOf(compressed.length))); } inserter.flush(); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/Base64.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/Base64.java index a033d300e..b59148fc3 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/Base64.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/Base64.java @@ -284,8 +284,8 @@ public class Base64 { } else if (sbiDecode != WHITE_SPACE_DEC) throw new IllegalArgumentException(MessageFormat.format( - JGitText.get().badBase64InputCharacterAt, i, - source[i] & 0xff)); + JGitText.get().badBase64InputCharacterAt, + Integer.valueOf(i), Integer.valueOf(source[i] & 0xff))); } if (outBuff.length == outBuffPosn) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/InterruptTimer.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/InterruptTimer.java index 5216cc627..352e23724 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/InterruptTimer.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/InterruptTimer.java @@ -117,7 +117,8 @@ public final class InterruptTimer { */ public void begin(final int timeout) { if (timeout <= 0) - throw new IllegalArgumentException(MessageFormat.format(JGitText.get().invalidTimeout, timeout)); + throw new IllegalArgumentException(MessageFormat.format( + JGitText.get().invalidTimeout, Integer.valueOf(timeout))); Thread.interrupted(); state.begin(timeout); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/TimeoutInputStream.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/TimeoutInputStream.java index f712ca188..cda2b59b4 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/TimeoutInputStream.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/TimeoutInputStream.java @@ -83,7 +83,8 @@ public class TimeoutInputStream extends FilterInputStream { */ public void setTimeout(final int millis) { if (millis < 0) - throw new IllegalArgumentException(MessageFormat.format(JGitText.get().invalidTimeout, millis)); + throw new IllegalArgumentException(MessageFormat.format( + JGitText.get().invalidTimeout, Integer.valueOf(millis))); timeout = millis; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/TimeoutOutputStream.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/TimeoutOutputStream.java index bed158f76..b074396a7 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/TimeoutOutputStream.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/TimeoutOutputStream.java @@ -84,7 +84,8 @@ public class TimeoutOutputStream extends OutputStream { */ public void setTimeout(final int millis) { if (millis < 0) - throw new IllegalArgumentException(MessageFormat.format(JGitText.get().invalidTimeout, millis)); + throw new IllegalArgumentException(MessageFormat.format( + JGitText.get().invalidTimeout, Integer.valueOf(millis))); timeout = millis; }