From: "Shawn O. Pearce" <spearce@spearce.org>
To: Robin Rosenberg <robin.rosenberg@dewire.com>,
Matthias Sohn <matthias.sohn@sap.com>
Cc: git@vger.kernel.org
Subject: [JGIT PATCH 5/7] FindBugs: Fix use of byte[].toString() in error messages
Date: Mon, 4 May 2009 16:30:46 -0700 [thread overview]
Message-ID: <1241479848-20687-5-git-send-email-spearce@spearce.org> (raw)
In-Reply-To: <1241479848-20687-4-git-send-email-spearce@spearce.org>
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@spearce.org>
---
.../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
next prev parent reply other threads:[~2009-05-04 23:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-04 23:30 [JGIT PATCH 1/7] Fix FindBugs exclude filter to work on UNIX platforms Shawn O. Pearce
2009-05-04 23:30 ` [JGIT PATCH 2/7] Silence FindBugs "dubious use of GC" in PackFile.mmap Shawn O. Pearce
2009-05-04 23:30 ` [JGIT PATCH 3/7] Fix FindBugs String == is bad form Shawn O. Pearce
2009-05-04 23:30 ` [JGIT PATCH 4/7] Fix FindBugs load known null value Shawn O. Pearce
2009-05-04 23:30 ` Shawn O. Pearce [this message]
2009-05-04 23:30 ` [JGIT PATCH 6/7] Make TransportLocal.StreamRewritingThread static Shawn O. Pearce
2009-05-04 23:30 ` [JGIT PATCH 7/7] FindBugs: Disable clone() idiom tests Shawn O. Pearce
2009-05-06 11:18 ` [JGIT PATCH 1/7] Fix FindBugs exclude filter to work on UNIX platforms Sohn, Matthias
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1241479848-20687-5-git-send-email-spearce@spearce.org \
--to=spearce@spearce.org \
--cc=git@vger.kernel.org \
--cc=matthias.sohn@sap.com \
--cc=robin.rosenberg@dewire.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).