fixed exception when destID is missing

git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@860 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
andreas.schildbach@gmail.com 2011-12-20 16:35:40 +00:00
parent 24f9393f0d
commit 40cfcf5016

View file

@ -1263,7 +1263,8 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
final int assignedStopId = assignedStopIdStr != null ? Integer.parseInt(assignedStopIdStr) : 0; final int assignedStopId = assignedStopIdStr != null ? Integer.parseInt(assignedStopIdStr) : 0;
final String destination = normalizeLocationName(pp.getAttributeValue(null, "direction")); final String destination = normalizeLocationName(pp.getAttributeValue(null, "direction"));
final String destinationIdStr = pp.getAttributeValue(null, "destID"); final String destinationIdStr = pp.getAttributeValue(null, "destID");
final int destinationId = destinationIdStr.length() > 0 ? Integer.parseInt(destinationIdStr) : 0; final int destinationId = (destinationIdStr != null && destinationIdStr.length() > 0) ? Integer.parseInt(destinationIdStr)
: 0;
final LineDestination line = new LineDestination(processItdServingLine(pp), destinationId, destination); final LineDestination line = new LineDestination(processItdServingLine(pp), destinationId, destination);
@ -1327,7 +1328,8 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
XmlPullUtil.require(pp, "itdServingLine"); XmlPullUtil.require(pp, "itdServingLine");
final boolean isRealtime = pp.getAttributeValue(null, "realtime").equals("1"); final boolean isRealtime = pp.getAttributeValue(null, "realtime").equals("1");
final String destination = normalizeLocationName(pp.getAttributeValue(null, "direction")); final String destination = normalizeLocationName(pp.getAttributeValue(null, "direction"));
final int destinationId = Integer.parseInt(pp.getAttributeValue(null, "destID")); final String destinationIdStr = pp.getAttributeValue(null, "destID");
final int destinationId = destinationIdStr != null ? Integer.parseInt(destinationIdStr) : 0;
final Line line = processItdServingLine(pp); final Line line = processItdServingLine(pp);