Skip to content

Commit 1ca754a

Browse files
committed
Fix to suppress warnings
1 parent 669501a commit 1ca754a

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

core/src/main/java/com/scalar/db/storage/objectstorage/ObjectStoragePartition.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ public boolean isEmpty() {
6161
public void applyPut(Put put, TableMetadata tableMetadata) throws NoMutationException {
6262
ObjectStorageMutation mutation = new ObjectStorageMutation(put, tableMetadata);
6363
if (!put.getCondition().isPresent()) {
64-
if (!records.containsKey(mutation.getRecordId())) {
64+
ObjectStorageRecord existingRecord = records.get(mutation.getRecordId());
65+
if (existingRecord == null) {
6566
records.put(mutation.getRecordId(), mutation.makeRecord());
6667
} else {
67-
records.compute(
68-
mutation.getRecordId(), (id, existingRecord) -> mutation.makeRecord(existingRecord));
68+
records.put(mutation.getRecordId(), mutation.makeRecord(existingRecord));
6969
}
7070
} else if (put.getCondition().get() instanceof PutIfNotExists) {
7171
if (records.containsKey(mutation.getRecordId())) {
@@ -74,12 +74,12 @@ public void applyPut(Put put, TableMetadata tableMetadata) throws NoMutationExce
7474
}
7575
records.put(mutation.getRecordId(), mutation.makeRecord());
7676
} else if (put.getCondition().get() instanceof PutIfExists) {
77-
if (!records.containsKey(mutation.getRecordId())) {
77+
ObjectStorageRecord existingRecord = records.get(mutation.getRecordId());
78+
if (existingRecord == null) {
7879
throw new NoMutationException(
7980
CoreError.NO_MUTATION_APPLIED.buildMessage(), Collections.singletonList(put));
8081
}
81-
records.compute(
82-
mutation.getRecordId(), (id, existingRecord) -> mutation.makeRecord(existingRecord));
82+
records.put(mutation.getRecordId(), mutation.makeRecord(existingRecord));
8383
} else {
8484
assert put.getCondition().get() instanceof PutIf;
8585
if (!records.containsKey(mutation.getRecordId())) {

core/src/main/java/com/scalar/db/storage/objectstorage/StreamingRecordIterator.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.scalar.db.common.CoreError;
44
import com.scalar.db.exception.storage.ExecutionException;
5+
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
56
import java.util.Collections;
67
import java.util.Iterator;
78
import java.util.List;
@@ -11,6 +12,7 @@
1112
* Iterator that streams records from partitions in a lazy manner, loading partitions on-demand
1213
* instead of loading all records into memory at once.
1314
*/
15+
@SuppressFBWarnings("EI_EXPOSE_REP2")
1416
public class StreamingRecordIterator implements Iterator<ObjectStorageRecord> {
1517
private final ObjectStorageWrapper wrapper;
1618
private final String namespaceName;

0 commit comments

Comments
 (0)