Opened 14 months ago

#5463 new defect

osmosis on android stops functioning after reading the first node

Reported by: spyhunter99 Owned by: brett@…
Priority: minor Milestone:
Component: osmosis Version:
Keywords: Cc:

Description

Running osmosis 0.45 against the same dataset (tried with both pbf and bz2) . On JRE/JDK is performs well and reads the files with no problems. On Android, (v6). it looks like it reads the bounds of the document, then the first node, and then suddenly stops without warning, exception or output.

I've attempted stepping through the debugger but I've been unable to find the source of the issue. The callback for process(Entity...) just stop firing. I think what's happening is that android is seeing some api call and is changing it to NOOP at some point but I'm not sure what's going on.

Sample code below. Please source is here https://github.com/spyhunter99/osmreader

boolean pbf = false;

CompressionMethod? compression = CompressionMethod?.None;

if (file.getName().endsWith(".pbf")) {

pbf = true;

} else if (file.getName().endsWith(".gz")) {

compression = CompressionMethod?.GZip;

} else if (file.getName().endsWith(".bz2")) {

compression = CompressionMethod?.BZip2;

}

RunnableSource? reader;
FileInputStream? fis = null;
if (pbf) {

fis = new FileInputStream?(file);
reader = new crosby.binary.osmosis.OsmosisReader?(

fis);

} else {

reader = new XmlReader?(file, false, compression);

}

reader.setSink(this);

System.out.println("starting import");
Thread readerThread = new Thread(reader);
readerThread.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler?() {

@Override
public void uncaughtException(Thread thread, Throwable throwable) {

System.out.println("import failed!");
throwable.printStackTrace();

}

});
readerThread.start();

while (readerThread.isAlive()) {

try {

readerThread.join();

} catch (InterruptedException? e) {

/* do nothing */

}

}

Change History (0)

Note: See TracTickets for help on using tickets.