diff options
Diffstat (limited to 'client/trunk')
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; | |||
| 8 | import com.sleepycat.je.Environment; | 8 | import com.sleepycat.je.Environment; |
| 9 | import com.sleepycat.je.EnvironmentConfig; | 9 | import com.sleepycat.je.EnvironmentConfig; |
| 10 | import com.sleepycat.je.Transaction; | 10 | import com.sleepycat.je.Transaction; |
| 11 | import com.sleepycat.persist.EntityCursor; | ||
| 12 | import com.sleepycat.persist.EntityStore; | 11 | import com.sleepycat.persist.EntityStore; |
| 13 | import com.sleepycat.persist.PrimaryIndex; | 12 | import com.sleepycat.persist.PrimaryIndex; |
| 14 | import com.sleepycat.persist.StoreConfig; | 13 | import 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 { |
