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:
@@ -404,9 +404,10 @@ public class ReceiveCommits {
|
|||||||
if (allRefs == null) {
|
if (allRefs == null) {
|
||||||
try {
|
try {
|
||||||
allRefs = rp.getRepository().getRefDatabase().getRefs(ALL);
|
allRefs = rp.getRepository().getRefDatabase().getRefs(ALL);
|
||||||
|
} catch (ServiceMayNotContinueException e) {
|
||||||
|
throw e;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
ServiceMayNotContinueException ex =
|
ServiceMayNotContinueException ex = new ServiceMayNotContinueException();
|
||||||
new ServiceMayNotContinueException(e.getMessage());
|
|
||||||
ex.initCause(e);
|
ex.initCause(e);
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
|
@@ -68,9 +68,10 @@ public class ReceiveCommitsAdvertiseRefsHook implements AdvertiseRefsHook {
|
|||||||
if (oldRefs == null) {
|
if (oldRefs == null) {
|
||||||
try {
|
try {
|
||||||
oldRefs = rp.getRepository().getRefDatabase().getRefs(ALL);
|
oldRefs = rp.getRepository().getRefDatabase().getRefs(ALL);
|
||||||
|
} catch (ServiceMayNotContinueException e) {
|
||||||
|
throw e;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
ServiceMayNotContinueException ex =
|
ServiceMayNotContinueException ex = new ServiceMayNotContinueException();
|
||||||
new ServiceMayNotContinueException(e.getMessage());
|
|
||||||
ex.initCause(e);
|
ex.initCause(e);
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
|
@@ -127,9 +127,10 @@ public class VisibleRefFilter extends AbstractAdvertiseRefsHook {
|
|||||||
RevWalk revWalk) throws ServiceMayNotContinueException {
|
RevWalk revWalk) throws ServiceMayNotContinueException {
|
||||||
try {
|
try {
|
||||||
return filter(repository.getRefDatabase().getRefs(RefDatabase.ALL));
|
return filter(repository.getRefDatabase().getRefs(RefDatabase.ALL));
|
||||||
|
} catch (ServiceMayNotContinueException e) {
|
||||||
|
throw e;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
ServiceMayNotContinueException ex =
|
ServiceMayNotContinueException ex = new ServiceMayNotContinueException();
|
||||||
new ServiceMayNotContinueException(e.getMessage());
|
|
||||||
ex.initCause(e);
|
ex.initCause(e);
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user