×
Namespaces

Variants
Actions

Talk:JSR 172: XML Parsing Example

From Nokia Developer Wiki
Jump to: navigation, search

Hi,

While Closing InputStream , Application is crashing

@Rainier

Contents

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?

regards

Hamish

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.

×