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
This commit is contained in:
Kevin Sawicki 2012-05-08 21:42:53 -07:00
parent e4effd25c5
commit 17fb542e9e
32 changed files with 160 additions and 96 deletions

View File

@ -301,21 +301,21 @@ abstract class EditPaths {
final int getIndex(int d, int k) { final int getIndex(int d, int k) {
// TODO: remove // TODO: remove
if (((d + k - middleK) % 2) != 0) 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; return (d + k - middleK) / 2;
} }
final int getX(int d, int k) { final int getX(int d, int k) {
// TODO: remove // TODO: remove
if (k < beginK || k > endK) 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)); return x.get(getIndex(d, k));
} }
final long getSnake(int d, int k) { final long getSnake(int d, int k) {
// TODO: remove // TODO: remove
if (k < beginK || k > endK) 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)); return snake.get(getIndex(d, k));
} }

View File

@ -398,7 +398,8 @@ private void readFrom(final InputStream inStream) throws IOException,
if (ver == 3) if (ver == 3)
extended = true; extended = true;
else if (ver != 2) 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); entryCnt = NB.decodeInt32(hdr, 8);
if (entryCnt < 0) if (entryCnt < 0)
throw new CorruptObjectException(JGitText.get().DIRCHasTooManyEntries); throw new CorruptObjectException(JGitText.get().DIRCHasTooManyEntries);
@ -433,8 +434,9 @@ else if (ver != 2)
switch (NB.decodeInt32(hdr, 0)) { switch (NB.decodeInt32(hdr, 0)) {
case EXT_TREE: { case EXT_TREE: {
if (Integer.MAX_VALUE < sz) { if (Integer.MAX_VALUE < sz) {
throw new CorruptObjectException(MessageFormat.format(JGitText.get().DIRCExtensionIsTooLargeAt throw new CorruptObjectException(MessageFormat.format(
, formatExtensionName(hdr), sz)); JGitText.get().DIRCExtensionIsTooLargeAt,
formatExtensionName(hdr), Long.valueOf(sz)));
} }
final byte[] raw = new byte[(int) sz]; final byte[] raw = new byte[(int) sz];
IO.readFully(in, raw, 0, raw.length); IO.readFully(in, raw, 0, raw.length);
@ -474,8 +476,10 @@ private void skipOptionalExtension(final InputStream in,
while (0 < sz) { while (0 < sz) {
int n = in.read(b, 0, (int) Math.min(b.length, sz)); int n = in.read(b, 0, (int) Math.min(b.length, sz));
if (n < 0) { if (n < 0) {
throw new EOFException(MessageFormat.format(JGitText.get().shortReadOfOptionalDIRCExtensionExpectedAnotherBytes throw new EOFException(
, formatExtensionName(hdr), sz)); MessageFormat.format(
JGitText.get().shortReadOfOptionalDIRCExtensionExpectedAnotherBytes,
formatExtensionName(hdr), Long.valueOf(sz)));
} }
md.update(b, 0, n); md.update(b, 0, n);
sz -= n; sz -= n;

View File

@ -157,7 +157,7 @@ public ExceedsLimit(long limit, long size) {
@Override @Override
public String getMessage() { public String getMessage() {
return MessageFormat.format(JGitText.get().largeObjectExceedsLimit, return MessageFormat.format(JGitText.get().largeObjectExceedsLimit,
getObjectName(), limit, size); getObjectName(), Long.valueOf(limit), Long.valueOf(size));
} }
} }
} }

View File

@ -64,7 +64,7 @@ public class TooLargeObjectInPackException extends IOException {
*/ */
public TooLargeObjectInPackException(long maxObjectSizeLimit) { public TooLargeObjectInPackException(long maxObjectSizeLimit) {
super(MessageFormat.format(JGitText.get().receivePackObjectTooLarge1, super(MessageFormat.format(JGitText.get().receivePackObjectTooLarge1,
maxObjectSizeLimit)); Long.valueOf(maxObjectSizeLimit)));
} }
/** /**
@ -77,6 +77,6 @@ public TooLargeObjectInPackException(long maxObjectSizeLimit) {
public TooLargeObjectInPackException(long objectSize, public TooLargeObjectInPackException(long objectSize,
long maxObjectSizeLimit) { long maxObjectSizeLimit) {
super(MessageFormat.format(JGitText.get().receivePackObjectTooLarge2, super(MessageFormat.format(JGitText.get().receivePackObjectTooLarge2,
objectSize, maxObjectSizeLimit)); Long.valueOf(objectSize), Long.valueOf(maxObjectSizeLimit)));
} }
} }

View File

@ -101,8 +101,10 @@ public static final boolean isId(final String id) {
public static final AbbreviatedObjectId fromString(final byte[] buf, public static final AbbreviatedObjectId fromString(final byte[] buf,
final int offset, final int end) { final int offset, final int end) {
if (end - offset > Constants.OBJECT_ID_STRING_LENGTH) if (end - offset > Constants.OBJECT_ID_STRING_LENGTH)
throw new IllegalArgumentException(MessageFormat.format(JGitText.get().invalidIdLength throw new IllegalArgumentException(MessageFormat.format(
, end - offset, Constants.OBJECT_ID_STRING_LENGTH)); JGitText.get().invalidIdLength,
Integer.valueOf(end - offset),
Integer.valueOf(Constants.OBJECT_ID_STRING_LENGTH)));
return fromHexString(buf, offset, end); return fromHexString(buf, offset, end);
} }

View File

@ -1204,7 +1204,9 @@ private static String readValue(final StringReader in, boolean quote,
value.append('"'); value.append('"');
continue; continue;
default: default:
throw new ConfigInvalidException(MessageFormat.format(JGitText.get().badEscape, ((char) c))); throw new ConfigInvalidException(MessageFormat.format(
JGitText.get().badEscape,
Character.valueOf(((char) c))));
} }
} }

View File

@ -375,7 +375,8 @@ public static String typeString(final int typeCode) {
case OBJ_TAG: case OBJ_TAG:
return TYPE_TAG; return TYPE_TAG;
default: 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 static byte[] encodedTypeString(final int typeCode) {
case OBJ_TAG: case OBJ_TAG:
return ENCODED_TYPE_TAG; return ENCODED_TYPE_TAG;
default: default:
throw new IllegalArgumentException(MessageFormat.format(JGitText.get().badObjectType, typeCode)); throw new IllegalArgumentException(MessageFormat.format(
JGitText.get().badObjectType, Integer.valueOf(typeCode)));
} }
} }

View File

@ -127,7 +127,8 @@ public void check(final int objType, final byte[] raw)
break; break;
default: default:
throw new CorruptObjectException(MessageFormat.format( throw new CorruptObjectException(MessageFormat.format(
JGitText.get().corruptObjectInvalidType2, objType)); JGitText.get().corruptObjectInvalidType2,
Integer.valueOf(objType)));
} }
} }

View File

@ -186,13 +186,17 @@ int parseBody(final Patch script, final int end) {
if (cmp < o.lineCount) { if (cmp < o.lineCount) {
final int missingCnt = o.lineCount - cmp; final int missingCnt = o.lineCount - cmp;
script.error(buf, startOffset, MessageFormat.format( 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) { if (nContext + nAdded < newLineCount) {
final int missingCount = newLineCount - (nContext + nAdded); 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; return c;

View File

@ -218,7 +218,9 @@ String getScriptText(Charset[] charsetGuess) {
} }
if (charsetGuess != null && charsetGuess.length != getParentCount() + 1) 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)) { if (trySimpleConversion(charsetGuess)) {
Charset cs = charsetGuess != null ? charsetGuess[0] : null; Charset cs = charsetGuess != null ? charsetGuess[0] : null;

View File

@ -300,12 +300,14 @@ && match(buf, last, Patch.SIG_FOOTER) >= 0) {
if (nContext + old.nDeleted < old.lineCount) { if (nContext + old.nDeleted < old.lineCount) {
final int missingCount = old.lineCount - (nContext + old.nDeleted); final int missingCount = old.lineCount - (nContext + old.nDeleted);
script.error(buf, startOffset, MessageFormat.format( script.error(buf, startOffset, MessageFormat.format(
JGitText.get().truncatedHunkOldLinesMissing, missingCount)); JGitText.get().truncatedHunkOldLinesMissing,
Integer.valueOf(missingCount)));
} else if (nContext + old.nAdded < newLineCount) { } else if (nContext + old.nAdded < newLineCount) {
final int missingCount = newLineCount - (nContext + old.nAdded); final int missingCount = newLineCount - (nContext + old.nAdded);
script.error(buf, startOffset, MessageFormat.format( script.error(buf, startOffset, MessageFormat.format(
JGitText.get().truncatedHunkNewLinesMissing, missingCount)); JGitText.get().truncatedHunkNewLinesMissing,
Integer.valueOf(missingCount)));
} else if (nContext + old.nDeleted > old.lineCount } else if (nContext + old.nDeleted > old.lineCount
|| nContext + old.nAdded > newLineCount) { || nContext + old.nAdded > newLineCount) {

View File

@ -231,7 +231,7 @@ private void handleBlockedLanes(final int index,
} }
if (newPos == -1) if (newPos == -1)
newPos = positionsAllocated++; newPos = positionsAllocated++;
freePositions.add(commit.lane.getPosition()); freePositions.add(Integer.valueOf(commit.lane.getPosition()));
activeLanes.remove(commit.lane); activeLanes.remove(commit.lane);
commit.lane.position = newPos; commit.lane.position = newPos;
activeLanes.add(commit.lane); activeLanes.add(commit.lane);

View File

@ -351,7 +351,8 @@ public RevObject nextObject() throws MissingObjectException,
default: default:
throw new CorruptObjectException(MessageFormat.format( throw new CorruptObjectException(MessageFormat.format(
JGitText.get().corruptObjectInvalidMode3, JGitText.get().corruptObjectInvalidMode3,
String.format("%o", mode), idBuffer.name(), String.format("%o", Integer.valueOf(mode)),
idBuffer.name(),
RawParseUtils.decode(buf, tv.namePtr, tv.nameEnd), RawParseUtils.decode(buf, tv.namePtr, tv.nameEnd),
tv.obj)); tv.obj));
} }
@ -702,9 +703,10 @@ private void markTreeUninteresting(final RevTree tree)
default: default:
idBuffer.fromRaw(raw, ptr); idBuffer.fromRaw(raw, ptr);
throw new CorruptObjectException(MessageFormat.format(JGitText throw new CorruptObjectException(MessageFormat.format(
.get().corruptObjectInvalidMode3, String.format("%o", JGitText.get().corruptObjectInvalidMode3,
mode), idBuffer.name(), "", tree)); String.format("%o", Integer.valueOf(mode)),
idBuffer.name(), "", tree));
} }
ptr += ID_SZ; ptr += ID_SZ;
} }

View File

@ -80,7 +80,9 @@ public RevObjectList() {
public void add(final int index, final E element) { public void add(final int index, final E element) {
if (index != size) 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); set(index, element);
size++; size++;
} }

View File

@ -682,7 +682,8 @@ public RevObject lookupAny(final AnyObjectId id, final int type) {
r = new RevTag(id); r = new RevTag(id);
break; break;
default: default:
throw new IllegalArgumentException(MessageFormat.format(JGitText.get().invalidGitType, type)); throw new IllegalArgumentException(MessageFormat.format(
JGitText.get().invalidGitType, Integer.valueOf(type)));
} }
objects.add(r); objects.add(r);
} }
@ -843,8 +844,8 @@ private RevObject parseNew(AnyObjectId id, ObjectLoader ldr)
break; break;
} }
default: default:
throw new IllegalArgumentException(MessageFormat.format(JGitText throw new IllegalArgumentException(MessageFormat.format(
.get().badObjectType, type)); JGitText.get().badObjectType, Integer.valueOf(type)));
} }
objects.add(r); objects.add(r);
return r; return r;
@ -1026,7 +1027,8 @@ public RevFlag newFlag(final String name) {
int allocFlag() { int allocFlag() {
if (freeFlags == 0) if (freeFlags == 0)
throw new IllegalArgumentException(MessageFormat.format( 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); final int m = Integer.lowestOneBit(freeFlags);
freeFlags &= ~m; freeFlags &= ~m;
return m; return m;

View File

@ -306,7 +306,9 @@ private final byte[] decompress(final long position, final int sz,
} }
if (curs.inflate(this, position, dstbuf, 0) != sz) 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; return dstbuf;
} }
@ -406,7 +408,7 @@ private void copyAsIs2(PackOutputStream out, LocalObjectToPack src,
setCorrupt(src.offset); setCorrupt(src.offset);
throw new CorruptObjectException(MessageFormat.format( throw new CorruptObjectException(MessageFormat.format(
JGitText.get().objectAtHasBadZlibStream, JGitText.get().objectAtHasBadZlibStream,
src.offset, getPackFile())); Long.valueOf(src.offset), getPackFile()));
} }
} else if (validate) { } else if (validate) {
// We don't have a CRC32 code in the index, so compute it // We don't have a CRC32 code in the index, so compute it
@ -435,7 +437,7 @@ private void copyAsIs2(PackOutputStream out, LocalObjectToPack src,
setCorrupt(src.offset); setCorrupt(src.offset);
throw new EOFException(MessageFormat.format( throw new EOFException(MessageFormat.format(
JGitText.get().shortCompressedStreamAt, JGitText.get().shortCompressedStreamAt,
src.offset)); Long.valueOf(src.offset)));
} }
expectedCRC = crc1.getValue(); expectedCRC = crc1.getValue();
} else { } else {
@ -447,7 +449,7 @@ private void copyAsIs2(PackOutputStream out, LocalObjectToPack src,
CorruptObjectException corruptObject = new CorruptObjectException( CorruptObjectException corruptObject = new CorruptObjectException(
MessageFormat.format( MessageFormat.format(
JGitText.get().objectAtHasBadZlibStream, JGitText.get().objectAtHasBadZlibStream,
src.offset, getPackFile())); Long.valueOf(src.offset), getPackFile()));
corruptObject.initCause(dataFormat); corruptObject.initCause(dataFormat);
StoredObjectRepresentationNotAvailableException gone; StoredObjectRepresentationNotAvailableException gone;
@ -503,9 +505,9 @@ private void copyAsIs2(PackOutputStream out, LocalObjectToPack src,
cnt -= n; cnt -= n;
} }
if (validate && crc2.getValue() != expectedCRC) { if (validate && crc2.getValue() != expectedCRC) {
throw new CorruptObjectException(MessageFormat.format(JGitText throw new CorruptObjectException(MessageFormat.format(
.get().objectAtHasBadZlibStream, src.offset, JGitText.get().objectAtHasBadZlibStream,
getPackFile())); Long.valueOf(src.offset), getPackFile()));
} }
} }
} }
@ -650,11 +652,14 @@ private void onOpenPack() throws IOException {
final long vers = NB.decodeUInt32(buf, 4); final long vers = NB.decodeUInt32(buf, 4);
final long packCnt = NB.decodeUInt32(buf, 8); final long packCnt = NB.decodeUInt32(buf, 8);
if (vers != 2 && vers != 3) 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()) if (packCnt != idx.getObjectCount())
throw new PackMismatchException(MessageFormat.format( 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.seek(length - 20);
fd.readFully(buf, 0, 20); fd.readFully(buf, 0, 20);
@ -753,7 +758,8 @@ ObjectLoader load(final WindowCursor curs, long pos)
default: default:
throw new IOException(MessageFormat.format( throw new IOException(MessageFormat.format(
JGitText.get().unknownObjectType, typeCode)); JGitText.get().unknownObjectType,
Integer.valueOf(typeCode)));
} }
} }
@ -801,8 +807,8 @@ else if (delta.next == null)
} catch (DataFormatException dfe) { } catch (DataFormatException dfe) {
CorruptObjectException coe = new CorruptObjectException( CorruptObjectException coe = new CorruptObjectException(
MessageFormat.format( MessageFormat.format(
JGitText.get().objectAtHasBadZlibStream, pos, JGitText.get().objectAtHasBadZlibStream,
getPackFile())); Long.valueOf(pos), getPackFile()));
coe.initCause(dfe); coe.initCause(dfe);
throw coe; throw coe;
} }
@ -906,8 +912,9 @@ int getObjectType(final WindowCursor curs, long pos) throws IOException {
} }
default: default:
throw new IOException(MessageFormat.format( throw new IOException(
JGitText.get().unknownObjectType, type)); MessageFormat.format(JGitText.get().unknownObjectType,
Integer.valueOf(type)));
} }
} }
} }
@ -954,14 +961,15 @@ long getObjectSize(final WindowCursor curs, final long pos)
default: default:
throw new IOException(MessageFormat.format( throw new IOException(MessageFormat.format(
JGitText.get().unknownObjectType, type)); JGitText.get().unknownObjectType, Integer.valueOf(type)));
} }
try { try {
return BinaryDelta.getResultSize(getDeltaHeader(curs, deltaAt)); return BinaryDelta.getResultSize(getDeltaHeader(curs, deltaAt));
} catch (DataFormatException e) { } catch (DataFormatException e) {
throw new CorruptObjectException(MessageFormat.format(JGitText throw new CorruptObjectException(MessageFormat.format(
.get().objectAtHasBadZlibStream, pos, getPackFile())); JGitText.get().objectAtHasBadZlibStream, Long.valueOf(pos),
getPackFile()));
} }
} }
@ -1009,8 +1017,9 @@ LocalObjectRepresentation representation(final WindowCursor curs,
} }
default: default:
throw new IOException(MessageFormat.format( throw new IOException(
JGitText.get().unknownObjectType, typeCode)); MessageFormat.format(JGitText.get().unknownObjectType,
Integer.valueOf(typeCode)));
} }
} }

View File

@ -136,7 +136,9 @@ public static PackIndex read(InputStream fd) throws IOException,
case 2: case 2:
return new PackIndexV2(fd); return new PackIndexV2(fd);
default: 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); return new PackIndexV1(fd, hdr);

View File

@ -137,7 +137,8 @@ public static PackIndexWriter createVersion(final OutputStream dst,
return new PackIndexWriterV2(dst); return new PackIndexWriterV2(dst);
default: default:
throw new IllegalArgumentException(MessageFormat.format( throw new IllegalArgumentException(MessageFormat.format(
JGitText.get().unsupportedPackIndexVersion, version)); JGitText.get().unsupportedPackIndexVersion,
Integer.valueOf(version)));
} }
} }

View File

@ -169,9 +169,10 @@ public long findNextOffset(final long offset, final long maxOffset)
if (offset <= Integer.MAX_VALUE) { if (offset <= Integer.MAX_VALUE) {
final int i32 = Arrays.binarySearch(offsets32, (int) offset); final int i32 = Arrays.binarySearch(offsets32, (int) offset);
if (i32 < 0) if (i32 < 0)
throw new CorruptObjectException(MessageFormat.format( throw new CorruptObjectException(
JGitText.get().cantFindObjectInReversePackIndexForTheSpecifiedOffset MessageFormat.format(
, offset)); JGitText.get().cantFindObjectInReversePackIndexForTheSpecifiedOffset,
Long.valueOf(offset)));
if (i32 + 1 == offsets32.length) { if (i32 + 1 == offsets32.length) {
if (offsets64.length > 0) if (offsets64.length > 0)
@ -182,9 +183,10 @@ public long findNextOffset(final long offset, final long maxOffset)
} else { } else {
final int i64 = Arrays.binarySearch(offsets64, offset); final int i64 = Arrays.binarySearch(offsets64, offset);
if (i64 < 0) if (i64 < 0)
throw new CorruptObjectException(MessageFormat.format( throw new CorruptObjectException(
JGitText.get().cantFindObjectInReversePackIndexForTheSpecifiedOffset MessageFormat.format(
, offset)); JGitText.get().cantFindObjectInReversePackIndexForTheSpecifiedOffset,
Long.valueOf(offset)));
if (i64 + 1 == offsets64.length) if (i64 + 1 == offsets64.length)
return maxOffset; return maxOffset;

View File

@ -2185,8 +2185,8 @@ public double getTransferRate() {
/** @return formatted message string for display to clients. */ /** @return formatted message string for display to clients. */
public String getMessage() { public String getMessage() {
return MessageFormat.format(JGitText.get().packWriterStatistics, // return MessageFormat.format(JGitText.get().packWriterStatistics, //
totalObjects, totalDeltas, // Long.valueOf(totalObjects), Long.valueOf(totalDeltas), //
reusedObjects, reusedDeltas); Long.valueOf(reusedObjects), Long.valueOf(reusedDeltas));
} }
} }

View File

@ -510,8 +510,10 @@ private void putImpl(final String bucket, final String key,
private IOException error(final String action, final String key, private IOException error(final String action, final String key,
final HttpURLConnection c) throws IOException { final HttpURLConnection c) throws IOException {
final IOException err = new IOException(MessageFormat.format(JGitText.get().amazonS3ActionFailed final IOException err = new IOException(MessageFormat.format(
, action, key, HttpSupport.response(c), c.getResponseMessage())); JGitText.get().amazonS3ActionFailed, action, key,
Integer.valueOf(HttpSupport.response(c)),
c.getResponseMessage()));
final InputStream errorStream = c.getErrorStream(); final InputStream errorStream = c.getErrorStream();
if (errorStream == null) if (errorStream == null)
return err; return err;
@ -532,8 +534,9 @@ private IOException error(final String action, final String key,
} }
private IOException maxAttempts(final String action, final String key) { private IOException maxAttempts(final String action, final String key) {
return new IOException(MessageFormat.format(JGitText.get().amazonS3ActionFailedGivingUp return new IOException(MessageFormat.format(
, action, key, maxAttempts)); JGitText.get().amazonS3ActionFailedGivingUp, action, key,
Integer.valueOf(maxAttempts)));
} }
private HttpURLConnection open(final String method, final String bucket, private HttpURLConnection open(final String method, final String bucket,

View File

@ -181,7 +181,9 @@ protected void doPush(final ProgressMonitor monitor,
// //
int b = in.read(); int b = in.read();
if (0 <= b) 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) { } catch (TransportException e) {

View File

@ -506,17 +506,17 @@ public PackLock parse(ProgressMonitor receiving, ProgressMonitor resolving)
resolveDeltas(resolving); resolveDeltas(resolving);
if (entryCount < objectCount) { if (entryCount < objectCount) {
if (!isAllowThin()) { if (!isAllowThin()) {
throw new IOException(MessageFormat.format(JGitText throw new IOException(MessageFormat.format(
.get().packHasUnresolvedDeltas, JGitText.get().packHasUnresolvedDeltas,
(objectCount - entryCount))); Long.valueOf(objectCount - entryCount)));
} }
resolveDeltasWithExternalBases(resolving); resolveDeltasWithExternalBases(resolving);
if (entryCount < objectCount) { if (entryCount < objectCount) {
throw new IOException(MessageFormat.format(JGitText throw new IOException(MessageFormat.format(
.get().packHasUnresolvedDeltas, JGitText.get().packHasUnresolvedDeltas,
(objectCount - entryCount))); Long.valueOf(objectCount - entryCount)));
} }
} }
resolving.endTask(); resolving.endTask();
@ -573,13 +573,14 @@ private void resolveDeltas(final PackedObjectInfo oe,
break; break;
default: default:
throw new IOException(MessageFormat.format( throw new IOException(MessageFormat.format(
JGitText.get().unknownObjectType, info.type)); JGitText.get().unknownObjectType,
Integer.valueOf(info.type)));
} }
if (!checkCRC(oe.getCRC())) { if (!checkCRC(oe.getCRC())) {
throw new IOException(MessageFormat.format( throw new IOException(MessageFormat.format(
JGitText.get().corruptionDetectedReReadingAt, oe JGitText.get().corruptionDetectedReReadingAt,
.getOffset())); Long.valueOf(oe.getOffset())));
} }
resolveDeltas(visit.next(), info.type, info, progress); resolveDeltas(visit.next(), info.type, info, progress);
@ -598,7 +599,8 @@ private void resolveDeltas(DeltaVisit visit, final int type,
default: default:
throw new IOException(MessageFormat.format( throw new IOException(MessageFormat.format(
JGitText.get().unknownObjectType, info.type)); JGitText.get().unknownObjectType,
Integer.valueOf(info.type)));
} }
byte[] delta = inflateAndReturn(Source.DATABASE, info.size); byte[] delta = inflateAndReturn(Source.DATABASE, info.size);
@ -610,7 +612,7 @@ private void resolveDeltas(DeltaVisit visit, final int type,
if (!checkCRC(visit.delta.crc)) if (!checkCRC(visit.delta.crc))
throw new IOException(MessageFormat.format( throw new IOException(MessageFormat.format(
JGitText.get().corruptionDetectedReReadingAt, JGitText.get().corruptionDetectedReReadingAt,
visit.delta.position)); Long.valueOf(visit.delta.position)));
objectDigest.update(Constants.encodedTypeString(type)); objectDigest.update(Constants.encodedTypeString(type));
objectDigest.update((byte) ' '); objectDigest.update((byte) ' ');
@ -649,7 +651,8 @@ private final void checkIfTooLarge(int typeCode, long size)
default: default:
throw new IOException(MessageFormat.format( throw new IOException(MessageFormat.format(
JGitText.get().unknownObjectType, typeCode)); JGitText.get().unknownObjectType,
Integer.valueOf(typeCode)));
} }
} }
@ -713,7 +716,8 @@ protected ObjectTypeAndSize readObjectHeader(ObjectTypeAndSize info)
default: default:
throw new IOException(MessageFormat.format( throw new IOException(MessageFormat.format(
JGitText.get().unknownObjectType, info.type)); JGitText.get().unknownObjectType,
Integer.valueOf(info.type)));
} }
return info; return info;
} }
@ -831,7 +835,7 @@ private void readPackHeader() throws IOException {
final long vers = NB.decodeUInt32(buf, p + 4); final long vers = NB.decodeUInt32(buf, p + 4);
if (vers != 2 && vers != 3) if (vers != 2 && vers != 3)
throw new IOException(MessageFormat.format( throw new IOException(MessageFormat.format(
JGitText.get().unsupportedPackVersion, vers)); JGitText.get().unsupportedPackVersion, Long.valueOf(vers)));
objectCount = NB.decodeUInt32(buf, p + 8); objectCount = NB.decodeUInt32(buf, p + 8);
use(hdrln); use(hdrln);
@ -952,8 +956,9 @@ private void indexOneObject() throws IOException {
} }
default: default:
throw new IOException(MessageFormat.format( throw new IOException(
JGitText.get().unknownObjectType, typeCode)); MessageFormat.format(JGitText.get().unknownObjectType,
Integer.valueOf(typeCode)));
} }
} }
@ -1038,7 +1043,8 @@ private void doDeferredCheckBlobs() throws IOException {
if (info.type != Constants.OBJ_BLOB) if (info.type != Constants.OBJ_BLOB)
throw new IOException(MessageFormat.format( 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(); ObjectStream cur = readCurs.open(obj, info.type).openStream();
try { try {

View File

@ -172,7 +172,9 @@ private void needDataPacket() throws IOException {
eof = true; eof = true;
throw new TransportException(PFX_REMOTE + readString(available)); throw new TransportException(PFX_REMOTE + readString(available));
default: default:
throw new PackProtocolException(MessageFormat.format(JGitText.get().invalidChannel, channel)); throw new PackProtocolException(
MessageFormat.format(JGitText.get().invalidChannel,
Integer.valueOf(channel)));
} }
} }
} }

