Don't double wrap ServiceMayNotContinueExceptions

ServiceMayNotContinueException is an IOException, and should just be
re-raised in situations that need to throw a
ServiceMayNotContinueException.

Also, do not set the message on ServiceMayNotContinueException, since it
may be returned to the client.

Change-Id: I382be1ccb2b1dca50328951239ff27c20f79d0d1
This commit is contained in:
Colby Ranger
2013-10-31 08:26:53 -07:00
parent 93d6838485
commit 7dbfce878d
3 changed files with 9 additions and 6 deletions

View File

@@ -404,9 +404,10 @@ public class ReceiveCommits {
if (allRefs == null) {
try {
allRefs = rp.getRepository().getRefDatabase().getRefs(ALL);
} catch (ServiceMayNotContinueException e) {
throw e;
} catch (IOException e) {
ServiceMayNotContinueException ex =
new ServiceMayNotContinueException(e.getMessage());
ServiceMayNotContinueException ex = new ServiceMayNotContinueException();
ex.initCause(e);
throw ex;
}

View File

@@ -68,9 +68,10 @@ public class ReceiveCommitsAdvertiseRefsHook implements AdvertiseRefsHook {
if (oldRefs == null) {
try {
oldRefs = rp.getRepository().getRefDatabase().getRefs(ALL);
} catch (ServiceMayNotContinueException e) {
throw e;
} catch (IOException e) {
ServiceMayNotContinueException ex =
new ServiceMayNotContinueException(e.getMessage());
ServiceMayNotContinueException ex = new ServiceMayNotContinueException();
ex.initCause(e);
throw ex;
}

View File

@@ -127,9 +127,10 @@ public class VisibleRefFilter extends AbstractAdvertiseRefsHook {
RevWalk revWalk) throws ServiceMayNotContinueException {
try {
return filter(repository.getRefDatabase().getRefs(RefDatabase.ALL));
} catch (ServiceMayNotContinueException e) {
throw e;
} catch (IOException e) {
ServiceMayNotContinueException ex =
new ServiceMayNotContinueException(e.getMessage());
ServiceMayNotContinueException ex = new ServiceMayNotContinueException();
ex.initCause(e);
throw ex;
}