mirror of
https://github.com/danieldemus/openhab-core.git
synced 2025-01-10 21:31:53 +01:00
mapdb storage: fix nullness handling (#479)
The `MapDbStorageService` calls the constructor with a `null` classloader if there has been no one supplied. Signed-off-by: Markus Rathgeb <maggu2810@gmail.com>
This commit is contained in:
parent
a37cceab67
commit
12a5273cc8
@ -49,12 +49,12 @@ public class MapDbStorage<T> implements DeletableStorage<T> {
|
||||
|
||||
private final String name;
|
||||
private final DB db;
|
||||
private final ClassLoader classLoader;
|
||||
private final @Nullable ClassLoader classLoader;
|
||||
private Map<String, String> map;
|
||||
|
||||
private transient Gson mapper;
|
||||
|
||||
public MapDbStorage(DB db, String name, ClassLoader classLoader) {
|
||||
public MapDbStorage(DB db, String name, @Nullable ClassLoader classLoader) {
|
||||
this.name = name;
|
||||
this.db = db;
|
||||
this.classLoader = classLoader;
|
||||
@ -155,8 +155,10 @@ public class MapDbStorage<T> implements DeletableStorage<T> {
|
||||
@Nullable
|
||||
T value = null;
|
||||
try {
|
||||
final ClassLoader classLoader = this.classLoader;
|
||||
|
||||
// load required class within the given bundle context
|
||||
Class<T> loadedValueType = null;
|
||||
final Class<T> loadedValueType;
|
||||
if (classLoader == null) {
|
||||
loadedValueType = (Class<T>) Class.forName(valueTypeName);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user