git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Constantine Plotnikov <constantine.plotnikov@gmail.com>
To: git@vger.kernel.org
Cc: Constantine Plotnikov <constantine.plotnikov@gmail.com>
Subject: [JGIT PATCH] BlobBasedConfig now does not print stacktrace to stderr if blob is not found by path
Date: Wed,  1 Jul 2009 21:25:22 +0400	[thread overview]
Message-ID: <1246469122-5108-1-git-send-email-constantine.plotnikov@gmail.com> (raw)

Prior to this patch, if the blob is not found inside commit by path,
an exception stack trace was printed to stderr. This patch suppress
this behavior by throwing FileNotFoundException instead of generic
IOException in order to make it more aligned with FileBasedConfig.

Signed-off-by: Constantine Plotnikov <constantine.plotnikov@gmail.com>
---
 .../src/org/spearce/jgit/lib/BlobBasedConfig.java  |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/BlobBasedConfig.java b/org.spearce.jgit/src/org/spearce/jgit/lib/BlobBasedConfig.java
index 1f44994..8763c6c 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/BlobBasedConfig.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/BlobBasedConfig.java
@@ -37,6 +37,7 @@
 package org.spearce.jgit.lib;
 
 import java.io.ByteArrayInputStream;
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.concurrent.Callable;
@@ -118,7 +119,7 @@ this(base, new Callable<byte[]>() {
 				final Repository r = commit.getRepository();
 				final TreeWalk tree = TreeWalk.forPath(r, path, treeId);
 				if (tree == null) {
-					throw new IOException("Entry not found by path: " + path);
+					throw new FileNotFoundException("Entry not found by path: " + path);
 				}
 				ObjectId blobId = tree.getObjectId(0);
 				ObjectLoader loader = tree.getRepository().openBlob(blobId);
-- 
1.6.1.2

                 reply	other threads:[~2009-07-01 17:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1246469122-5108-1-git-send-email-constantine.plotnikov@gmail.com \
    --to=constantine.plotnikov@gmail.com \
    --cc=git@vger.kernel.org \
    /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).