Talk:JSR 172: XML Parsing Example
While Closing InputStream , Application is crashing
Rahul More -in.close() should be surrounded by try-catch.... because of this error application is crashing ....
17:16, 21 February 2013 (EET)
in.close() *is* surrounded by a try..catch. If it wasn't, the code would not compile, since InputStream.close() throws a checked exception.On what implementation do you find it crashing, and what is "crashing"?
18:54, 21 February 2013 (EET)
Grahamhughes - InputStream.close()
The issue is that (although the documentation doesn't shout about it), the SAXParser will always close the InputStream passed to it. This results from the InputStream being wrapped in an InputSource, and closing the stream is part of the documented contract for InputSource. Also, Oracle's reference implementation for InputStream.close() does not throw an exception on an already closed stream (hence the original code works on the JME SDK) whereas Nokia's S40 implementation does throw an exception.I have removed the close() altogether.
18:40, 1 April 2013 (EEST)
Hamishwillee - What is this tested against
Thanks for the update. I was wondering what platform versions and devices you have tested this against? Presumably it should work for JSR 172 right?
Does it matter what "format" of 172 is used - ie the expert device search defines three variants including XML parser package and RPC package?
05:48, 2 April 2013 (EEST)