本文整理汇总了Java中org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket.getNextValueAsByte方法的典型用法代码示例。如果您正苦于以下问题:Java ReplyPacket.getNextValueAsByte方法的具体用法?Java ReplyPacket.getNextValueAsByte怎么用?Java ReplyPacket.getNextValueAsByte使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket
的用法示例。
在下文中一共展示了ReplyPacket.getNextValueAsByte方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTypeID
import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入方法依赖的package包/类
/**
* Gets TypeID for specified type signature and type tag.
*
* @param typeSignature
* type signature
* @param classTypeTag
* type tag
* @return received TypeID
*/
public long getTypeID(String typeSignature, byte classTypeTag) {
int classes = 0;
byte refTypeTag = 0;
long typeID = -1;
// Request referenceTypeID for exception
ReplyPacket classReference = getClassBySignature(typeSignature);
// Get referenceTypeID from received packet
classes = classReference.getNextValueAsInt();
for (int i = 0; i < classes; i++) {
refTypeTag = classReference.getNextValueAsByte();
if (refTypeTag == classTypeTag) {
typeID = classReference.getNextValueAsReferenceTypeID();
classReference.getNextValueAsInt();
break;
} else {
classReference.getNextValueAsReferenceTypeID();
classReference.getNextValueAsInt();
refTypeTag = 0;
}
}
return typeID;
}
示例2: getClassIDBySignature
import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入方法依赖的package包/类
/**
* Returns classID for the selected jni signature
*
* @param signature
* @return classID for the selected jni signature
*/
protected long getClassIDBySignature(String signature) {
logWriter.println("=> Getting reference type ID for class: "
+ signature);
CommandPacket packet = new CommandPacket(
JDWPCommands.VirtualMachineCommandSet.CommandSetID,
JDWPCommands.VirtualMachineCommandSet.ClassesBySignatureCommand);
packet.setNextValueAsString(signature);
ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
checkReplyPacket(reply, "VirtualMachine::ClassesBySignature command");
int classes = reply.getNextValueAsInt();
logWriter.println("=> Returned number of classes: " + classes);
long classID = 0;
for (int i = 0; i < classes; i++) {
reply.getNextValueAsByte();
classID = reply.getNextValueAsReferenceTypeID();
reply.getNextValueAsInt();
// we need the only class, even if there were multiply ones
break;
}
assertTrue(
"VirtualMachine::ClassesBySignature command returned invalid classID:<"
+ classID + "> for signature " + signature, classID > 0);
return classID;
}
示例3: getReferenceTypeID
import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入方法依赖的package包/类
/**
* Returns reference type ID.
*
* @param signature
* @return type ID for the selected jni signature
*/
protected long getReferenceTypeID(String signature) {
CommandPacket packet = new CommandPacket(
JDWPCommands.VirtualMachineCommandSet.CommandSetID,
JDWPCommands.VirtualMachineCommandSet.ClassesBySignatureCommand);
packet.setNextValueAsString(signature);
ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
checkReplyPacket(reply, "VirtualMachine::ClassesBySignature command");
int classes = reply.getNextValueAsInt();
// this class may be loaded only once
assertEquals("Invalid number of classes for reference type: "
+ signature + ",", 1, classes);
byte refTypeTag = reply.getNextValueAsByte();
long classID = reply.getNextValueAsReferenceTypeID();
int status = reply.getNextValueAsInt();
logWriter.println("VirtualMachine.ClassesBySignature: classes="
+ classes + " refTypeTag=" + refTypeTag + " typeID= " + classID
+ " status=" + status);
assertAllDataRead(reply);
assertEquals("", JDWPConstants.TypeTag.CLASS, refTypeTag);
return classID;
}
示例4: getClassIDBySignature
import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入方法依赖的package包/类
protected long getClassIDBySignature(String signature) {
logWriter.println("=> Getting reference type ID for class: " + signature);
CommandPacket packet = new CommandPacket(
JDWPCommands.VirtualMachineCommandSet.CommandSetID,
JDWPCommands.VirtualMachineCommandSet.ClassesBySignatureCommand);
packet.setNextValueAsString(signature);
ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
if (!checkReplyPacketWithoutFail(reply, "VirtualMachine::ClassesBySignature command")) {
throw new TestErrorException("Error during performing VirtualMachine::ClassesBySignature command");
}
int classes = reply.getNextValueAsInt();
logWriter.println("=> Returned number of classes: " + classes);
long classID = 0;
for (int i = 0; i < classes; i++) {
reply.getNextValueAsByte();
classID = reply.getNextValueAsReferenceTypeID();
reply.getNextValueAsInt();
// we need the only class, even if there were multiply ones
break;
}
assertTrue("VirtualMachine::ClassesBySignature command returned invalid classID:<" +
classID + "> for signature " + signature, classID > 0);
return classID;
}
示例5: getObjectID
import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入方法依赖的package包/类
private long getObjectID() {
// Compose Instances command to get tested thread objectID
CommandPacket InstancesCommand = new CommandPacket(
JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
JDWPCommands.ReferenceTypeCommandSet.InstancesCommand);
long testThreadTypeID = getClassIDBySignature(testObjSignature);
InstancesCommand.setNextValueAsReferenceTypeID(testThreadTypeID);
InstancesCommand.setNextValueAsInt(1);
ReplyPacket checkedReply = debuggeeWrapper.vmMirror
.performCommand(InstancesCommand);
InstancesCommand = null;
// Get the number of instances that returned.
int objNum = checkedReply.getNextValueAsInt();
// Get the tagged-objectID
byte tag = checkedReply.getNextValueAsByte();
long objectID = checkedReply.getNextValueAsObjectID();
return objectID;
}
示例6: getReferenceType
import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入方法依赖的package包/类
/**
* Returns the runtime type of the object
*
* @param objectID
* The object ID
* @return The runtime reference type.
*/
public final long getReferenceType(long objectID) {
CommandPacket command = new CommandPacket(
JDWPCommands.ObjectReferenceCommandSet.CommandSetID,
JDWPCommands.ObjectReferenceCommandSet.ReferenceTypeCommand);
command.setNextValueAsObjectID(objectID);
ReplyPacket reply = checkReply(performCommand(command));
reply.getNextValueAsByte();
return reply.getNextValueAsLong();
}
示例7: getObjectReferenceType
import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入方法依赖的package包/类
/**
* Helper that returns reference type ID for input object ID.
*
* @param objectID -
* debuggee object ID
* @return reference type ID
*/
protected long getObjectReferenceType(long objectID) {
CommandPacket command = new CommandPacket(
JDWPCommands.ObjectReferenceCommandSet.CommandSetID,
JDWPCommands.ObjectReferenceCommandSet.ReferenceTypeCommand);
command.setNextValueAsReferenceTypeID(objectID);
ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(command);
checkReplyPacket(reply, "ObjectReference::ReferenceType command");
// byte refTypeTag =
reply.getNextValueAsByte();
long objectRefTypeID = reply.getNextValueAsReferenceTypeID();
return objectRefTypeID;
}
示例8: testBytecodesTest001
import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入方法依赖的package包/类
/**
* This testcase exercises Method.Bytecodes command.
* <BR>It runs MethodDebuggee. Gets methods with ReferenceType.Methods command,
* prints it's bytecodes received with Method.Bytecodes command.
*/
public void testBytecodesTest001() throws UnsupportedEncodingException {
logWriter.println("testBytecodesTest001 started");
//check capability, relevant for this test
logWriter.println("=> Check capability: canGetBytecodes");
debuggeeWrapper.vmMirror.capabilities();
boolean isCapability = debuggeeWrapper.vmMirror.targetVMCapabilities.canGetBytecodes;
if (!isCapability) {
logWriter.println("##WARNING: this VM doesn't possess capability: canGetBytecodes");
return;
}
synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
long classID = getClassIDBySignature("L"+getDebuggeeClassName().replace('.', '/')+";");
MethodInfo[] methodsInfo = jdwpGetMethodsInfo(classID);
assertFalse("Invalid number of methods", methodsInfo.length == 0);
for (int i = 0; i < methodsInfo.length; i++) {
logWriter.println(methodsInfo[i].toString());
// get variable table for this class
CommandPacket packet = new CommandPacket(
JDWPCommands.MethodCommandSet.CommandSetID,
JDWPCommands.MethodCommandSet.BytecodesCommand);
packet.setNextValueAsClassID(classID);
packet.setNextValueAsMethodID(methodsInfo[i].getMethodID());
ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
checkReplyPacket(reply, "Method::Bytecodes command");
int bytes = reply.getNextValueAsInt();
logWriter.println("bytes = " + bytes);
byte[] bytecode = new byte[bytes];
for (int j = 0; j < bytes; j++) {
bytecode[j] = reply.getNextValueAsByte();
}
logWriter.println("Bytecode=" + new String(bytecode));
}
synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
}
示例9: testInstances_String
import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入方法依赖的package包/类
/**
* It starts InstancesDebuggee class, requests referenceTypeId for String
* class by VirtualMachine.ClassesBySignature command, then performs
* ReferenceType.Instances command and checks that returned reachable String
* objects are expected.
*/
public void testInstances_String() {
String thisTestName = "testInstances_String";
// check capability, relevant for this test
logWriter.println("=> Check capability: canGetInstanceInfo");
debuggeeWrapper.vmMirror.capabilities();
boolean isCapability = debuggeeWrapper.vmMirror.targetVMCapabilities.canGetInstanceInfo;
if (!isCapability) {
logWriter
.println("##WARNING: this VM dosn't possess capability: canGetInstanceInfo");
return;
}
logWriter.println("==> " + thisTestName + " for " + thisCommandName
+ ": START...");
synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
long stringRefTypeID = getClassIDBySignature(stringSignature);
maxInstances = 10;
logWriter.println("=> CHECK: send " + thisCommandName
+ " and check reply for ERROR...");
CommandPacket InstancesCommand = new CommandPacket(
JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
JDWPCommands.ReferenceTypeCommandSet.InstancesCommand);
InstancesCommand.setNextValueAsReferenceTypeID(stringRefTypeID);
InstancesCommand.setNextValueAsInt(maxInstances);
ReplyPacket checkedReply = debuggeeWrapper.vmMirror
.performCommand(InstancesCommand);
InstancesCommand = null;
checkReplyPacket(checkedReply, thisTestName);
// Get the number of instances that returned.
int reachableInstancesNum = checkedReply.getNextValueAsInt();
for (int i = 0; i < reachableInstancesNum; i++) {
// Get the tagged-objectID
byte tag = checkedReply.getNextValueAsByte();
assertEquals(thisCommandName + "returned String tag is invalid.",
's', tag, null, null);
long objectID = checkedReply.getNextValueAsObjectID();
logWriter.println("=> ObjectID is: " + objectID);
}
logWriter.println("=> CHECK: PASSED: expected instances are returned:");
synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
logWriter.println("==> " + thisTestName + " for " + thisCommandName
+ ": FINISH");
assertAllDataRead(checkedReply);
}
示例10: testInstances_Array
import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入方法依赖的package包/类
/**
* It starts InstancesDebuggee class, requests referenceTypeId for Array
* class by VirtualMachine.ClassesBySignature command, then performs
* ReferenceType.Instances command and checks that returned reachable Array
* objects are expected.
*/
public void testInstances_Array() {
String thisTestName = "testInstances_Array";
// check capability, relevant for this test
logWriter.println("=> Check capability: canGetInstanceInfo");
debuggeeWrapper.vmMirror.capabilities();
boolean isCapability = debuggeeWrapper.vmMirror.targetVMCapabilities.canGetInstanceInfo;
if (!isCapability) {
logWriter
.println("##WARNING: this VM dosn't possess capability: canGetInstanceInfo");
return;
}
logWriter.println("==> " + thisTestName + " for " + thisCommandName
+ ": START...");
synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
long intArrayRefTypeID = getClassIDBySignature(intArraySignature);
maxInstances = 10;
logWriter.println("=> CHECK: send " + thisCommandName
+ " and check reply for ERROR...");
CommandPacket InstancesCommand = new CommandPacket(
JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
JDWPCommands.ReferenceTypeCommandSet.InstancesCommand);
InstancesCommand.setNextValueAsReferenceTypeID(intArrayRefTypeID);
InstancesCommand.setNextValueAsInt(maxInstances);
ReplyPacket checkedReply = debuggeeWrapper.vmMirror
.performCommand(InstancesCommand);
InstancesCommand = null;
checkReplyPacket(checkedReply, thisTestName);
// Get the number of instances that returned.
int reachableInstancesNum = checkedReply.getNextValueAsInt();
for (int i = 0; i < reachableInstancesNum; i++) {
// Get the tagged-objectID
byte tag = checkedReply.getNextValueAsByte();
assertEquals(thisCommandName + "returned Array tag is invalid.",
'[', tag, null, null);
long objectID = checkedReply.getNextValueAsObjectID();
logWriter.println("=> ObjectID is: " + objectID);
}
logWriter.println("=> CHECK: PASSED: expected instances are returned:");
synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
logWriter.println("==> " + thisTestName + " for " + thisCommandName
+ ": FINISH");
assertAllDataRead(checkedReply);
}
示例11: testAllClassesWithGeneric002
import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入方法依赖的package包/类
/**
* This testcase exercises VirtualMachine.AllClassesWithGeneric command.
* <BR>At first the test starts HelloWorld debuggee.
* <BR> Then the test performs VirtualMachine.AllClassesWithGeneric
* command and checks that:
* <BR> - number of reference types returned by command has
* non-zero value;
* <BR> - there are no classes with the 'ARRAY' or
* 'PRIMITIVE' bits in the status flag;
*/
public void testAllClassesWithGeneric002() {
logWriter.println("==> testAllClassesWithGeneric002: START...");
synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
logWriter.println("==> Send VirtualMachine::AllClassesWithGeneric command...");
CommandPacket packet = new CommandPacket(
JDWPCommands.VirtualMachineCommandSet.CommandSetID,
JDWPCommands.VirtualMachineCommandSet.AllClassesWithGenericCommand);
ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
checkReplyPacket(reply, "VirtualMachine::AllClassesWithGeneric command");
long typeID;
String signature, genericSignature;
int status;
int classes = reply.getNextValueAsInt();
assertTrue(classes > 0);
int count = 0;
for (int i = 0; i < classes; i++) {
reply.getNextValueAsByte();
typeID = reply.getNextValueAsReferenceTypeID();
signature = reply.getNextValueAsString();
genericSignature = reply.getNextValueAsString();
status = reply.getNextValueAsInt();
if ( (status & JDWPConstants.ClassStatus.ARRAY) != 0 ){
logWriter.println("## FAILURE: Unexpected status is returned:");
logWriter.println("## ReferenceTypeId = " + typeID);
logWriter.println("## Class signature: " + signature);
logWriter.println("## Class generic signature: " + genericSignature);
logWriter.println("## Class status = 0x" + Integer.toHexString(status)
+ "(" + JDWPConstants.ClassStatus.getName(status)+ ")");
logWriter.println("## Status \"0x"
+ Integer.toHexString(JDWPConstants.ClassStatus.ARRAY)
+ "("
+ JDWPConstants.ClassStatus.getName(JDWPConstants.ClassStatus.ARRAY)
+ ")\" must NOT be returned!");
count++;
}
if ( (status & JDWPConstants.ClassStatus.PRIMITIVE) != 0 ){
logWriter.println("## FAILURE: Unexpected status is returned:");
logWriter.println("## ReferenceTypeId = " + typeID);
logWriter.println("## Class signature: " + signature);
logWriter.println("## Class generic signature: " + genericSignature);
logWriter.println("## Class status = 0x" + Integer.toHexString(status)
+ "(" + JDWPConstants.ClassStatus.getName(status)+ ")");
logWriter.println("## Status \"0x"
+ Integer.toHexString(JDWPConstants.ClassStatus.PRIMITIVE)
+ "("
+ JDWPConstants.ClassStatus.getName(JDWPConstants.ClassStatus.PRIMITIVE)
+ ")\" must NOT be returned!");
count++;
}
}
assertEquals("count must be 0", 0, count);
synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
logWriter.println("==> testAllClassesWithGeneric002: OK.");
}
示例12: testAllClasses002
import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入方法依赖的package包/类
/**
* This testcase exercises VirtualMachine.AllClasses command.
* <BR>At first the test starts HelloWorld debuggee.
* <BR> Then the test performs VirtualMachine.AllClasses command and checks that:
* <BR> - number of reference types returned by command has
* non-zero value;
* <BR> - there are no classes with the 'ARRAY' or
* 'PRIMITIVE' bits in the status flag;
*/
public void testAllClasses002() {
logWriter.println("==> testAllClasses002: START...");
synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
logWriter.println("==> Send VirtualMachine::AllClasses command...");
CommandPacket packet = new CommandPacket(
JDWPCommands.VirtualMachineCommandSet.CommandSetID,
JDWPCommands.VirtualMachineCommandSet.AllClassesCommand);
ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
checkReplyPacket(reply, "VirtualMachine::AllClasses command");
long typeID;
String signature;
int status;
int classes = reply.getNextValueAsInt();
assertTrue(classes > 0);
int count = 0;
for (int i = 0; i < classes; i++) {
reply.getNextValueAsByte();
typeID = reply.getNextValueAsReferenceTypeID();
signature = reply.getNextValueAsString();
status = reply.getNextValueAsInt();
if ( (status & JDWPConstants.ClassStatus.ARRAY) != 0 ){
logWriter.println("## FAILURE: Unexpected status is returned:");
logWriter.println("## ReferenceTypeId = " + typeID);
logWriter.println("## Class signature: " + signature);
logWriter.println("## Class status = 0x" + Integer.toHexString(status)
+ "(" + JDWPConstants.ClassStatus.getName(status)+ ")");
logWriter.println("## Status \"0x"
+ Integer.toHexString(JDWPConstants.ClassStatus.ARRAY)
+ "("
+ JDWPConstants.ClassStatus.getName(JDWPConstants.ClassStatus.ARRAY)
+ ")\" must NOT be returned!");
count++;
}
if ( (status & JDWPConstants.ClassStatus.PRIMITIVE) != 0 ){
logWriter.println("## FAILURE: Unexpected status is returned:");
logWriter.println("## ReferenceTypeId = " + typeID);
logWriter.println("## Class signature: " + signature);
logWriter.println("## Class status = 0x" + Integer.toHexString(status)
+ "(" + JDWPConstants.ClassStatus.getName(status)+ ")");
logWriter.println("## Status \"0x"
+ Integer.toHexString(JDWPConstants.ClassStatus.PRIMITIVE)
+ "("
+ JDWPConstants.ClassStatus.getName(JDWPConstants.ClassStatus.PRIMITIVE)
+ ")\" must NOT be returned!");
count++;
}
}
assertEquals("count must be 0", 0, count);
synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
logWriter.println("==> testAllClasses002: OK.");
}
示例13: testVisibleClasses001
import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入方法依赖的package包/类
/**
* This testcase exercises ClassLoaderReference.VisibleClasses command.
* <BR>Starts <A HREF="../share/debuggee/HelloWorld.html">HelloWorld</A> debuggee.
* <BR>Then the following statements are checked:
* <BR>It is expected:
* <BR> - number of reference types has non-zero value;
* <BR> - refTypeTag takes one of the TypeTag constants: CLASS, INTERFACE, ARRAY;
* <BR> - All data were read;
*/
public void testVisibleClasses001() {
synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
CommandPacket packet = new CommandPacket(
JDWPCommands.ClassLoaderReferenceCommandSet.CommandSetID,
JDWPCommands.ClassLoaderReferenceCommandSet.VisibleClassesCommand);
packet.setNextValueAsClassLoaderID(0);
ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
checkReplyPacket(reply, "ClassLoaderReference::VisibleClasses command");
byte refTypeTag;
String refTypeTagName;
long typeID;
String msgLine;
int classes = reply.getNextValueAsInt();
logWriter.println("Number of reference types = " + classes);
assertTrue("Invalid returned number of reference types = " + classes, classes > 0);
int printBound_1 = classes;
int printBound_2 = 0;
if (classes > 50) {
printBound_1 = 5;
printBound_2 = classes - 5;
}
for (int i = 0; i < classes; i++) {
refTypeTag = reply.getNextValueAsByte();
refTypeTagName = JDWPConstants.TypeTag.getName(refTypeTag);
msgLine = "" + i + ". refTypeTag = " + refTypeTagName + "(" + refTypeTag + ")";
typeID = reply.getNextValueAsReferenceTypeID();
msgLine = msgLine + "; referenceTypeID = " + typeID;
if ( (i < printBound_1) || (i >= printBound_2) ) {
logWriter.println(msgLine);
if ( i == (printBound_1 - 1) ) {
logWriter.println("...\n...\n...");
}
}
assertTrue("Unexpected reference TagType:<" + refTypeTag + "(" + refTypeTagName + ")>",
refTypeTag == JDWPConstants.TypeTag.ARRAY
|| refTypeTag == JDWPConstants.TypeTag.CLASS
|| refTypeTag == JDWPConstants.TypeTag.INTERFACE);
}
assertAllDataRead(reply);
synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
}
示例14: testReferringObjects_IllegalArgument
import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入方法依赖的package包/类
/**
* This testcase exercises ObjectReference.ReferringObjects command. <BR>
* Compose a ReferringObjects command with negative maxReferrers
* The vm should throw a ILLEGAL_ARGUMENT exception.
*/
public void testReferringObjects_IllegalArgument() {
String thisTestName = "testReferringObjects_IllegalArgument";
if (!isCapability()) {
logWriter.println("##WARNING: this VM dosn't possess capability: canGetInstanceInfo");
return;
}
int maxReferrers = -1;
logWriter.println("==> " + thisTestName + " for " + thisCommandName + ": START...");
synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
// Compose Instances command to get referree objectID
CommandPacket InstancesCommand = new CommandPacket(
JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
JDWPCommands.ReferenceTypeCommandSet.InstancesCommand);
long referreeObjTypeID = getClassIDBySignature(referreeObjSignature);
InstancesCommand.setNextValueAsReferenceTypeID(referreeObjTypeID);
InstancesCommand.setNextValueAsInt(1);
ReplyPacket checkedReply = debuggeeWrapper.vmMirror.performCommand(InstancesCommand);
InstancesCommand = null;
// Get the number of instances that returned.
int objNum = checkedReply.getNextValueAsInt();
// Get the tagged-objectID
byte tag = checkedReply.getNextValueAsByte();
long objectID = checkedReply.getNextValueAsObjectID();
// Compose ReferringObjects commnad
CommandPacket ReferringObjectsCommand = new CommandPacket(
JDWPCommands.ObjectReferenceCommandSet.CommandSetID,
JDWPCommands.ObjectReferenceCommandSet.ReferringObjectsCommand);
ReferringObjectsCommand.setNextValueAsObjectID(objectID);
ReferringObjectsCommand.setNextValueAsInt(maxReferrers);
// Perform ReferringObjects command and attain reply package
checkedReply = debuggeeWrapper.vmMirror
.performCommand(ReferringObjectsCommand);
ReferringObjectsCommand = null;
short errorCode = checkedReply.getErrorCode();
if (errorCode != JDWPConstants.Error.NONE) {
if (errorCode == JDWPConstants.Error.NOT_IMPLEMENTED) {
logWriter.println("=> CHECK PASSED: Expected error (NOT_IMPLEMENTED) is returned");
return;
}
else if(errorCode == JDWPConstants.Error.ILLEGAL_ARGUMENT) {
logWriter.println("=> CHECK PASSED: Expected error (ILLEGAL_ARGUMENT) is returned");
return;
}
}
printErrorAndFail(thisCommandName + " should throw ILLEGAL_ARGUMENT exception when maxReferrers is negative.");
}