View File

@ -102,11 +102,17 @@ public class SideBandOutputStream extends OutputStream {
*/ */
public SideBandOutputStream(final int chan, final int sz, final OutputStream os) { public SideBandOutputStream(final int chan, final int sz, final OutputStream os) {
if (chan <= 0 || chan > 255) 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) 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) 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; out = os;
buffer = new byte[sz]; buffer = new byte[sz];

View File

@ -344,7 +344,8 @@ private FetchConnection newDumbConnection(InputStream in)
default: default:
throw new TransportException(uri, MessageFormat.format( throw new TransportException(uri, MessageFormat.format(
JGitText.get().cannotReadHEAD, status, conn.getResponseMessage())); JGitText.get().cannotReadHEAD, Integer.valueOf(status),
conn.getResponseMessage()));
} }
} }

View File

@ -242,7 +242,7 @@ Collection<String> getPackNames() throws IOException {
if (!files.containsKey(in)) if (!files.containsKey(in))
continue; continue;
mtimes.put(n, ent.getAttrs().getMTime()); mtimes.put(n, Integer.valueOf(ent.getAttrs().getMTime()));
packs.add(n); packs.add(n);
} }

View File

@ -638,8 +638,10 @@ private void verifyAndInsertLooseObject(final AnyObjectId id,
ObjectId act = inserter.insert(type, raw); ObjectId act = inserter.insert(type, raw);
if (!AnyObjectId.equals(id, act)) { if (!AnyObjectId.equals(id, act)) {
throw new TransportException(MessageFormat.format(JGitText.get().incorrectHashFor throw new TransportException(MessageFormat.format(
, id.name(), act.name(), Constants.typeString(type), compressed.length)); JGitText.get().incorrectHashFor, id.name(), act.name(),
Constants.typeString(type),
Integer.valueOf(compressed.length)));
} }
inserter.flush(); inserter.flush();
} }

