Source:
void setXMsCliTelemData(final String xMsCliTelem) { if (StringExtensions.isNullOrBlank(xMsCliTelem)) { return; } else { Logger.d(TAG, "Parsing x-ms-clitelem header: " + xMsCliTelem); } String[] headerSegments = xMsCliTelem.split(","); if (0 == headerSegments.length) { Logger.w(TAG, "SPE Ring header missing version field.", null, ADALError.X_MS_CLITELEM_VERSION_UNRECOGNIZED); return; } final String headerVersion = headerSegments[0]; String errorCode = null; String subErrorCode = null; String tokenAge = null; String speRing = null; if (headerVersion.equals("1")) { final int delimCount = 4; if (delimCount != xMsCliTelem.length() - xMsCliTelem.replace(",", "").length()) { Logger.w(TAG, "", "", ADALError.X_MS_CLITELEM_MALFORMED); return; } headerSegments = xMsCliTelem.split(",", 5); final int indexErrorCode = 1; final int indexSubErrorCode = 2; final int indexTokenAge = 3; final int indexSpeInfo = 4; errorCode = headerSegments[indexErrorCode]; subErrorCode = headerSegments[indexSubErrorCode]; tokenAge = headerSegments[indexTokenAge]; speRing = headerSegments[indexSpeInfo]; } else { Logger.w(TAG, "Unexpected header version: " + headerVersion, null, ADALError.X_MS_CLITELEM_VERSION_UNRECOGNIZED); } if (!StringExtensions.isNullOrBlank(errorCode) && !errorCode.equals("0")) { setServerErrorCode(errorCode); } if (!StringExtensions.isNullOrBlank(subErrorCode) && !subErrorCode.equals("0")) { setServerSubErrorCode(subErrorCode); } if (!StringExtensions.isNullOrBlank(tokenAge)) { setRefreshTokenAge(tokenAge); } if (!StringExtensions.isNullOrBlank(speRing)) { setSpeRing(speRing); } }

Target:
void setXMsCliTelemData(final String xMsCliTelem) { if (StringExtensions.isNullOrBlank(xMsCliTelem)) { return; } String[] headerSegments = xMsCliTelem.split(","); if (0 == headerSegments.length) { Logger.w(TAG, "SPE Ring header missing version field.", null, ADALError.X_MS_CLITELEM_VERSION_UNRECOGNIZED); return; } final String headerVersion = headerSegments[0]; String errorCode = null; String subErrorCode = null; String tokenAge = null; String speRing = null; if (headerVersion.equals("1")) { final int delimCount = 4; Pattern headerFmt = Pattern.compile("^[1-9]+\\.?[0-9|\\.]*,[0-9|\\.]*,[0-9|\\.]*,[^,]*[0-9\\.]*,[^,]*$"); Matcher matcher = headerFmt.matcher(xMsCliTelem); if (!matcher.matches()) { Logger.w(TAG, "", "", ADALError.X_MS_CLITELEM_MALFORMED); return; } headerSegments = xMsCliTelem.split(",", delimCount + 1); final int indexErrorCode = 1; final int indexSubErrorCode = 2; final int indexTokenAge = 3; final int indexSpeInfo = 4; errorCode = headerSegments[indexErrorCode]; subErrorCode = headerSegments[indexSubErrorCode]; tokenAge = headerSegments[indexTokenAge]; speRing = headerSegments[indexSpeInfo]; } else { Logger.w(TAG, "Unexpected header version: " + headerVersion, null, ADALError.X_MS_CLITELEM_VERSION_UNRECOGNIZED); } if (!StringExtensions.isNullOrBlank(errorCode) && !errorCode.equals("0")) { setServerErrorCode(errorCode); } if (!StringExtensions.isNullOrBlank(subErrorCode) && !subErrorCode.equals("0")) { setServerSubErrorCode(subErrorCode); } if (!StringExtensions.isNullOrBlank(tokenAge)) { setRefreshTokenAge(tokenAge); } if (!StringExtensions.isNullOrBlank(speRing)) { setSpeRing(speRing); } }