NTP-1857 | DateTimeFormatter parsing crash fix (#12481)

This commit is contained in:
Shaurya Rehan
2024-09-11 16:16:16 +05:30
committed by GitHub
parent 216fd0f161
commit 8552d8d97a
2 changed files with 3 additions and 3 deletions

View File

@@ -90,7 +90,7 @@ import com.navi.pay.utils.NAVI_PAY_LOCAL_URI_SCHEME
import com.navi.pay.utils.NAVI_PAY_NON_ENCRYPT_SHARED_PREF_DATA_KEYS
import com.navi.pay.utils.NAVI_PAY_TRANSACTION_HISTORY_TAG_SEPARATOR
import com.navi.pay.utils.NEEDS_RESULT
import com.navi.pay.utils.PLUS
import com.navi.pay.utils.TIME_ZONE_OFFSET
import com.navi.pay.utils.Z
import com.navi.pay.utils.customHide
import com.navi.pay.utils.getBankNameAccountNumberText
@@ -291,7 +291,7 @@ object NaviPayCommonUtils {
timeZone: DateTimeZone = DateTimeZone.getDefault()
): DateTime? {
dateTime?.let {
if (it.contains(other = Z) || it.contains(other = PLUS)) {
if (it.contains(other = Z) || it.matches(regex = TIME_ZONE_OFFSET)) {
return DateTime.parse(it).withZone(timeZone)
} else {
val updatedDateTime = "${it}Z"

View File

@@ -439,7 +439,7 @@ const val UPI_NUMBER_STATUS_NEW = "NEW"
// Regex Constants
val NOTES_REGEX = Regex(pattern = "^[a-zA-Z0-9 \\-]*\$")
val TIME_ZONE_OFFSET = Regex(pattern = "[-+]\\d{2}:\\d{2}\$")
val TIME_ZONE_OFFSET = Regex(pattern = ".*[-+]\\d{2}:\\d{2}\$")
val UPI_NUMBER_VALIDATION_REGEX = Regex("^\\d{8,10}\$")
val UPI_ID_VALIDATION_REGEX = Regex(pattern = ".+@.{2,}")
val SEARCH_QUERY_VALIDATION_REGEX = Regex("^\\+?\\d+\$")