AssertionError on android.util.Xml.parse

by Cleverson » Fri, 23 Apr 2010 06:09:40 GMT


Sponsored Links
 Hi,

I'm getting an AssertionError when calling Xml.parse. This error
usually occurs when I run the app and keep switching the phone
connectivity from Wifi to 3G and vice versa. I checked the source code
of the android.util.Xml class and see something that I couldn't not
understand well, for example

    public static void parse(InputStream in, Encoding encoding,
            ContentHandler contentHandler) throws IOException,
SAXException {
        try {
            XMLReader reader = new ExpatReader();
            reader.setContentHandler(contentHandler);
            InputSource source = new InputSource(in);
            source.setEncoding(encoding.expatName);
            reader.parse(source);
        } catch (IOException e) {
            throw new AssertionError(e);
        }
    }

Is it "normal" to handle an IOException like it is done in this class?
I mean, why catching a checked exception and turn it to an
AssertionError? Should clients be supposed to catch AssertionErrors
when calling the parse method?

Thanks in advance!

--



Other Threads

1. Download and install application

Hello all,

Is there any howto on donwloading via HTTP an application package and
installing it afterwards?

Thanks.

-- 

2. How to fetch phone's phone number or unique ID

Exactly, I want an unique ID to it.

How can I call it? Do I have to instantiate something?

Thanks,






> 

3. has any1 tried hsqldb

4. Picking up contacts: difference in behaviour between HTC and NexusOne - SDK 2.1-update1

5. is this a bug in android OS

6. Using targetSdkVersion

7. Is runtime mapview defining possible? (rather then in main.xml)