diff --git a/src/de/schildbach/pte/AbstractHafasProvider.java b/src/de/schildbach/pte/AbstractHafasProvider.java index 52d64d0a..75ce754f 100644 --- a/src/de/schildbach/pte/AbstractHafasProvider.java +++ b/src/de/schildbach/pte/AbstractHafasProvider.java @@ -162,7 +162,7 @@ public abstract class AbstractHafasProvider implements NetworkProvider throw new IllegalStateException("cannot handle: " + type); } - private static final Location parseAddress(final XmlPullParser pp) + private final Location parseAddress(final XmlPullParser pp) { final String type = pp.getName(); if ("Address".equals(type)) @@ -172,7 +172,9 @@ public abstract class AbstractHafasProvider implements NetworkProvider name = null; final int x = Integer.parseInt(pp.getAttributeValue(null, "x")); final int y = Integer.parseInt(pp.getAttributeValue(null, "y")); - return new Location(LocationType.ADDRESS, 0, y, x, null, name); + + final String[] placeAndName = splitPlaceAndName(name); + return new Location(LocationType.ADDRESS, 0, y, x, placeAndName[0], placeAndName[1]); } throw new IllegalStateException("cannot handle: " + type); } @@ -1030,7 +1032,8 @@ public abstract class AbstractHafasProvider implements NetworkProvider if (location.type == LocationType.POI && location.hasLocation()) return ""; if (location.type == LocationType.ADDRESS && location.hasLocation()) - return "
"; + return "
"; throw new IllegalArgumentException("cannot handle: " + location.toDebugString()); } diff --git a/test/de/schildbach/pte/live/NasaProviderLiveTest.java b/test/de/schildbach/pte/live/NasaProviderLiveTest.java index c91d5366..a896b2b9 100644 --- a/test/de/schildbach/pte/live/NasaProviderLiveTest.java +++ b/test/de/schildbach/pte/live/NasaProviderLiveTest.java @@ -79,4 +79,15 @@ public class NasaProviderLiveTest final QueryConnectionsResult moreResult = provider.queryMoreConnections(result.context); System.out.println(moreResult); } + + @Test + public void addressConnection() throws Exception + { + final QueryConnectionsResult result = provider.queryConnections(new Location(LocationType.ADDRESS, 0, 51334078, 12478331, + "04319 Leipzig-Engelsdorf", "August-Bebel-Platz"), null, new Location(LocationType.STATION, 8010205, null, "Leipzig Hbf"), + new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL); + System.out.println(result); + final QueryConnectionsResult moreResult = provider.queryMoreConnections(result.context); + System.out.println(moreResult); + } }