Skip to content

Commit 719c9e6

Browse files
Fix byte array slicing in debug classpath logging
1 parent b31d280 commit 719c9e6

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

  • dd-java-agent/instrumentation/sofarpc/sofarpc-5.0

dd-java-agent/instrumentation/sofarpc/sofarpc-5.0/build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ tasks.named('compileLatestDepTestGroovy') {
4040
classpath.files.findAll { it.name.contains('sofa') }.each { f ->
4141
println " sofa artifact: ${f.name} exists=${f.exists()} size=${f.exists() ? f.size() : 'MISSING'}"
4242
if (f.exists() && f.size() < 1_000_000) {
43-
def bytes = f.bytes.take(256)
43+
def allBytes = f.bytes
44+
def len = Math.min(256, allBytes.length)
45+
def bytes = allBytes[0..<len]
4446
println " first bytes (hex): ${bytes.encodeHex()}"
4547
println " first bytes (text): ${new String(bytes).replaceAll('[\\x00-\\x1f\\x7f-\\xff]', '.')}"
4648
}

0 commit comments

Comments
 (0)