Hafas: Fix handling of lines with unknown product.

This commit is contained in:
Andreas Schildbach 2015-06-16 14:32:50 +02:00
parent d934dfa0d4
commit 9bef580434
7 changed files with 13 additions and 12 deletions

View file

@ -3042,8 +3042,6 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
}
final Product normalizedType = normalizeType(type);
if (normalizedType == null)
throw new IllegalStateException("cannot normalize type '" + type + "' line '" + normalizedName + "'");
final Line.Attr[] attrs;
if (wheelchairAccess)
@ -3105,9 +3103,9 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
if (mTram.matches())
return newLine(Product.TRAM, mTram.group(1), null);
}
return newLine(normalizedType, number.replaceAll("\\s+", ""), null);
}
return newLine(normalizedType, number.replaceAll("\\s+", ""), null);
}
throw new IllegalStateException("cannot normalize type '" + type + "' number '" + number + "' line#type '" + lineAndType + "'");

View file

@ -163,7 +163,7 @@ public final class BahnProvider extends AbstractHafasProvider
}
@Override
protected Product normalizeType(String type)
protected Product normalizeType(final String type)
{
final String ucType = type.toUpperCase();

View file

@ -120,6 +120,7 @@ public class EireannProvider extends AbstractHafasProvider
if ("CIT".equals(ucType))
return Product.BUS;
return null;
// skip parsing of "common" lines
throw new IllegalStateException("cannot normalize type '" + type + "'");
}
}

View file

@ -364,7 +364,8 @@ public class InvgProvider extends AbstractHafasProvider
if ("1".equals(type))
return Product.BUS;
return null;
// skip parsing of "common" lines
throw new IllegalStateException("cannot normalize type '" + type + "'");
}
private static final Map<String, Style> STYLES = new HashMap<String, Style>();

View file

@ -178,6 +178,7 @@ public class NriProvider extends AbstractHafasProvider
if ("SHI".equals(ucType))
return Product.FERRY;
return null;
// skip parsing of "common" lines
throw new IllegalStateException("cannot normalize type '" + type + "'");
}
}

View file

@ -309,8 +309,6 @@ public class SeptaProvider extends AbstractHafasProvider
{
final String ucType = type.toUpperCase();
// skip parsing of "common" lines, because this is America
// Regional
if (ucType.equals("RAI"))
return Product.REGIONAL_TRAIN;
@ -346,6 +344,7 @@ public class SeptaProvider extends AbstractHafasProvider
if (ucType.equals("TROLLEY"))
return Product.BUS;
return null;
// skip parsing of "common" lines, because this is America
throw new IllegalStateException("cannot normalize type '" + type + "'");
}
}

View file

@ -195,7 +195,8 @@ public class StockholmProvider extends AbstractHafasProvider
if ("FÄRJA".equals(ucType))
return Product.FERRY;
return null;
// skip parsing of "common" lines
throw new IllegalStateException("cannot normalize type '" + type + "'");
}
private static final Map<String, Style> STYLES = new HashMap<String, Style>();