summaryrefslogtreecommitdiff
path: root/src/main/java/com/amazon/carbonado/repo
diff options
context:
space:
mode:
authorBrian S. O'Neill <bronee@gmail.com>2007-01-11 23:19:44 +0000
committerBrian S. O'Neill <bronee@gmail.com>2007-01-11 23:19:44 +0000
commit0947834ac950fb4dd59b719cbdddc1726e68674b (patch)
treedbd0be38df31a000ee178a60dac3557de0f1ad58 /src/main/java/com/amazon/carbonado/repo
parent1ce80a9798cc52b12074fcdf1acf32b0fdfe0569 (diff)
Fixes for bugs found using FindBugs.
Diffstat (limited to 'src/main/java/com/amazon/carbonado/repo')
-rw-r--r--src/main/java/com/amazon/carbonado/repo/indexed/IndexedRepository.java4
-rw-r--r--src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepository.java6
-rw-r--r--src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepository.java12
3 files changed, 13 insertions, 9 deletions
diff --git a/src/main/java/com/amazon/carbonado/repo/indexed/IndexedRepository.java b/src/main/java/com/amazon/carbonado/repo/indexed/IndexedRepository.java
index 6fc6d57..b9380fc 100644
--- a/src/main/java/com/amazon/carbonado/repo/indexed/IndexedRepository.java
+++ b/src/main/java/com/amazon/carbonado/repo/indexed/IndexedRepository.java
@@ -169,12 +169,12 @@ class IndexedRepository implements Repository,
public boolean isSupported(Class<Storable> type) {
StorableInfoCapability cap = mRepository.getCapability(StorableInfoCapability.class);
- return (cap == null) ? null : cap.isSupported(type);
+ return (cap == null) ? false : cap.isSupported(type);
}
public boolean isPropertySupported(Class<Storable> type, String name) {
StorableInfoCapability cap = mRepository.getCapability(StorableInfoCapability.class);
- return (cap == null) ? null : cap.isPropertySupported(type, name);
+ return (cap == null) ? false : cap.isPropertySupported(type, name);
}
public void close() {
diff --git a/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepository.java b/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepository.java
index 5edc42c..c292d9c 100644
--- a/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepository.java
+++ b/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepository.java
@@ -385,7 +385,7 @@ class ReplicatedRepository
if (orderBy == null) {
Set<String> pkSet =
StorableIntrospector.examine(type).getPrimaryKeyProperties().keySet();
- orderBy = pkSet.toArray(new String[0]);
+ orderBy = pkSet.toArray(new String[pkSet.size()]);
}
}
@@ -565,11 +565,15 @@ class ReplicatedRepository
lastMasterEntry = masterEntry;
masterEntry = null;
} else {
+ // If compare is zero, replicaEntry and masterEntry are
+ // either both null or both non-null.
+
if (replicaEntry == null && masterEntry == null) {
// Both cursors exhausted -- resync is complete.
break;
}
+ // Both replicaEntry and masterEntry are non-null.
if (!replicaEntry.equalProperties(masterEntry)) {
// Replica is stale.
resyncTask = prepareResyncTask(trigger, replicaEntry, masterEntry);
diff --git a/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepository.java b/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepository.java
index 6aeb89e..7792536 100644
--- a/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepository.java
+++ b/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepository.java
@@ -718,6 +718,7 @@ abstract class BDBRepository<Txn>
} finally {
synchronized (this) {
mInProgress = false;
+ // Only wait condition is mInProgress, so okay to not call notifyAll.
notify();
}
repository = null;
@@ -726,6 +727,7 @@ abstract class BDBRepository<Txn>
} finally {
synchronized (this) {
mInProgress = false;
+ // Only wait condition is mInProgress, so okay to not call notifyAll.
notify();
}
}
@@ -802,12 +804,10 @@ abstract class BDBRepository<Txn>
public void run() {
while (true) {
- synchronized (this) {
- try {
- wait(mSleepInterval);
- } catch (InterruptedException e) {
- break;
- }
+ try {
+ Thread.sleep(mSleepInterval);
+ } catch (InterruptedException e) {
+ break;
}
BDBRepository repository = mRepository.get();