mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-17 19:59:50 +00:00
fixed NPE
git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@518 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
parent
1c794932ef
commit
bfa102fa11
1 changed files with 14 additions and 4 deletions
|
@ -807,13 +807,23 @@ public abstract class AbstractHafasProvider implements NetworkProvider
|
||||||
protected static final Pattern P_NORMALIZE_LINE = Pattern.compile("([A-Za-zÄÖÜäöüßáàâéèêíìîóòôúùû/-]+)[\\s-]*(.*)");
|
protected static final Pattern P_NORMALIZE_LINE = Pattern.compile("([A-Za-zÄÖÜäöüßáàâéèêíìîóòôúùû/-]+)[\\s-]*(.*)");
|
||||||
|
|
||||||
protected String normalizeLine(final String type, final String line)
|
protected String normalizeLine(final String type, final String line)
|
||||||
|
{
|
||||||
|
final char normalizedType = normalizeType(type);
|
||||||
|
|
||||||
|
if (normalizedType != 0)
|
||||||
|
{
|
||||||
|
if (line != null)
|
||||||
{
|
{
|
||||||
final Matcher m = P_NORMALIZE_LINE.matcher(line);
|
final Matcher m = P_NORMALIZE_LINE.matcher(line);
|
||||||
final String strippedLine = m.matches() ? m.group(1) + m.group(2) : line;
|
final String strippedLine = m.matches() ? m.group(1) + m.group(2) : line;
|
||||||
|
|
||||||
final char normalizedType = normalizeType(type);
|
|
||||||
if (normalizedType != 0)
|
|
||||||
return normalizedType + strippedLine;
|
return normalizedType + strippedLine;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return Character.toString(normalizedType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
throw new IllegalStateException("cannot normalize type '" + type + "' line '" + line + "'");
|
throw new IllegalStateException("cannot normalize type '" + type + "' line '" + line + "'");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue