about summary refs log tree commit diff stats
path: root/client
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2008-08-17 13:52:45 +0000
committerKelly Rauchenberger <fefferburbia@gmail.com>2008-08-17 13:52:45 +0000
commit5a5f614c4dd17cfbe88617b5708fe19f5ccdf75b (patch)
tree9c686685ac5afbb15a808026c0a994b96b12ac02 /client
parentfdf82fc3d06c5d4f9c4d3f8a89906cc57bdaddc1 (diff)
downloadinstadisc-5a5f614c4dd17cfbe88617b5708fe19f5ccdf75b.tar.gz
instadisc-5a5f614c4dd17cfbe88617b5708fe19f5ccdf75b.tar.bz2
instadisc-5a5f614c4dd17cfbe88617b5708fe19f5ccdf75b.zip
Client: Modified old Verification ID deletion
Fixes #42
Diffstat (limited to 'client')
-rw-r--r--client/trunk/src/com/fourisland/instadisc/Database/Wrapper.java24
-rw-r--r--client/trunk/src/com/fourisland/instadisc/Item/Verification.java2
-rw-r--r--client/trunk/src/com/fourisland/instadisc/Item/WellFormedItem.java4
3 files changed, 9 insertions, 21 deletions
diff --git a/client/trunk/src/com/fourisland/instadisc/Database/Wrapper.java b/client/trunk/src/com/fourisland/instadisc/Database/Wrapper.java index 86b22d8..5945e9b 100644 --- a/client/trunk/src/com/fourisland/instadisc/Database/Wrapper.java +++ b/client/trunk/src/com/fourisland/instadisc/Database/Wrapper.java
@@ -8,7 +8,6 @@ import com.sleepycat.je.DatabaseException;
8import com.sleepycat.je.Environment; 8import com.sleepycat.je.Environment;
9import com.sleepycat.je.EnvironmentConfig; 9import com.sleepycat.je.EnvironmentConfig;
10import com.sleepycat.je.Transaction; 10import com.sleepycat.je.Transaction;
11import com.sleepycat.persist.EntityCursor;
12import com.sleepycat.persist.EntityStore; 11import com.sleepycat.persist.EntityStore;
13import com.sleepycat.persist.PrimaryIndex; 12import com.sleepycat.persist.PrimaryIndex;
14import com.sleepycat.persist.StoreConfig; 13import com.sleepycat.persist.StoreConfig;
@@ -120,21 +119,15 @@ public class Wrapper {
120 } 119 }
121 } 120 }
122 121
123 public static void emptyOldVerID() { 122 public static void addOldVerID(Integer id) {
124 synchronized (oldVerID) { 123 synchronized (oldVerID) {
125 try { 124 try {
126 Transaction t = e.beginTransaction(null, null); 125 Transaction t = e.beginTransaction(null, null);
127 126
128 try { 127 try {
129 EntityCursor<OldVerID> ec = oldVerID.entities(); 128 OldVerID temp = new OldVerID();
130 try { 129 temp.setID(id);
131 Iterator<OldVerID> i = ec.iterator(); 130 oldVerID.put(t, temp);
132 while (i.hasNext()) {
133 oldVerID.delete(t, i.next().getID());
134 }
135 } finally {
136 ec.close();
137 }
138 131
139 t.commit(); 132 t.commit();
140 } catch (Exception ex) { 133 } catch (Exception ex) {
@@ -145,16 +138,15 @@ public class Wrapper {
145 } 138 }
146 } 139 }
147 } 140 }
148 141
149 public static void addOldVerID(Integer id) { 142 public static void dropFromTopOldVerID() {
150 synchronized (oldVerID) { 143 synchronized (oldVerID) {
151 try { 144 try {
152 Transaction t = e.beginTransaction(null, null); 145 Transaction t = e.beginTransaction(null, null);
153 146
154 try { 147 try {
155 OldVerID temp = new OldVerID(); 148 Iterator<Entry<Integer, OldVerID>> i = oldVerID.map().entrySet().iterator();
156 temp.setID(id); 149 oldVerID.delete(t, i.next().getKey());
157 oldVerID.put(t, temp);
158 150
159 t.commit(); 151 t.commit();
160 } catch (Exception ex) { 152 } catch (Exception ex) {
diff --git a/client/trunk/src/com/fourisland/instadisc/Item/Verification.java b/client/trunk/src/com/fourisland/instadisc/Item/Verification.java index dc4c4a7..3b99c4b 100644 --- a/client/trunk/src/com/fourisland/instadisc/Item/Verification.java +++ b/client/trunk/src/com/fourisland/instadisc/Item/Verification.java
@@ -32,7 +32,7 @@ public class Verification {
32 throw new VerificationIDReusedException(); 32 throw new VerificationIDReusedException();
33 } else { 33 } else {
34 if (Wrapper.countOldVerID() == Integer.decode(Wrapper.getConfig("verIDBufferSize"))) { 34 if (Wrapper.countOldVerID() == Integer.decode(Wrapper.getConfig("verIDBufferSize"))) {
35 Wrapper.emptyOldVerID(); 35 Wrapper.dropFromTopOldVerID();
36 } 36 }
37 Wrapper.addOldVerID(id); 37 Wrapper.addOldVerID(id);
38 } 38 }
diff --git a/client/trunk/src/com/fourisland/instadisc/Item/WellFormedItem.java b/client/trunk/src/com/fourisland/instadisc/Item/WellFormedItem.java index f04e2ad..82211e0 100644 --- a/client/trunk/src/com/fourisland/instadisc/Item/WellFormedItem.java +++ b/client/trunk/src/com/fourisland/instadisc/Item/WellFormedItem.java
@@ -174,10 +174,6 @@ public class WellFormedItem {
174 return good; 174 return good;
175 } 175 }
176 176
177 private boolean checkForLegalCategory(String string, boolean good) {
178 return (good ? true : Wrapper.getSubscription(aThis.headerMap.get("Subscription")).getCategory().equals(string));
179 }
180
181 private boolean checkForProperVerification() { 177 private boolean checkForProperVerification() {
182 boolean good = false; 178 boolean good = false;
183 try { 179 try {