Code example for Exception

Methods: getMessage, printStackTrace

0
  public DeviceInfo(String xml) {
    this.raw = xml;
    try { 
      parse(); 
    } catch (Exception e) {
      e.printStackTrace();
      throw new RuntimeException("Cannot parse the device info xml " + e.getMessage(), e);
    } 
 
  } 
 
  private void parse() throws java.lang.Exception { 
    byte[] xml = raw.getBytes("UTF-8");
    NSDictionary rootDict = (NSDictionary) MyParser.parse(xml);
    buildVersion = rootDict.objectForKey("BuildVersion").toString();
 
    bluetoothAddress = get(rootDict,"BluetoothAddress");
    boardId = get(rootDict,"BoardId");
    cpuArchitecture = get(rootDict,"CPUArchitecture");
    chipID = get(rootDict,"ChipID");
    deviceClass = get(rootDict,"DeviceClass");