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. How can I access the images of a specific directory from sdcard

Hi All,

I am creating an application that access the sdcard and retrieves all the
image files presents in all the directories. Now I want the user to select
the directory from which he wants to view the pictures and display the
images of that folder.

I am using

cursor =
managedQuery(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,NULL,NULL,NULL,NULL);




Any idea how to do this?

Thanks in advance.

Yousuf.

-- 

2. OOT WTA yg pake handset android garansi lokal siapa aja yak..

Guys

Iseng malem 
As subject siapa aja yeh?

Pengen tau bamyak ga..


Salam
Dzikki 
k...@tux.or.id

-- 
"Indonesian Android Community [id-android]" 

3. what happens exactly when android goes to sleep?

4. Creating Calendar events - not appearing on calender widget

5. Maximum Texture Units

6. Unable to get android running on AT91SAM9G45

7. Paid apps in more countries - I am sick about it