Open
Description
The code is as follows:
public IntMap<? extends Savable> readIntSavableMap(String name, IntMap<? extends Savable> defVal) throws IOException {
...
if (n instanceof Element && n.getNodeName().equals("MapEntry")) {
Element elem = (Element) n;
currentElem = elem;
int key = Integer.parseInt(currentElem.getAttribute("key"));
Savable val = readSavable("Savable", null);
ret.put(key, val);
}
...
}
Here Integer.parseInt(currentElem.getAttribute("key")) can throw NumberFormatException. The other methods of this class catch and rethrow IOException. An example is as follows:
public byte[] readByteArray(String name, byte[] defVal) throws IOException {
try {...
for (int i = 0; i < strings.length; i++) {
tmp[i] = Byte.parseByte(strings[i]);
}...
}catch (IOException ioe) {
throw ioe;
} catch (NumberFormatException nfe) {
IOException io = new IOException(nfe.toString());
io.initCause(nfe);
throw io;
} catch (DOMException de) {
IOException io = new IOException(de.toString());
io.initCause(de);
throw io;
}
}