RNGP - Do not attempt to substring to 1024 while logging. (#47509)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47509

Fixes https://github.com/facebook/react-native/issues/47504

Changelog:
[Android] [Fixed] - RNGP - Do not attempt to substring to 1024 while logging

Reviewed By: javache

Differential Revision: D65659586

fbshipit-source-id: 8fa16131cea96b8b6aa9c0224c7b990a4f51175f
This commit is contained in:
Nicola Corti 2024-11-08 04:57:15 -08:00 committed by Facebook GitHub Bot
parent 3c32da5bfe
commit e64513bf4e

View File

@ -15,6 +15,7 @@ import java.math.BigInteger
import java.security.MessageDigest
import java.util.concurrent.TimeUnit
import javax.inject.Inject
import kotlin.math.min
import org.gradle.api.GradleException
import org.gradle.api.file.FileCollection
import org.gradle.api.initialization.Settings
@ -159,7 +160,10 @@ abstract class ReactSettingsExtension @Inject constructor(val settings: Settings
val logger = Logging.getLogger("ReactSettingsExtension")
logger.error(message)
if (cacheJsonConfig.length() != 0L) {
logger.error(cacheJsonConfig.readText().substring(0, 1024))
logger.error(
cacheJsonConfig
.readText()
.substring(0, min(1024, cacheJsonConfig.length().toInt())))
}
cacheJsonConfig.delete()
throw GradleException(message)