Example #1
0
  /** alphaTag and number are set to null on invalid format */
  @DSComment("Private Method")
  @DSBan(DSCat.PRIVATE_METHOD)
  @DSGenerator(
      tool_name = "Doppelganger",
      tool_version = "2.0",
      generated_on = "2013-12-30 12:59:17.045 -0500",
      hash_original_method = "C94E0153AA9A00481672837ABFA310B4",
      hash_generated_method = "FAE8FCC29597D474481255BC020DEE6C")
  private void parseRecord(byte[] record) {
    try {
      alphaTag = IccUtils.adnStringFieldToString(record, 0, record.length - FOOTER_SIZE_BYTES);

      int footerOffset = record.length - FOOTER_SIZE_BYTES;

      int numberLength = 0xff & record[footerOffset];

      if (numberLength > MAX_NUMBER_SIZE_BYTES) {
        // Invalid number length
        number = "";
        return;
      }

      // Please note 51.011 10.5.1:
      //
      // "If the Dialling Number/SSC String does not contain
      // a dialling number, e.g. a control string deactivating
      // a service, the TON/NPI byte shall be set to 'FF' by
      // the ME (see note 2)."

      number = PhoneNumberUtils.calledPartyBCDToString(record, footerOffset + 1, numberLength);

      extRecord = 0xff & record[record.length - 1];

      emails = null;

    } catch (RuntimeException ex) {
      Log.w(LOG_TAG, "Error parsing AdnRecord", ex);
      number = "";
      alphaTag = "";
      emails = null;
    }
  }
  /** alphaTag and number are set to null on invalid format */
  private void parseRecord(byte[] record) {
    try {
      alphaTag = IccUtils.adnStringFieldToString(record, 0, record.length - FOOTER_SIZE_BYTES);

      int footerOffset = record.length - FOOTER_SIZE_BYTES;

      int numberLength = 0xff & record[footerOffset];

      if (numberLength > MAX_NUMBER_SIZE_BYTES) {
        // Invalid number length
        number = "";
        return;
      }

      // Please note 51.011 10.5.1:
      //
      // "If the Dialling Number/SSC String does not contain
      // a dialling number, e.g. a control string deactivating
      // a service, the TON/NPI byte shall be set to 'FF' by
      // the ME (see note 2)."

      number = PhoneNumberUtils.calledPartyBCDToString(record, footerOffset + 1, numberLength);

      extRecord = 0xff & record[record.length - 1];

      emails = null;
      additionalNumbers = null;

    } catch (RuntimeException ex) {
      Log.w(LOG_TAG, "Error parsing AdnRecord", ex);
      number = "";
      alphaTag = "";
      emails = null;
      additionalNumbers = null;
    }
  }