View File

@ -284,8 +284,8 @@ public static byte[] decode(byte[] source, int off, int len) {
} else if (sbiDecode != WHITE_SPACE_DEC) } else if (sbiDecode != WHITE_SPACE_DEC)
throw new IllegalArgumentException(MessageFormat.format( throw new IllegalArgumentException(MessageFormat.format(
JGitText.get().badBase64InputCharacterAt, i, JGitText.get().badBase64InputCharacterAt,
source[i] & 0xff)); Integer.valueOf(i), Integer.valueOf(source[i] & 0xff)));
} }
if (outBuff.length == outBuffPosn) if (outBuff.length == outBuffPosn)

View File

@ -117,7 +117,8 @@ public InterruptTimer(final String threadName) {
*/ */
public void begin(final int timeout) { public void begin(final int timeout) {
if (timeout <= 0) 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(); Thread.interrupted();
state.begin(timeout); state.begin(timeout);
} }

View File

@ -83,7 +83,8 @@ public int getTimeout() {
*/ */
public void setTimeout(final int millis) { public void setTimeout(final int millis) {
if (millis < 0) 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; timeout = millis;
} }

View File

@ -84,7 +84,8 @@ public int getTimeout() {
*/ */
public void setTimeout(final int millis) { public void setTimeout(final int millis) {
if (millis < 0) 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; timeout = millis;
} }