Skip to content

Commit c706c5b

Browse files
Fix byte array cast in debug logging
1 parent 719c9e6 commit c706c5b

File tree

1 file changed

+1
-3
lines changed
  • dd-java-agent/instrumentation/sofarpc/sofarpc-5.0

1 file changed

+1
-3
lines changed

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ 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 allBytes = f.bytes
44-
def len = Math.min(256, allBytes.length)
45-
def bytes = allBytes[0..<len]
43+
byte[] bytes = Arrays.copyOf(f.bytes, Math.min(256, (int) f.size()))
4644
println " first bytes (hex): ${bytes.encodeHex()}"
4745
println " first bytes (text): ${new String(bytes).replaceAll('[\\x00-\\x1f\\x7f-\\xff]', '.')}"
4846
}

0 commit comments

Comments
 (0)