Skip to content

Commit

Permalink
style fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Alfredo Gutierrez <[email protected]>
  • Loading branch information
AlfredoG87 committed Aug 7, 2024
1 parent d6203c0 commit 0f6e5e7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@ extraJavaModuleInfo {
module("org.mockito:mockito-core", "org.mockito")
module("org.mockito:mockito-junit-jupiter", "org.mockito.junit.jupiter")

//spotbugs
// spotbugs
module("com.github.spotbugs:spotbugs-annotations", "com.github.spotbugs.annotations")
module("com.google.code.findbugs:jsr305", "java.annotation") {
exportAllPackages()
}
module("com.google.code.findbugs:jsr305", "java.annotation") { exportAllPackages() }
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@

package com.hedera.block.server.persistence.storage;

import static com.hedera.block.server.Constants.BLOCKNODE_STORAGE_ROOT_PATH_KEY;

import com.hedera.block.protos.BlockStreamServiceGrpcProto;
import edu.umd.cs.findbugs.annotations.NonNull;
import io.helidon.config.Config;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
Expand All @@ -28,10 +29,9 @@
import java.nio.file.Path;
import java.util.Optional;

import static com.hedera.block.server.Constants.BLOCKNODE_STORAGE_ROOT_PATH_KEY;

/**
* The FileSystemBlockStorage class implements the BlockStorage interface to store blocks to the filesystem.
* The FileSystemBlockStorage class implements the BlockStorage interface to store blocks to the
* filesystem.
*/
public class FileSystemBlockStorage implements BlockStorage<BlockStreamServiceGrpcProto.Block> {

Expand All @@ -47,28 +47,31 @@ public class FileSystemBlockStorage implements BlockStorage<BlockStreamServiceGr
* @param config the configuration
* @throws IOException if an I/O error occurs while initializing the block node root directory
*/
public FileSystemBlockStorage(@NonNull final String key, @NonNull final Config config) throws IOException {
public FileSystemBlockStorage(@NonNull final String key, @NonNull final Config config)
throws IOException {

LOGGER.log(System.Logger.Level.INFO, "Initializing FileSystemBlockStorage");
LOGGER.log(System.Logger.Level.INFO, config.toString());

blockNodeRootPath = Path.of(config
.get(key)
.asString()
.get());
blockNodeRootPath = Path.of(config.get(key).asString().get());

LOGGER.log(System.Logger.Level.INFO, "Block Node Root Path: " + blockNodeRootPath);

if (!blockNodeRootPath.isAbsolute()) {
throw new IllegalArgumentException(BLOCKNODE_STORAGE_ROOT_PATH_KEY+ " must be an absolute path");
throw new IllegalArgumentException(

Check warning on line 61 in server/src/main/java/com/hedera/block/server/persistence/storage/FileSystemBlockStorage.java

View check run for this annotation

Codecov / codecov/patch

server/src/main/java/com/hedera/block/server/persistence/storage/FileSystemBlockStorage.java#L61

Added line #L61 was not covered by tests
BLOCKNODE_STORAGE_ROOT_PATH_KEY + " must be an absolute path");
}

// Initialize the block node root directory if it does not exist
if (Files.notExists(blockNodeRootPath)) {
Files.createDirectory(blockNodeRootPath);
LOGGER.log(System.Logger.Level.INFO, "Created block node root directory: " + blockNodeRootPath);
LOGGER.log(

Check warning on line 68 in server/src/main/java/com/hedera/block/server/persistence/storage/FileSystemBlockStorage.java

View check run for this annotation

Codecov / codecov/patch

server/src/main/java/com/hedera/block/server/persistence/storage/FileSystemBlockStorage.java#L68

Added line #L68 was not covered by tests
System.Logger.Level.INFO,
"Created block node root directory: " + blockNodeRootPath);
} else {
LOGGER.log(System.Logger.Level.INFO, "Using existing block node root directory: " + blockNodeRootPath);
LOGGER.log(
System.Logger.Level.INFO,
"Using existing block node root directory: " + blockNodeRootPath);
}
}

Expand Down

0 comments on commit 0f6e5e7

Please sign in to comment.