mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-19 08:49:58 +00:00
try to detect IO problems and throw IOException in case
git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@312 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
parent
98ceed52f8
commit
c84b8fdbaa
6 changed files with 29 additions and 9 deletions
|
@ -146,7 +146,7 @@ public abstract class AbstractHafasProvider implements NetworkProvider
|
|||
final XmlPullParser pp = factory.newPullParser();
|
||||
pp.setInput(is, DEFAULT_ENCODING);
|
||||
|
||||
XmlPullUtil.jump(pp, "ResC");
|
||||
assertResC(pp);
|
||||
XmlPullUtil.enter(pp);
|
||||
|
||||
XmlPullUtil.require(pp, "LocValRes");
|
||||
|
@ -245,7 +245,10 @@ public abstract class AbstractHafasProvider implements NetworkProvider
|
|||
final XmlPullParser pp = factory.newPullParser();
|
||||
pp.setInput(is, DEFAULT_ENCODING);
|
||||
|
||||
XmlPullUtil.jump(pp, "ConRes");
|
||||
assertResC(pp);
|
||||
XmlPullUtil.enter(pp);
|
||||
|
||||
XmlPullUtil.require(pp, "ConRes");
|
||||
XmlPullUtil.enter(pp);
|
||||
if (pp.getName().equals("Err"))
|
||||
{
|
||||
|
@ -876,4 +879,10 @@ public abstract class AbstractHafasProvider implements NetworkProvider
|
|||
{
|
||||
return LINES.get(line.charAt(0));
|
||||
}
|
||||
|
||||
private void assertResC(final XmlPullParser pp) throws XmlPullParserException, IOException
|
||||
{
|
||||
if (!XmlPullUtil.jumpToStartTag(pp, null, "ResC"))
|
||||
throw new IOException("cannot find <ResC />");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue