aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-07-08 19:55:44 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2016-07-08 19:55:44 +1200
commitc78b3a3478bbedd84ff2fac13a2577a6e1793ec3 (patch)
tree3d96706ba3762278709d9d487b825cbafd409d4f /src/org/traccar
parentf953ee0f970379203704f20118e3abec72542657 (diff)
downloadtrackermap-server-c78b3a3478bbedd84ff2fac13a2577a6e1793ec3.tar.gz
trackermap-server-c78b3a3478bbedd84ff2fac13a2577a6e1793ec3.tar.bz2
trackermap-server-c78b3a3478bbedd84ff2fac13a2577a6e1793ec3.zip
Add null check to query builder
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/database/QueryBuilder.java11
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);
+ }
}
}
});