Passing negative integer to EventRequest.addCountFilter(int) does not
throw any exception but enabling the same request causes the following
exception.
Exception in thread "main" com.sun.jdi.InternalException: Unexpected JDWP Error:
512
at com.sun.tools.jdi.JDWPException.toJDIException(JDWPException.java:59)
at com.sun.tools.jdi.EventRequestManagerImpl$EventRequestImpl.set(EventR
equestManagerImpl.java:176)
at com.sun.tools.jdi.EventRequestManagerImpl$EventRequestImpl.setEnabled
(EventRequestManagerImpl.java:143)
at com.sun.tools.jdi.EventRequestManagerImpl$EventRequestImpl.enable(Eve
ntRequestManagerImpl.java:130)
at CountFilterTest.runTests(CountFilterTest.java:45)
at JDIScaffold.startTests(JDIScaffold.java:186)
at CountFilterTest.main(CountFilterTest.java:20)
Testing done in JDK1.3.0-O(Win32)
Steps to reporduce the error:
-----------------------------
1. Set the path to latest JDK(Kestrel).
2. Set classpath to <jdk>/lib/tools.jar
2. Compile all the attached files.
3. First start the Target VM with the command
java -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=y,
address=5670 RequestTest
4. Start the debugger with the command
java CountFilterTest
5. Output got is
----------------------------------------------------
[D:/raji/jbug/bugneg] java CountFilterTest
vm is com.sun.tools.jdi.VirtualMachineImpl@73831b
got vm
JVM version:1.3.0
JDI version: 1.3
JVM description: Java Debug Interface (Reference Implementation) version 1.3
Java Debug Wire Protocol (Reference Implementation) version 1.0
JVM Debug Interface version 1.0
JVM version 1.3.0 (Java HotSpot(TM) Client VM, interpreted mode)
1.addCountFilter() FAILED- takes negative arguments
com.sun.jdi.InternalException: Unexpected JDWP Error: 512
1.addCountFilter() FAILED
------------------------------------------------------
Attachments:
------------
1. JDIScaffold.java
2. VMConnection.java
3. CountFilterTest.java
4. RequestTest.java - Target application
***************************************************************
import java.util.*;
import com.sun.jdi.*;
import com.sun.jdi.event.*;
import com.sun.jdi.request.*;
/**
* API test for com.sun.jdi.request.BreakpointRequest.addCountFilter()method.
*/
public class CountFilterTest extends JDIScaffold {
final String[] args;
ReferenceType referenceType, referenceType1;
EventRequestManager requestManager;
public static void main(String args[]) throws Exception {
new CountFilterTest(args).startTests();
}
public CountFilterTest(String args[]) {
super();
this.args = args;
}
protected void runTests() throws Exception {
connect(args);
waitForVMStart();
requestManager = vm().eventRequestManager();
referenceType = resumeToPrepareOf("RequestTest").referenceType();
/** Test1 - Passing negative counts for addCountFilter
*/
Location negativeLocation = findLocation(referenceType,14);
BreakpointRequest negativeRequest = requestManager.
createBreakpointRequest(negativeLocation);
try {
negativeRequest.addCountFilter(-5);
System.out.println("1.addCountFilter() FAILED- takes negative arguments");
} catch(Exception e) {
System.out.println("1.addCountFilter() PASSED- for passing negative arguments");
}
try {
negativeRequest.enable();
} catch(Exception e) {
System.out.println(e);
System.out.println("1.addCountFilter() FAILED");
}
}
}
*************************************************************
public class RequestTest {
public static int count=0;
public static void main(String args[]) {
RequestTest requesttest = new RequestTest();
for(int i=0;i<10;i++) {
requesttest.testMethod();
}
}
public void testMethod() {
count++;
System.out.println(" test message line");
}
}
*************************************************************
throw any exception but enabling the same request causes the following
exception.
Exception in thread "main" com.sun.jdi.InternalException: Unexpected JDWP Error:
512
at com.sun.tools.jdi.JDWPException.toJDIException(JDWPException.java:59)
at com.sun.tools.jdi.EventRequestManagerImpl$EventRequestImpl.set(EventR
equestManagerImpl.java:176)
at com.sun.tools.jdi.EventRequestManagerImpl$EventRequestImpl.setEnabled
(EventRequestManagerImpl.java:143)
at com.sun.tools.jdi.EventRequestManagerImpl$EventRequestImpl.enable(Eve
ntRequestManagerImpl.java:130)
at CountFilterTest.runTests(CountFilterTest.java:45)
at JDIScaffold.startTests(JDIScaffold.java:186)
at CountFilterTest.main(CountFilterTest.java:20)
Testing done in JDK1.3.0-O(Win32)
Steps to reporduce the error:
-----------------------------
1. Set the path to latest JDK(Kestrel).
2. Set classpath to <jdk>/lib/tools.jar
2. Compile all the attached files.
3. First start the Target VM with the command
java -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=y,
address=5670 RequestTest
4. Start the debugger with the command
java CountFilterTest
5. Output got is
----------------------------------------------------
[D:/raji/jbug/bugneg] java CountFilterTest
vm is com.sun.tools.jdi.VirtualMachineImpl@73831b
got vm
JVM version:1.3.0
JDI version: 1.3
JVM description: Java Debug Interface (Reference Implementation) version 1.3
Java Debug Wire Protocol (Reference Implementation) version 1.0
JVM Debug Interface version 1.0
JVM version 1.3.0 (Java HotSpot(TM) Client VM, interpreted mode)
1.addCountFilter() FAILED- takes negative arguments
com.sun.jdi.InternalException: Unexpected JDWP Error: 512
1.addCountFilter() FAILED
------------------------------------------------------
Attachments:
------------
1. JDIScaffold.java
2. VMConnection.java
3. CountFilterTest.java
4. RequestTest.java - Target application
***************************************************************
import java.util.*;
import com.sun.jdi.*;
import com.sun.jdi.event.*;
import com.sun.jdi.request.*;
/**
* API test for com.sun.jdi.request.BreakpointRequest.addCountFilter()method.
*/
public class CountFilterTest extends JDIScaffold {
final String[] args;
ReferenceType referenceType, referenceType1;
EventRequestManager requestManager;
public static void main(String args[]) throws Exception {
new CountFilterTest(args).startTests();
}
public CountFilterTest(String args[]) {
super();
this.args = args;
}
protected void runTests() throws Exception {
connect(args);
waitForVMStart();
requestManager = vm().eventRequestManager();
referenceType = resumeToPrepareOf("RequestTest").referenceType();
/** Test1 - Passing negative counts for addCountFilter
*/
Location negativeLocation = findLocation(referenceType,14);
BreakpointRequest negativeRequest = requestManager.
createBreakpointRequest(negativeLocation);
try {
negativeRequest.addCountFilter(-5);
System.out.println("1.addCountFilter() FAILED- takes negative arguments");
} catch(Exception e) {
System.out.println("1.addCountFilter() PASSED- for passing negative arguments");
}
try {
negativeRequest.enable();
} catch(Exception e) {
System.out.println(e);
System.out.println("1.addCountFilter() FAILED");
}
}
}
*************************************************************
public class RequestTest {
public static int count=0;
public static void main(String args[]) {
RequestTest requesttest = new RequestTest();
for(int i=0;i<10;i++) {
requesttest.testMethod();
}
}
public void testMethod() {
count++;
System.out.println(" test message line");
}
}
*************************************************************