diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-07-08 19:55:44 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2016-07-08 19:55:44 +1200 |
commit | c78b3a3478bbedd84ff2fac13a2577a6e1793ec3 (patch) | |
tree | 3d96706ba3762278709d9d487b825cbafd409d4f /src/org/traccar | |
parent | f953ee0f970379203704f20118e3abec72542657 (diff) | |
download | traccar-server-c78b3a3478bbedd84ff2fac13a2577a6e1793ec3.tar.gz traccar-server-c78b3a3478bbedd84ff2fac13a2577a6e1793ec3.tar.bz2 traccar-server-c78b3a3478bbedd84ff2fac13a2577a6e1793ec3.zip |
Add null check to query builder
Diffstat (limited to 'src/org/traccar')
-rw-r--r-- | src/org/traccar/database/QueryBuilder.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/org/traccar/database/QueryBuilder.java b/src/org/traccar/database/QueryBuilder.java index c5a682b7e..73569ac2a 100644 --- a/src/org/traccar/database/QueryBuilder.java +++ b/src/org/traccar/database/QueryBuilder.java @@ -357,10 +357,13 @@ public final class QueryBuilder { processors.add(new ResultSetProcessor<T>() { @Override public void process(T object, ResultSet resultSet) throws SQLException { - try (JsonReader reader = Json.createReader(new StringReader(resultSet.getString(name)))) { - method.invoke(object, MiscFormatter.fromJson(reader.readObject())); - } catch (IllegalAccessException | InvocationTargetException | JsonParsingException error) { - Log.warning(error); + String value = resultSet.getString(name); + if (value != null) { + try (JsonReader reader = Json.createReader(new StringReader(value))) { + method.invoke(object, MiscFormatter.fromJson(reader.readObject())); + } catch (IllegalAccessException | InvocationTargetException | JsonParsingException error) { + Log.warning(error); + } } } }); |