Skip to content

Commit

Permalink
GEODE-7864: Fix most "Statement has empty body" IDE warnings
Browse files Browse the repository at this point in the history
Authored-by: Donal Evans <doevans@vmware.com>
  • Loading branch information
DonalEvans committed Aug 11, 2020
1 parent 0e31dd1 commit c006392
Show file tree
Hide file tree
Showing 91 changed files with 523 additions and 810 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1097,9 +1097,8 @@ private List<Cookie> getCookies(HttpTester.Response response) {
c.setPath(value);
} else if ("secure".equalsIgnoreCase(param)) {
c.setSecure(true);
} else if ("httponly".equalsIgnoreCase(param)) {
// Ignored??
} else {
// Ignore the case where param == "httponly"?
} else if (!"httponly".equalsIgnoreCase(param)) {
if (c == null) {
c = new Cookie(param, value);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ public boolean isStarted() {
public void close() {
getCache().close();
while (!getCache().isClosed()) {
// Intentionally empty block
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,9 @@ public static void validateJavaStartupParameters(GemFireCache cache) {
if (vmVendor.startsWith("Sun") || vmVendor.startsWith("Apple")) {
// java.vm.vendor = Sun Microsystems Inc. || java.vm.vendor = Apple Inc.
validateSunArguments(cache, rm, inputArguments);
} else if (vmVendor.startsWith("IBM")) {
// java.vm.vendor = IBM Corporation
// TODO validate IBM input arguments
} else if (vmVendor.startsWith("BEA")) {
// java.vm.vendor = BEA Systems, Inc.
// TODO validate JRockit input arguments
}
// TODO validate IBM input arguments (vmVendor.startsWith("IBM"))
// TODO validate JRockit input arguments (vmVendor.startsWith("BEA"))
}

private static void validateSunArguments(GemFireCache cache, ResourceManager rm,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,17 @@ public class AddFreeItemToOrders implements Function {
@Override
public void execute(FunctionContext context) {
Region region = null;
List<Object> vals = new ArrayList<Object>();
List<Object> keys = new ArrayList<Object>();
List<Object> argsList = new ArrayList<Object>();
Object[] argsArray = null;
List<Object> vals = new ArrayList<>();
List<Object> keys = new ArrayList<>();
List<Object> argsList = new ArrayList<>();
Object[] argsArray;

if (context.getArguments() instanceof Boolean) {

} else if (context.getArguments() instanceof String) {
String arg = (String) context.getArguments();
} else if (context.getArguments() instanceof Vector) {

} else if (context.getArguments() instanceof Object[]) {
if (context.getArguments() instanceof Object[]) {
argsArray = (Object[]) context.getArguments();
argsList = Arrays.asList(argsArray);
} else {
} else if (!((context.getArguments() instanceof Boolean)
|| (context.getArguments() instanceof Vector)
|| (context.getArguments() instanceof String))) {
System.out.println("AddFreeItemToOrders : Invalid Arguments");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3062,9 +3062,7 @@ public Object call() throws Exception {
assertEquals(5, sr.size());
if (i == 1) {
for (Object o : sr) {
if (o == null) {
} else if (o instanceof String) {
} else {
if (o != null && !(o instanceof String)) {
fail("Result should be either null or String and not " + o.getClass());
}
}
Expand Down Expand Up @@ -3095,9 +3093,7 @@ public Object call() throws Exception {
assertEquals(5, sr.size());
if (i == 1) {
for (Object o : sr) {
if (o == null) {
} else if (o instanceof String) {
} else {
if (o != null && !(o instanceof String)) {
fail("Result should be either null or String and not " + o.getClass());
}
}
Expand Down Expand Up @@ -3129,9 +3125,7 @@ public Object call() throws Exception {
assertEquals(5, sr.size());
if (i == 1) {
for (Object o : sr) {
if (o == null) {
} else if (o instanceof String) {
} else {
if (o != null && !(o instanceof String)) {
fail("Result should be either null or String and not " + o.getClass());
}
}
Expand Down Expand Up @@ -3302,9 +3296,7 @@ public Object call() throws Exception {
assertEquals(5, sr.size());
if (i == 1) {
for (Object o : sr) {
if (o == null) {
} else if (o instanceof String) {
} else {
if (o != null && !(o instanceof String)) {
fail("Result should be either null or String and not " + o.getClass());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,14 +320,12 @@ public Object call() throws Exception {
for (Object rs : res) {
if (rs instanceof StructImpl) {
for (Object obj : ((StructImpl) rs).getFieldValues()) {
if (obj instanceof PortfolioPdx || obj instanceof PositionPdx) {
} else {
if (!(obj instanceof PortfolioPdx) && !(obj instanceof PositionPdx)) {
fail("Result objects for remote client query: " + queries[i]
+ " should be instance of PortfolioPdx and not " + obj.getClass());
}
}
} else if (rs instanceof PortfolioPdx) {
} else {
} else if (!(rs instanceof PortfolioPdx)) {
fail("Result objects for remote client query: " + queries[i]
+ " should be instance of PortfolioPdx and not " + rs.getClass());
}
Expand Down Expand Up @@ -377,14 +375,12 @@ public Object call() throws Exception {
for (Object rs : res) {
if (rs instanceof StructImpl) {
for (Object obj : ((StructImpl) rs).getFieldValues()) {
if (obj instanceof PortfolioPdx || obj instanceof PositionPdx) {
} else {
if (!(obj instanceof PortfolioPdx) && !(obj instanceof PositionPdx)) {
fail("Result objects for remote client query: " + queries[i]
+ " should be instance of PortfolioPdx and not " + obj.getClass());
}
}
} else if (rs instanceof PortfolioPdx) {
} else {
} else if (!(rs instanceof PortfolioPdx)) {
fail("Result objects for remote client query: " + queries[i]
+ " should be instance of PortfolioPdx and not " + rs.getClass());
}
Expand Down Expand Up @@ -486,14 +482,12 @@ public Object call() throws Exception {
for (Object rs : res) {
if (rs instanceof StructImpl) {
for (Object obj : ((StructImpl) rs).getFieldValues()) {
if (obj instanceof PortfolioPdx || obj instanceof PositionPdx) {
} else {
if (!(obj instanceof PortfolioPdx) && !(obj instanceof PositionPdx)) {
fail("Result objects for remote client query: " + multipleRegionQueries[i]
+ " should be instance of PortfolioPdx and not " + obj.getClass());
}
}
} else if (rs instanceof PortfolioPdx) {
} else {
} else if (!(rs instanceof PortfolioPdx)) {
fail("Result objects for remote client query: " + multipleRegionQueries[i]
+ " should be instance of PortfolioPdx and not " + rs.getClass());
}
Expand Down Expand Up @@ -545,14 +539,12 @@ public Object call() throws Exception {
for (Object rs : res) {
if (rs instanceof StructImpl) {
for (Object obj : ((StructImpl) rs).getFieldValues()) {
if (obj instanceof PortfolioPdx || obj instanceof PositionPdx) {
} else {
if (!(obj instanceof PortfolioPdx) && !(obj instanceof PositionPdx)) {
fail("Result objects for remote client query: " + multipleRegionQueries[i]
+ " should be instance of PortfolioPdx and not " + obj.getClass());
}
}
} else if (rs instanceof PortfolioPdx) {
} else {
} else if (!(rs instanceof PortfolioPdx)) {
fail("Result objects for remote client query: " + multipleRegionQueries[i]
+ " should be instance of PortfolioPdx and not " + rs.getClass());
}
Expand Down Expand Up @@ -1006,14 +998,12 @@ public Object call() throws Exception {
for (Object rs : res) {
if (rs instanceof StructImpl) {
for (Object obj : ((StructImpl) rs).getFieldValues()) {
if (obj instanceof PortfolioPdx || obj instanceof PositionPdx) {
} else {
if (!(obj instanceof PortfolioPdx) && !(obj instanceof PositionPdx)) {
fail("Result objects for remote client query: " + multipleRegionQueries[i]
+ " should be instance of PortfolioPdx and not " + obj.getClass());
}
}
} else if (rs instanceof PortfolioPdx) {
} else {
} else if (!(rs instanceof PortfolioPdx)) {
fail("Result objects for remote client query: " + multipleRegionQueries[i]
+ " should be instance of PortfolioPdx and not " + rs.getClass());
}
Expand Down Expand Up @@ -1076,14 +1066,12 @@ public Object call() throws Exception {
for (Object rs : res) {
if (rs instanceof StructImpl) {
for (Object obj : ((StructImpl) rs).getFieldValues()) {
if (obj instanceof PortfolioPdx || obj instanceof PositionPdx) {
} else {
if (!(obj instanceof PortfolioPdx) && !(obj instanceof PositionPdx)) {
fail("Result objects for remote client query: " + multipleRegionQueries[i]
+ " should be instance of PortfolioPdx and not " + obj.getClass());
}
}
} else if (rs instanceof PortfolioPdx) {
} else {
} else if (!(rs instanceof PortfolioPdx)) {
fail("Result objects for remote client query: " + multipleRegionQueries[i]
+ " should be instance of PortfolioPdx and not " + rs.getClass());
}
Expand Down Expand Up @@ -1174,14 +1162,12 @@ public Object call() throws Exception {
for (Object rs : res) {
if (rs instanceof StructImpl) {
for (Object obj : ((StructImpl) rs).getFieldValues()) {
if (obj instanceof PortfolioPdx || obj instanceof PositionPdx) {
} else {
if (!(obj instanceof PortfolioPdx) && !(obj instanceof PositionPdx)) {
fail("Result objects for remote client query: " + queries[i]
+ " should be instance of PortfolioPdx and not " + obj.getClass());
}
}
} else if (rs instanceof PortfolioPdx) {
} else {
} else if (!(rs instanceof PortfolioPdx)) {
fail("Result objects for remote client query: " + queries[i]
+ " should be instance of PortfolioPdx and not " + rs.getClass());
}
Expand Down Expand Up @@ -1232,14 +1218,12 @@ public Object call() throws Exception {
for (Object rs : res) {
if (rs instanceof StructImpl) {
for (Object obj : ((StructImpl) rs).getFieldValues()) {
if (obj instanceof PortfolioPdx || obj instanceof PositionPdx) {
} else {
if (!(obj instanceof PortfolioPdx) && !(obj instanceof PositionPdx)) {
fail("Result objects for remote client query: " + queries[i]
+ " should be instance of PortfolioPdx and not " + obj.getClass());
}
}
} else if (rs instanceof PortfolioPdx) {
} else {
} else if (!(rs instanceof PortfolioPdx)) {
fail("Result objects for remote client query: " + queries[i]
+ " should be instance of PortfolioPdx and not " + rs.getClass());
}
Expand Down Expand Up @@ -1285,14 +1269,12 @@ public Object call() throws Exception {
for (Object rs : res) {
if (rs instanceof StructImpl) {
for (Object obj : ((StructImpl) rs).getFieldValues()) {
if (obj instanceof PdxInstance) {
} else {
if (!(obj instanceof PdxInstance)) {
fail("Result objects for remote client query: " + queries[i]
+ " should be instance of PdxInstance and not " + obj.getClass());
}
}
} else if (rs instanceof PdxInstance) {
} else {
} else if (!(rs instanceof PdxInstance)) {
fail("Result objects for remote client query: " + queries[i]
+ " should be instance of PdxInstance and not " + rs.getClass());
}
Expand Down Expand Up @@ -1383,16 +1365,13 @@ public Object call() throws Exception {
for (Object rs : res) {
if (rs instanceof StructImpl) {
for (Object obj : ((StructImpl) rs).getFieldValues()) {
if (obj instanceof PortfolioPdx || obj instanceof PositionPdx) {
} else if (obj instanceof PortfolioPdx || obj instanceof PositionPdx) {
} else {
if (!(obj instanceof PortfolioPdx) && !(obj instanceof PositionPdx)) {
fail("Result objects for remote client query: " + queries[i]
+ " should be instance of PortfolioPdx or PortfolioPdx and not "
+ obj.getClass());
}
}
} else if (rs instanceof PortfolioPdx) {
} else {
} else if (!(rs instanceof PortfolioPdx)) {
fail("Result objects for remote client query: " + queries[i]
+ " should be instance of PortfolioPdx and not " + rs.getClass());
}
Expand Down Expand Up @@ -1443,16 +1422,13 @@ public Object call() throws Exception {
for (Object rs : res) {
if (rs instanceof StructImpl) {
for (Object obj : ((StructImpl) rs).getFieldValues()) {
if (obj instanceof PortfolioPdx || obj instanceof PositionPdx) {
} else if (obj instanceof PortfolioPdx || obj instanceof PositionPdx) {
} else {
if (!(obj instanceof PortfolioPdx) && !(obj instanceof PositionPdx)) {
fail("Result objects for remote client query: " + queries[i]
+ " should be instance of PortfolioPdx or PortfolioPdx and not "
+ obj.getClass());
}
}
} else if (rs instanceof PortfolioPdx) {
} else {
} else if (!(rs instanceof PortfolioPdx)) {
fail("Result objects for remote client query: " + queries[i]
+ " should be instance of PortfolioPdx and not " + rs.getClass());
}
Expand Down Expand Up @@ -1496,15 +1472,13 @@ public Object call() throws Exception {
for (Object rs : res) {
if (rs instanceof StructImpl) {
for (Object obj : ((StructImpl) rs).getFieldValues()) {
if (obj instanceof PortfolioPdx || obj instanceof PositionPdx) {
} else if (obj instanceof PdxInstance) {
} else {
if (!(obj instanceof PortfolioPdx) && !(obj instanceof PositionPdx)
&& !(obj instanceof PdxInstance)) {
fail("Result objects for remote client query: " + queries[i]
+ " should be instance of PdxInstance and not " + obj.getClass());
}
}
} else if (rs instanceof PdxInstance || rs instanceof PortfolioPdx) {
} else {
} else if (!(rs instanceof PdxInstance) && !(rs instanceof PortfolioPdx)) {
fail("Result objects for remote client query: " + queries[i]
+ " should be instance of PdxInstance and not " + rs.getClass());
}
Expand Down Expand Up @@ -1589,14 +1563,12 @@ public Object call() throws Exception {
for (Object rs : res) {
if (rs instanceof StructImpl) {
for (Object obj : ((StructImpl) rs).getFieldValues()) {
if (obj instanceof PortfolioPdx || obj instanceof PositionPdx) {
} else {
if (!(obj instanceof PortfolioPdx) && !(obj instanceof PositionPdx)) {
fail("Result objects for remote client query: " + queries[i]
+ " should be instance of PortfolioPdx and not " + obj.getClass());
}
}
} else if (rs instanceof PortfolioPdx) {
} else {
} else if (!(rs instanceof PortfolioPdx)) {
fail("Result objects for remote client query: " + queries[i]
+ " should be instance of PortfolioPdx and not " + rs.getClass());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
*/
package org.apache.geode.cache30;

import static org.apache.geode.test.awaitility.GeodeAwaitility.await;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
Expand Down Expand Up @@ -249,8 +251,8 @@ private void waitForClockToChange(Region region) {
*/
private void waitForClockToChange(Region region, long millisecs) {
long time = ((InternalRegion) region).cacheTimeMillis();
while (time >= ((InternalRegion) region).cacheTimeMillis() + millisecs) {
}
await().untilAsserted(() -> assertThat(((InternalRegion) region).cacheTimeMillis() + millisecs)
.isGreaterThanOrEqualTo(time));
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@
*/
package org.apache.geode.cache30;

import static org.apache.geode.test.awaitility.GeodeAwaitility.await;
import static org.apache.geode.test.dunit.Assert.assertEquals;
import static org.apache.geode.test.dunit.Assert.fail;
import static org.junit.Assert.assertFalse;

import java.util.Properties;

Expand Down Expand Up @@ -117,8 +119,7 @@ public void testClearSingleVM() {
vm0.invoke(() -> ClearMultiVmCallBkDUnitTest.clearMethod());
LogWriterUtils.getLogWriter().fine("Did clear successfully");

while (afterClear) {
}
await().untilAsserted(() -> assertFalse(afterClear));

int Regsize = vm0.invoke(() -> ClearMultiVmCallBkDUnitTest.sizeMethod());
assertEquals(1, Regsize);
Expand All @@ -144,8 +145,7 @@ public void testClearMultiVM() {
vm1.invoke(() -> ClearMultiVmCallBkDUnitTest.clearMethod());
LogWriterUtils.getLogWriter().fine("Did clear successfully");

while (afterClear) {
}
await().untilAsserted(() -> assertFalse(afterClear));

int Regsize = vm0.invoke(() -> ClearMultiVmCallBkDUnitTest.sizeMethod());
assertEquals(1, Regsize);
Expand Down

0 comments on commit c006392

Please sign in to comment.