Append first few characters of binary trips result (Hafas) to exception, for debug purposes.

This commit is contained in:
Andreas Schildbach 2014-05-26 13:59:35 +02:00
parent 67db7d7b2d
commit 4591eede54
2 changed files with 15 additions and 1 deletions

View file

@ -1609,13 +1609,16 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
try
{
final CustomBufferedInputStream bis = new CustomBufferedInputStream(ParserUtils.scrapeInputStream(uri));
final String firstChars = ParserUtils.peekFirstChars(bis);
// initialize input stream
is = new LittleEndianDataInputStream(bis);
is.mark(expectedBufferSize);
// quick check of status
final int version = is.readShortReverse();
if (version != 6 && version != 5)
throw new IllegalStateException("unknown version: " + version);
throw new IllegalStateException("unknown version: " + version + ", first chars: " + firstChars);
final ResultHeader header = new ResultHeader(SERVER_PRODUCT, Integer.toString(version), 0, null);
// quick seek for pointers