Commit 6d225ea9 authored by Lubomir Bulej's avatar Lubomir Bulej

Use the classInfo field of the InstrumentClassRequest

parent cd2aecda
......@@ -4,6 +4,7 @@ import ch.usi.dag.disl.DiSL;
import ch.usi.dag.disl.DiSL.CodeOption;
import ch.usi.dag.disl.DiSLException;
import ch.usi.dag.disl.JavaNames;
import ch.usi.dag.dislserver.Protocol.ClassInfo;
import ch.usi.dag.dislserver.Protocol.InstrumentClassRequest;
import ch.usi.dag.dislserver.Protocol.InstrumentClassResponse;
import ch.usi.dag.util.Strings;
......@@ -46,14 +47,16 @@ final class RequestProcessor {
public InstrumentClassResponse process (final InstrumentClassRequest request) {
final byte [] classBytes = request.getClassBytes ().toByteArray ();
final String className = __getClassName (request.getClassNameBytes ().toByteArray (), classBytes);
final ClassInfo classInfo = request.getClassInfo ();
final String className = __getClassName (classInfo.getClassName (), classBytes);
final Set <CodeOption> options = CodeOption.setOf (request.getFlags ());
"instrumenting class %s [%d bytes, %s]",
if (__log.debugIsLoggable ()) {
__log.debug (
"processing class %s of classloader %d [%d bytes, %s]",
className.isEmpty () ? "<unknown>" : className,
classBytes.length, Strings.join ("+", options)
classInfo.getClassLoaderTag (), classBytes.length,
Strings.join ("+", options)
);
}
......@@ -112,22 +115,19 @@ final class RequestProcessor {
private static String __getClassName (
final byte [] nameBytes, final byte [] classBytes
final String name, final byte [] classBytes
) {
String result = Strings.EMPTY_STRING;
if (nameBytes.length > 0) {
result = new String (nameBytes);
}
if (result.isEmpty ()) {
result = JavaNames.getClassNameFromBytes (classBytes);
if (!name.isEmpty ()) {
return name;
} else {
String result = JavaNames.getClassNameFromBytes (classBytes);
if (result == null || result.isEmpty ()) {
result = UUID.randomUUID ().toString ();
}
}
return result;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment