Fix UTFDataFormatException on encoding long subplugin options.
ObjectOutputStream.writeUTF(String) has an unsigned short limit on String length. On Projects with deep nested modules subplugin options could produce String over this limit. ^KT-45202 Fixed
This commit is contained in:
committed by
Yahor Berdnikau
parent
f8ab16c823
commit
b2372ff0b9
+4
-1
@@ -23,6 +23,7 @@ import org.jetbrains.kotlin.gradle.tasks.CompilerPluginOptions
|
||||
import java.io.ByteArrayOutputStream
|
||||
import java.io.File
|
||||
import java.io.ObjectOutputStream
|
||||
import java.nio.charset.StandardCharsets
|
||||
import java.util.*
|
||||
|
||||
fun encodePluginOptions(options: Map<String, List<String>>): String {
|
||||
@@ -35,7 +36,9 @@ fun encodePluginOptions(options: Map<String, List<String>>): String {
|
||||
|
||||
oos.writeInt(values.size)
|
||||
for (value in values) {
|
||||
oos.writeUTF(value)
|
||||
val valueBytes = value.toByteArray(StandardCharsets.UTF_8)
|
||||
oos.writeInt(valueBytes.size)
|
||||
oos.write(valueBytes)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user