Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Talk:JSR 172: XML Parsing Example

From Wiki
Jump to: navigation, search


While Closing InputStream , Application is crashing



Rahul More -

in.close() should be surrounded by try-catch.... because of this error application is crashing ....

Rahul More 17:16, 21 February 2013 (EET)

Grahamhughes -

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"?

grahamhughes 18:54, 21 February 2013 (EET)

Grahamhughes - InputStream.close()

I see...

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.

grahamhughes 18:40, 1 April 2013 (EEST)

Hamishwillee - What is this tested against

Hi Graham

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?



hamishwillee 05:48, 2 April 2013 (EEST)


Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.