Commit 9f8b8073 by Kyle Galloway Committed by Kyle Galloway

VMIdManager.java (getObjectId): Deal with null objects.

2007-04-25  Kyle Galloway  <kgallowa@redhat.com>

	* gnu/classpath/jdwp/VMIdManager.java (getObjectId): Deal with null
	objects.
	(get): Deal with ObjectId of 0.

From-SVN: r124164
parent aa86a51b
2007-04-25 Kyle Galloway <kgallowa@redhat.com>
* gnu/classpath/jdwp/VMIdManager.java (getObjectId): Deal with null
objects.
(get): Deal with ObjectId of 0.
2007-04-24 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> 2007-04-24 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
PR libgcj/31084 PR libgcj/31084
......
/* VMIdManager.java -- A reference/example implementation of a manager for /* VMIdManager.java -- A reference/example implementation of a manager for
JDWP object/reference type IDs JDWP object/reference type IDs
Copyright (C) 2005, 2006 Free Software Foundation Copyright (C) 2005, 2006, 2007 Free Software Foundation
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -337,6 +337,10 @@ public class VMIdManager ...@@ -337,6 +337,10 @@ public class VMIdManager
*/ */
public ObjectId getObjectId (Object theObject) public ObjectId getObjectId (Object theObject)
{ {
// Special case: null object.
if (theObject == null)
return new NullObjectId ();
ReferenceKey ref = new ReferenceKey (theObject, _refQueue); ReferenceKey ref = new ReferenceKey (theObject, _refQueue);
ObjectId id = (ObjectId) _oidTable.get (ref); ObjectId id = (ObjectId) _oidTable.get (ref);
if (id == null) if (id == null)
...@@ -364,6 +368,10 @@ public class VMIdManager ...@@ -364,6 +368,10 @@ public class VMIdManager
public ObjectId get (long id) public ObjectId get (long id)
throws InvalidObjectException throws InvalidObjectException
{ {
// Special case: null object id.
if (id == 0)
return new NullObjectId ();
ObjectId oid = (ObjectId) _idTable.get (new Long (id)); ObjectId oid = (ObjectId) _idTable.get (new Long (id));
if (oid == null) if (oid == null)
throw new InvalidObjectException (id); throw new InvalidObjectException (id);
......
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