diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/server/http/service/TriggerGCService.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/server/http/service/TriggerGCService.java
index c1e25f55549..d702d545c24 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/server/http/service/TriggerGCService.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/server/http/service/TriggerGCService.java
@@ -66,7 +66,7 @@ public HttpServiceResponse handle(HttpServiceRequest request) throws Exception {
try {
if (HttpServer.Method.PUT == request.getMethod()) {
String requestBody = request.getBody();
- if (StringUtils.isBlank(requestBody)) {
+ if (requestBody == null || StringUtils.isEmpty(requestBody.trim())) {
bookieServer.getBookie().getLedgerStorage().forceGC();
} else {
@SuppressWarnings("unchecked")
diff --git a/bookkeeper-server/src/test/java/org/apache/bookkeeper/server/http/service/TriggerGCServiceTest.java b/bookkeeper-server/src/test/java/org/apache/bookkeeper/server/http/service/TriggerGCServiceTest.java
index 7a07ed59e24..0cef60209e9 100644
--- a/bookkeeper-server/src/test/java/org/apache/bookkeeper/server/http/service/TriggerGCServiceTest.java
+++ b/bookkeeper-server/src/test/java/org/apache/bookkeeper/server/http/service/TriggerGCServiceTest.java
@@ -81,7 +81,7 @@ public void testHandleRequest() throws Exception {
request.setMethod(HttpServer.Method.PUT);
request.setBody("{\"test\":1}");
resp = service.handle(request);
- verify(mockLedgerStorage, times(1)).forceGC(eq(true), eq(true));
+ verify(mockLedgerStorage, times(1)).forceGC(eq(false), eq(false));
assertEquals(HttpServer.StatusCode.OK.getValue(), resp.getStatusCode());
assertEquals("\"Triggered GC on BookieServer: " + mockBookieServer.getBookieId() + "\"",
resp.getBody());
@@ -91,7 +91,7 @@ public void testHandleRequest() throws Exception {
request.setMethod(HttpServer.Method.PUT);
request.setBody("{\"test\":1,\"forceMajor\":true}");
resp = service.handle(request);
- verify(mockLedgerStorage, times(2)).forceGC(eq(true), eq(true));
+ verify(mockLedgerStorage, times(1)).forceGC(eq(true), eq(false));
assertEquals(HttpServer.StatusCode.OK.getValue(), resp.getStatusCode());
assertEquals("\"Triggered GC on BookieServer: " + mockBookieServer.getBookieId() + "\"",
resp.getBody());
@@ -101,7 +101,7 @@ public void testHandleRequest() throws Exception {
request.setMethod(HttpServer.Method.PUT);
request.setBody("{\"test\":1,\"forceMajor\":\"true\"}");
resp = service.handle(request);
- verify(mockLedgerStorage, times(3)).forceGC(eq(true), eq(true));
+ verify(mockLedgerStorage, times(2)).forceGC(eq(true), eq(false));
assertEquals(HttpServer.StatusCode.OK.getValue(), resp.getStatusCode());
assertEquals("\"Triggered GC on BookieServer: " + mockBookieServer.getBookieId() + "\"",
resp.getBody());
@@ -111,7 +111,7 @@ public void testHandleRequest() throws Exception {
request.setMethod(HttpServer.Method.PUT);
request.setBody("{\"test\":1,\"forceMajor\":false}");
resp = service.handle(request);
- verify(mockLedgerStorage, times(1)).forceGC(eq(false), eq(true));
+ verify(mockLedgerStorage, times(2)).forceGC(eq(false), eq(false));
assertEquals(HttpServer.StatusCode.OK.getValue(), resp.getStatusCode());
assertEquals("\"Triggered GC on BookieServer: " + mockBookieServer.getBookieId() + "\"",
resp.getBody());
@@ -121,7 +121,7 @@ public void testHandleRequest() throws Exception {
request.setMethod(HttpServer.Method.PUT);
request.setBody("{\"test\":1,\"forceMinor\":true}");
resp = service.handle(request);
- verify(mockLedgerStorage, times(4)).forceGC(eq(true), eq(true));
+ verify(mockLedgerStorage, times(1)).forceGC(eq(false), eq(true));
assertEquals(HttpServer.StatusCode.OK.getValue(), resp.getStatusCode());
assertEquals("\"Triggered GC on BookieServer: " + mockBookieServer.getBookieId() + "\"",
resp.getBody());
diff --git a/buildtools/src/main/resources/bookkeeper/findbugsExclude.xml b/buildtools/src/main/resources/bookkeeper/findbugsExclude.xml
index 09daf196569..e3e9dfb085c 100644
--- a/buildtools/src/main/resources/bookkeeper/findbugsExclude.xml
+++ b/buildtools/src/main/resources/bookkeeper/findbugsExclude.xml
@@ -327,4 +327,13 @@
+
+
+
+
+
+
+
+
+