[JGIT PATCH 5/7] FindBugs: Fix use of byte[].toString() in error messages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We meant to use typeString here, not encodedTypeString, as we want
a human-readable string form of the object type for display into
an exception message.  FindBugs caught us using a byte[] here and
not a string, resulting in a useless portion of the message text.

Signed-off-by: Shawn O. Pearce <spearce@xxxxxxxxxxx>
---
 .../src/org/spearce/jgit/transport/IndexPack.java  |    2 +-
 .../jgit/transport/WalkFetchConnection.java        |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/IndexPack.java b/org.spearce.jgit/src/org/spearce/jgit/transport/IndexPack.java
index 7881124..b2bcbb7 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/transport/IndexPack.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/transport/IndexPack.java
@@ -744,7 +744,7 @@ private void verifySafeObject(final AnyObjectId id, final int type,
 				objCheck.check(type, data);
 			} catch (CorruptObjectException e) {
 				throw new IOException("Invalid "
-						+ Constants.encodedTypeString(type) + " " + id.name()
+						+ Constants.typeString(type) + " " + id.name()
 						+ ":" + e.getMessage());
 			}
 		}
diff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/WalkFetchConnection.java b/org.spearce.jgit/src/org/spearce/jgit/transport/WalkFetchConnection.java
index 06b2c87..4d14305 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/transport/WalkFetchConnection.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/transport/WalkFetchConnection.java
@@ -602,7 +602,7 @@ private void verifyLooseObject(final AnyObjectId id, final byte[] compressed)
 		if (!AnyObjectId.equals(id, idBuffer)) {
 			throw new TransportException("Incorrect hash for " + id.name()
 					+ "; computed " + idBuffer.name() + " as a "
-					+ Constants.encodedTypeString(uol.getType()) + " from "
+					+ Constants.typeString(uol.getType()) + " from "
 					+ compressed.length + " bytes.");
 		}
 		if (objCheck != null) {
@@ -610,7 +610,7 @@ private void verifyLooseObject(final AnyObjectId id, final byte[] compressed)
 				objCheck.check(uol.getType(), uol.getCachedBytes());
 			} catch (CorruptObjectException e) {
 				throw new TransportException("Invalid "
-						+ Constants.encodedTypeString(uol.getType()) + " "
+						+ Constants.typeString(uol.getType()) + " "
 						+ id.name() + ":" + e.getMessage());
 			}
 		}
-- 
1.6.3.rc4.206.g03e16

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]