|
17 | 17 | * </p> |
18 | 18 | */ |
19 | 19 | public class HdfFileAllocation { |
| 20 | + private static final String DATASET_NAME_ERROR = "Dataset name cannot be null"; |
20 | 21 |
|
21 | 22 | // public AllocationRecord getSuperblockRecord() { |
22 | 23 | // return superblockRecord; |
@@ -262,7 +263,7 @@ public HdfFileAllocation(HdfSuperblock superblock) { |
262 | 263 | * @throws IllegalStateException if the dataset is not found |
263 | 264 | */ |
264 | 265 | public void increaseHeaderAllocation(String datasetName, HdfFixedPoint newTotalHeaderSize) { |
265 | | - Objects.requireNonNull(datasetName, "Dataset name cannot be null"); |
| 266 | + Objects.requireNonNull(datasetName, DATASET_NAME_ERROR); |
266 | 267 | Map<AllocationType, AllocationRecord> datasetAllocs = datasetRecordsByName.get(datasetName); |
267 | 268 | if (datasetAllocs == null || !datasetAllocs.containsKey(AllocationType.DATASET_OBJECT_HEADER)) { |
268 | 269 | throw new IllegalStateException("Dataset '" + datasetName + "' not found"); |
@@ -323,7 +324,7 @@ public HdfFixedPoint allocateNextSnodStorage() { |
323 | 324 | * @throws IllegalStateException if the dataset or data block is already allocated |
324 | 325 | */ |
325 | 326 | public HdfFixedPoint allocateAndSetDataBlock(String datasetName, HdfFixedPoint dataSize) { |
326 | | - Objects.requireNonNull(datasetName, "Dataset name cannot be null"); |
| 327 | + Objects.requireNonNull(datasetName, DATASET_NAME_ERROR); |
327 | 328 | Map<AllocationType, AllocationRecord> datasetAllocs = datasetRecordsByName.get(datasetName); |
328 | 329 | if (datasetAllocs == null) { |
329 | 330 | throw new IllegalStateException("Dataset '" + datasetName + "' not found"); |
@@ -351,7 +352,7 @@ public HdfFixedPoint allocateAndSetDataBlock(String datasetName, HdfFixedPoint d |
351 | 352 | * @throws IllegalStateException if the dataset or continuation block is already allocated |
352 | 353 | */ |
353 | 354 | public HdfFixedPoint allocateAndSetContinuationBlock(String datasetName, HdfFixedPoint continuationSize) { |
354 | | - Objects.requireNonNull(datasetName, "Dataset name cannot be null"); |
| 355 | + Objects.requireNonNull(datasetName, DATASET_NAME_ERROR); |
355 | 356 | Map<AllocationType, AllocationRecord> datasetAllocs = datasetRecordsByName.get(datasetName); |
356 | 357 | if (datasetAllocs == null) { |
357 | 358 | throw new IllegalStateException("Dataset '" + datasetName + "' not found"); |
|
0 commit comments