diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2013-10-15 23:45:16 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2013-10-15 23:45:16 +1300 |
commit | e3a2b54b4e32a9bf83c97b95e167e730fc4fe0b6 (patch) | |
tree | 2508f5cfe3324fea2a0a5333c7d41e263f1ed916 | |
parent | a615866fb3e86ea5bddaaa266882e3113b54141f (diff) | |
download | traccar-server-e3a2b54b4e32a9bf83c97b95e167e730fc4fe0b6.tar.gz traccar-server-e3a2b54b4e32a9bf83c97b95e167e730fc4fe0b6.tar.bz2 traccar-server-e3a2b54b4e32a9bf83c97b95e167e730fc4fe0b6.zip |
Fix database data manager
-rw-r--r-- | src/org/traccar/model/DatabaseDataManager.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/org/traccar/model/DatabaseDataManager.java b/src/org/traccar/model/DatabaseDataManager.java index 65a52d100..ca5cb1372 100644 --- a/src/org/traccar/model/DatabaseDataManager.java +++ b/src/org/traccar/model/DatabaseDataManager.java @@ -23,7 +23,9 @@ import java.sql.*; import java.util.*; import java.util.logging.Level; import java.util.logging.Logger; +import javax.xml.namespace.QName; import javax.xml.xpath.XPath; +import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; import org.traccar.helper.AdvancedConnection; @@ -161,14 +163,15 @@ public class DatabaseDataManager implements DataManager { // DELME: Temporary compatibility support XPath xpath = XPathFactory.newInstance().newXPath(); - InputSource source = new InputSource(new StringReader(position.getExtendedInfo())); try { + InputSource source = new InputSource(new StringReader(position.getExtendedInfo())); String index = xpath.evaluate("/info/index", source); if (!index.isEmpty()) { queryAddPosition.setLong("id", Long.valueOf(index)); } else { queryAddPosition.setLong("id", null); } + source = new InputSource(new StringReader(position.getExtendedInfo())); String power = xpath.evaluate("/info/power", source); if (!power.isEmpty()) { queryAddPosition.setDouble("power", Double.valueOf(power)); |