DirCache: Fix bad code formatting

Line breaking before , is ugly to read.  Most formatters and humans
expect line break after , so update a few offensive locations.

Use String.format() for the construction of the error message when
a bad DirCachEntry is being failed on. This simplifies the code and
its not a performance critical section.

Change-Id: I5d990389e7ba24ef0861cf8ec0026ed030d4aeda
This commit is contained in:
Shawn Pearce 2015-11-28 09:21:31 -08:00
parent 761814fe9c
commit 45cc76524b
2 changed files with 9 additions and 8 deletions

View File

@ -102,8 +102,9 @@ protected DirCacheBuilder(final DirCache dc, final int ecnt) {
*/ */
public void add(final DirCacheEntry newEntry) { public void add(final DirCacheEntry newEntry) {
if (newEntry.getRawMode() == 0) if (newEntry.getRawMode() == 0)
throw new IllegalArgumentException(MessageFormat.format(JGitText.get().fileModeNotSetForPath throw new IllegalArgumentException(MessageFormat.format(
, newEntry.getPathString())); JGitText.get().fileModeNotSetForPath,
newEntry.getPathString()));
beforeAdd(newEntry); beforeAdd(newEntry);
fastAdd(newEntry); fastAdd(newEntry);
} }
@ -242,9 +243,9 @@ private void resort() {
sorted = true; sorted = true;
} }
private static IllegalStateException bad(final DirCacheEntry a, private static IllegalStateException bad(DirCacheEntry a, String msg) {
final String msg) { return new IllegalStateException(String.format(
return new IllegalStateException(msg + ": " + a.getStage() + " " //$NON-NLS-1$ //$NON-NLS-2$ "%s: %d %s", //$NON-NLS-1$
+ a.getPathString()); msg, Integer.valueOf(a.getStage()), a.getPathString()));
} }
} }

View File

@ -499,8 +499,8 @@ public void setFileMode(final FileMode mode) {
switch (mode.getBits() & FileMode.TYPE_MASK) { switch (mode.getBits() & FileMode.TYPE_MASK) {
case FileMode.TYPE_MISSING: case FileMode.TYPE_MISSING:
case FileMode.TYPE_TREE: case FileMode.TYPE_TREE:
throw new IllegalArgumentException(MessageFormat.format(JGitText.get().invalidModeForPath throw new IllegalArgumentException(MessageFormat.format(
, mode, getPathString())); JGitText.get().invalidModeForPath, mode, getPathString()));
} }
NB.encodeInt32(info, infoOffset + P_MODE, mode.getBits()); NB.encodeInt32(info, infoOffset + P_MODE, mode.getBits());
} }