aboutsummaryrefslogtreecommitdiff
path: root/libjava/gnu/classpath/jdwp/VMIdManager.java
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/gnu/classpath/jdwp/VMIdManager.java')
-rw-r--r--libjava/gnu/classpath/jdwp/VMIdManager.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/libjava/gnu/classpath/jdwp/VMIdManager.java b/libjava/gnu/classpath/jdwp/VMIdManager.java
index 8d423e9b0d6..f787a8cdc7f 100644
--- a/libjava/gnu/classpath/jdwp/VMIdManager.java
+++ b/libjava/gnu/classpath/jdwp/VMIdManager.java
@@ -1,7 +1,7 @@
/* VMIdManager.java -- A reference/example implementation of a manager for
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.
@@ -337,6 +337,10 @@ public class VMIdManager
*/
public ObjectId getObjectId (Object theObject)
{
+ // Special case: null object.
+ if (theObject == null)
+ return new NullObjectId ();
+
ReferenceKey ref = new ReferenceKey (theObject, _refQueue);
ObjectId id = (ObjectId) _oidTable.get (ref);
if (id == null)
@@ -364,6 +368,10 @@ public class VMIdManager
public ObjectId get (long id)
throws InvalidObjectException
{
+ // Special case: null object id.
+ if (id == 0)
+ return new NullObjectId ();
+
ObjectId oid = (ObjectId) _idTable.get (new Long (id));
if (oid == null)
throw new InvalidObjectException (id);