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. Xoom USB driver

I don;t think updating the USB 4 through Eclipse would install the
driver for Xoom. Is Google providing the driver for this device.

-- 

2. registerListener

I'm having trouble with this method:

public boolean registerListener (SensorEventListener listener, Sensor
sensor, int rate)
Since: API Level 3

Registers a SensorEventListener for the given sensor.
Parameters
listener        A SensorEventListener object.
sensor  The Sensor to register to.
rate    The rate sensor events are delivered at. This is only a hint to
the system. Events may be received faster or slower than the specified
rate. Usually events are received faster. The value must be one of
SENSOR_DELAY_NORMAL, SENSOR_DELAY_UI, SENSOR_DELAY_GAME, or
SENSOR_DELAY_FASTEST or, the desired delay between events in
microsecond.

I passed in 200,000 as the third parameter to tell it to notify me 5
times a second.  However, it basically would not notify me at all
after I did that.  Anyone know what the deal is with this?

-- 

3. Aw: Mac source control

4. Private enterprise Android market

5. Application Licensing

6. Replace Stock Voicemail?

7. WifiManager running in emulator