summaryrefslogtreecommitdiff
path: root/gnu/classpath/jdwp/util/Location.java
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/classpath/jdwp/util/Location.java')
-rw-r--r--gnu/classpath/jdwp/util/Location.java40
1 files changed, 31 insertions, 9 deletions
diff --git a/gnu/classpath/jdwp/util/Location.java b/gnu/classpath/jdwp/util/Location.java
index 005b12c2b..89e81e563 100644
--- a/gnu/classpath/jdwp/util/Location.java
+++ b/gnu/classpath/jdwp/util/Location.java
@@ -94,18 +94,40 @@ public class Location
* @param os stream to write to
* @throws IOException when an error occurs writing to the stream
*/
- public void write(DataOutputStream os)
+ public void write(DataOutputStream os)
throws IOException
{
- VMIdManager idm = VMIdManager.getDefault();
- ClassReferenceTypeId crti = (ClassReferenceTypeId)
- idm.getReferenceTypeId(method.getDeclaringClass());
-
- crti.writeTagged(os);
- method.writeId(os);
- os.writeLong(index);
+ // check if this is an empty location
+ if (method != null)
+ {
+ VMIdManager idm = VMIdManager.getDefault();
+ ClassReferenceTypeId crti =
+ (ClassReferenceTypeId)
+ idm.getReferenceTypeId(method.getDeclaringClass());
+
+ crti.writeTagged(os);
+ method.writeId(os);
+ os.writeLong(index);
+ }
+ else
+ {
+ os.writeByte(1);
+ os.writeLong((long) 0);
+ os.writeLong((long) 0);
+ os.writeLong((long) 0);
+ }
}
-
+
+ /**
+ * Sets up an empty location
+ *
+ * @return new Location (setup as empty)
+ */
+ public static Location getEmptyLocation()
+ {
+ return new Location(null, 0);
+ }
+
/**
* Gets the method of this location
*