Allow nulls in BdfList, BdfDictionary.

BdfList and BdfDictionary are no longer thread-safe, they require external locking. Metadata (which is the class that will be passed across API boundaries) is still thread-safe.
This commit is contained in:
akwizgran
2016-01-05 11:04:15 +00:00
parent d1611180fe
commit ed23bd6c11
5 changed files with 26 additions and 17 deletions

View File

@@ -1,8 +1,9 @@
package org.briarproject.api.data;
import java.util.Hashtable;
import java.util.HashMap;
public class BdfDictionary extends Hashtable<String, Object> {
// This class is not thread-safe
public class BdfDictionary extends HashMap<String, Object> {
public Boolean getBoolean(String key, Boolean defaultValue) {
Object o = get(key);

View File

@@ -1,8 +1,9 @@
package org.briarproject.api.data;
import java.util.Vector;
import java.util.ArrayList;
public class BdfList extends Vector<Object> {
// This class is not thread-safe
public class BdfList extends ArrayList<Object> {
public Boolean getBoolean(int index, Boolean defaultValue) {
Object o = get(index);

View File

@@ -3,4 +3,9 @@ package org.briarproject.api.db;
import java.util.Hashtable;
public class Metadata extends Hashtable<String, byte[]> {
/**
* Special value to indicate that a key is being removed.
*/
public static final byte[] REMOVE = new byte[0];
}