Skip to content

Commit

Permalink
fixed issues reported by Sonar
Browse files Browse the repository at this point in the history
  • Loading branch information
albogdano committed Mar 30, 2021
1 parent c2c62eb commit a5cfa44
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 13 deletions.
5 changes: 3 additions & 2 deletions para-core/src/main/java/com/erudika/para/Para.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,9 @@ public static void destroy() {
SCHEDULER.shutdown();
SCHEDULER.awaitTermination(60, TimeUnit.SECONDS);
}
} catch (Exception e) {
logger.error("Failed to destroy Para.", e);
} catch (InterruptedException e) {
logger.error("Interrupted while shutting down Para.", e);
Thread.currentThread().interrupt();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class MockFileStore implements FileStore {
@Override
public InputStream load(String path) {
if (!StringUtils.isBlank(path)) {
fs.get(path);
return fs.get(path);
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import java.util.Date;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ExecutionException;
import java.util.function.Consumer;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
Expand Down Expand Up @@ -279,7 +280,9 @@ public void accept(PartitionReceiver receiver) {
}
}
logger.debug("Received {} messages from Azure for partition {}.", batchSize, partitionId);
} catch (Exception e) {
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
} catch (ExecutionException e) {
logger.warn("Failed to receive messages: {}", e.getMessage());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,12 +363,7 @@ public static boolean deleteTable(String appid) {
logger.error(null, ex);
}
});
try {
waitForActive(table, AWS_REGION);
} catch (InterruptedException ex) {
logger.error(null, ex);
Thread.currentThread().interrupt();
}
waitForActive(table, AWS_REGION);
}
getClient().deleteTable(b -> b.tableName(table));
logger.info("Deleted DynamoDB table '{}'.", table);
Expand Down Expand Up @@ -830,7 +825,7 @@ private static String keyPrefix(String appIdentifier) {
return StringUtils.join(StringUtils.trim(appIdentifier), "_");
}

private static void waitForActive(String table, String region) throws InterruptedException {
private static void waitForActive(String table, String region) {
WaiterResponse<DescribeTableResponse> waiterResponse = getClient(region).waiter().
waitUntilTableExists(r -> r.tableName(table));
if (!waiterResponse.matched().response().isPresent()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,12 @@ protected static void deleteQueue(String queueURL) {
protected static String getQueueURL(String name) {
try {
return getClient().getQueueUrl(b -> b.queueName(name)).get().queueUrl();
} catch (Exception e) {
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} catch (ExecutionException e) {
logger.info("Queue '{}' could not be found: {}", name, e.getMessage());
return null;
}
return null;
}

/**
Expand Down

0 comments on commit a5cfa44

Please sign in to comment.