Skip to content

Commit 5155cd8

Browse files
committed
sonarqube cleanup.
1 parent aa367a7 commit 5155cd8

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/main/java/org/hdf5javalib/hdfjava/HdfFileAllocation.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* </p>
1818
*/
1919
public class HdfFileAllocation {
20+
private static final String DATASET_NAME_ERROR = "Dataset name cannot be null";
2021

2122
// public AllocationRecord getSuperblockRecord() {
2223
// return superblockRecord;
@@ -262,7 +263,7 @@ public HdfFileAllocation(HdfSuperblock superblock) {
262263
* @throws IllegalStateException if the dataset is not found
263264
*/
264265
public void increaseHeaderAllocation(String datasetName, HdfFixedPoint newTotalHeaderSize) {
265-
Objects.requireNonNull(datasetName, "Dataset name cannot be null");
266+
Objects.requireNonNull(datasetName, DATASET_NAME_ERROR);
266267
Map<AllocationType, AllocationRecord> datasetAllocs = datasetRecordsByName.get(datasetName);
267268
if (datasetAllocs == null || !datasetAllocs.containsKey(AllocationType.DATASET_OBJECT_HEADER)) {
268269
throw new IllegalStateException("Dataset '" + datasetName + "' not found");
@@ -323,7 +324,7 @@ public HdfFixedPoint allocateNextSnodStorage() {
323324
* @throws IllegalStateException if the dataset or data block is already allocated
324325
*/
325326
public HdfFixedPoint allocateAndSetDataBlock(String datasetName, HdfFixedPoint dataSize) {
326-
Objects.requireNonNull(datasetName, "Dataset name cannot be null");
327+
Objects.requireNonNull(datasetName, DATASET_NAME_ERROR);
327328
Map<AllocationType, AllocationRecord> datasetAllocs = datasetRecordsByName.get(datasetName);
328329
if (datasetAllocs == null) {
329330
throw new IllegalStateException("Dataset '" + datasetName + "' not found");
@@ -351,7 +352,7 @@ public HdfFixedPoint allocateAndSetDataBlock(String datasetName, HdfFixedPoint d
351352
* @throws IllegalStateException if the dataset or continuation block is already allocated
352353
*/
353354
public HdfFixedPoint allocateAndSetContinuationBlock(String datasetName, HdfFixedPoint continuationSize) {
354-
Objects.requireNonNull(datasetName, "Dataset name cannot be null");
355+
Objects.requireNonNull(datasetName, DATASET_NAME_ERROR);
355356
Map<AllocationType, AllocationRecord> datasetAllocs = datasetRecordsByName.get(datasetName);
356357
if (datasetAllocs == null) {
357358
throw new IllegalStateException("Dataset '" + datasetName + "' not found");

0 commit comments

Comments
 (0)