aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorMasaya Suzuki <masayasuzuki@google.com>2019-11-07 17:15:57 -0800
committerMasaya Suzuki <masayasuzuki@google.com>2019-12-02 12:25:03 -0800
commit6bc366576438be839fb6bd95b5fb5dfcb9306846 (patch)
treedef2a01ad7427223df753777e6e6b6bd1ddbb933 /org.eclipse.jgit
parent853098e13eb82ff3c055da128d86ee2871c77a1a (diff)
downloadjgit-6bc366576438be839fb6bd95b5fb5dfcb9306846.tar.gz
jgit-6bc366576438be839fb6bd95b5fb5dfcb9306846.zip
transport: Move handling code to the caller side
This removes a raw IOException at one level. Later we'll add a custom exception handling mechanism like UploadPack. Change-Id: I52a7423798c97b032d848351be8b6f144776b017 Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java21
1 files changed, 12 insertions, 9 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java
index 16fbbd42f3..c92c370a02 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java
@@ -1217,8 +1217,13 @@ public class ReceivePack {
*
* @throws java.io.IOException
* an error occurred during unpacking or connectivity checking.
+ * @throws LargeObjectException
+ * an large object needs to be opened for the check.
+ * @throws SubmoduleValidationException
+ * fails to validate the submodule.
*/
- protected void receivePackAndCheckConnectivity() throws IOException {
+ protected void receivePackAndCheckConnectivity() throws IOException,
+ LargeObjectException, SubmoduleValidationException {
receivePack();
if (needCheckConnectivity()) {
checkSubmodules();
@@ -1535,7 +1540,8 @@ public class ReceivePack {
|| !getClientShallowCommits().isEmpty();
}
- private void checkSubmodules() throws IOException {
+ private void checkSubmodules() throws IOException, LargeObjectException,
+ SubmoduleValidationException {
ObjectDatabase odb = db.getObjectDatabase();
if (objectChecker == null) {
return;
@@ -1544,12 +1550,8 @@ public class ReceivePack {
AnyObjectId blobId = entry.getBlobId();
ObjectLoader blob = odb.open(blobId, Constants.OBJ_BLOB);
- try {
- SubmoduleValidator.assertValidGitModulesFile(
- new String(blob.getBytes(), UTF_8));
- } catch (LargeObjectException | SubmoduleValidationException e) {
- throw new IOException(e);
- }
+ SubmoduleValidator.assertValidGitModulesFile(
+ new String(blob.getBytes(), UTF_8));
}
}
@@ -2184,7 +2186,8 @@ public class ReceivePack {
if (needPack()) {
try {
receivePackAndCheckConnectivity();
- } catch (IOException | RuntimeException | Error err) {
+ } catch (IOException | RuntimeException
+ | SubmoduleValidationException | Error err) {
unpackError = err;
}
}