Hi !

I hit another similar bug today in ClassTypeCommandSet where the case superclass == NULL is not considered.
This causes a NullPointerException.


Keith Seitz wrote:

No, I do not have write access to the classpath CVS.


I can commit for you.

ChangeLog entry:
2006-05-29  Martin Platter  <[EMAIL PROTECTED]>
* gnu/classpath/jdwp/processor/EventRequestCommandSet.java (executeSet): Bugfix: Buffer underflow in reading reference ID. * gnu/classpath/jdwp/processor/ThreadGroupReferenceCommandSet.java (executeParent): Bugfix: Nullpointer Exception if ThreadGroup is top-level ThreadGroup.


Please send to list. Also note Tom Tromey's message about coding style conformance. See http://www.gnu.org/software/classpath/docs/hacking.html#SEC6 .

Repost to list, and I will commit if everything is good.

Oh, I should probably ask: Do you have an FSF assignment for classpath on file? These two changes are small enough not to warrant getting one, but if you manage to fix something with a much less trivial patch, then you'll probably need one.

Keith

No, I do not have such an FSF assignment for classpath.


Martin
Index: gnu/classpath/jdwp/processor/ClassTypeCommandSet.java
===================================================================
RCS file: 
/sources/classpath/classpath/gnu/classpath/jdwp/processor/ClassTypeCommandSet.java,v
retrieving revision 1.5
diff -u -r1.5 ClassTypeCommandSet.java
--- gnu/classpath/jdwp/processor/ClassTypeCommandSet.java       8 Sep 2005 
17:18:59 -0000       1.5
+++ gnu/classpath/jdwp/processor/ClassTypeCommandSet.java       30 May 2006 
15:06:24 -0000
@@ -106,8 +106,12 @@
     Class clazz = refId.getType();
     Class superClazz = clazz.getSuperclass();
 
-    ReferenceTypeId clazzId = idMan.getReferenceTypeId(superClazz);
-    clazzId.write(os);
+    if (superClazz == null) {
+       os.writeLong(0L);
+    } else {
+       ReferenceTypeId clazzId = idMan.getReferenceTypeId(superClazz);
+       clazzId.write(os);
+    }
   }
 
   private void executeSetValues(ByteBuffer bb, DataOutputStream os)
Index: gnu/classpath/jdwp/processor/EventRequestCommandSet.java
===================================================================
RCS file: 
/sources/classpath/classpath/gnu/classpath/jdwp/processor/EventRequestCommandSet.java,v
retrieving revision 1.4
diff -u -r1.4 EventRequestCommandSet.java
--- gnu/classpath/jdwp/processor/EventRequestCommandSet.java    8 Sep 2005 
17:18:59 -0000       1.4
+++ gnu/classpath/jdwp/processor/EventRequestCommandSet.java    30 May 2006 
15:06:25 -0000
@@ -147,7 +147,7 @@
             if (id == 0)
               refId = null;
             else
-              refId = idMan.readReferenceTypeId(bb);
+              refId = idMan.getReferenceType(id);
             boolean caught = (bb.get() == 0) ? false : true;
             boolean unCaught = (bb.get() == 0) ? false : true;
             filter = new ExceptionOnlyFilter(refId, caught, unCaught);
Index: gnu/classpath/jdwp/processor/ThreadGroupReferenceCommandSet.java
===================================================================
RCS file: 
/sources/classpath/classpath/gnu/classpath/jdwp/processor/ThreadGroupReferenceCommandSet.java,v
retrieving revision 1.3
diff -u -r1.3 ThreadGroupReferenceCommandSet.java
--- gnu/classpath/jdwp/processor/ThreadGroupReferenceCommandSet.java    8 Sep 
2005 17:18:59 -0000       1.3
+++ gnu/classpath/jdwp/processor/ThreadGroupReferenceCommandSet.java    30 May 
2006 15:06:26 -0000
@@ -103,8 +103,12 @@
     ObjectId oid = idMan.readObjectId(bb);
     ThreadGroup group = (ThreadGroup) oid.getObject();
     ThreadGroup parent = group.getParent();
-    ObjectId parentId = idMan.getObjectId(parent);
-    parentId.write(os);
+    if (parent == null) {
+       os.writeLong(0L);
+    } else {
+       ObjectId parentId = idMan.getObjectId(parent);
+       parentId.write(os);     
+    }
   }
 
   private void executeChildren(ByteBuffer bb, DataOutputStream os)

Reply via email to