summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Galloway <kgallowa@redhat.com>2006-07-27 14:45:37 +0000
committerKyle Galloway <kgallowa@redhat.com>2006-07-27 14:45:37 +0000
commitf9680eba53633d4705d0e9a7d95e2b31808ccaf1 (patch)
tree75c3bc670f4b53a7ab81db1acfee4a4b5dba0514
parent1e8ffe30494a92727b8aef88941a1e6a8a4f67de (diff)
downloadclasspath-f9680eba53633d4705d0e9a7d95e2b31808ccaf1.tar.gz
2006-07-18 Kyle Galloway <kgallowa@redhat.com>
* gnu/classpath/jdwp/event/ExceptionEvent.java: Added _klass field to hold defining class. (getParameter): Returns _klass field instead of determining class from _instance. (setCatchLoc): New method. (writeData): Now assumes Location deals with empty locations instead of using null. * gnu/classpath/jdwp/util/Location.java (write): Check for empty locations and write out accordingly. (getEmptyLocation): New method.
-rw-r--r--ChangeLog13
-rw-r--r--gnu/classpath/jdwp/event/ExceptionEvent.java27
-rw-r--r--gnu/classpath/jdwp/util/Location.java40
3 files changed, 64 insertions, 16 deletions
diff --git a/ChangeLog b/ChangeLog
index 75e18eb11..4eee6e6f3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2006-07-18 Kyle Galloway <kgallowa@redhat.com>
+
+ * gnu/classpath/jdwp/event/ExceptionEvent.java: Added _klass field to hold
+ defining class.
+ (getParameter): Returns _klass field instead of determining
+ class from _instance.
+ (setCatchLoc): New method.
+ (writeData): Now assumes Location deals with empty locations instead of
+ using null.
+ * gnu/classpath/jdwp/util/Location.java (write): Check for empty
+ locations and write out accordingly.
+ (getEmptyLocation): New method.
+
2006-07-27 Roman Kennke <kennke@aicas.com>
* javax/swing/text/SimpleAttributeSet.java
diff --git a/gnu/classpath/jdwp/event/ExceptionEvent.java b/gnu/classpath/jdwp/event/ExceptionEvent.java
index a51e69c8f..1303c09be 100644
--- a/gnu/classpath/jdwp/event/ExceptionEvent.java
+++ b/gnu/classpath/jdwp/event/ExceptionEvent.java
@@ -70,6 +70,9 @@ public class ExceptionEvent
//the location where the exception was caught
private Location _catchLocation;
+
+ //the class where the exeption was thrown
+ private Class _klass;
/**
* Constructs a new <code>ExceptionEvent</code> where the exception was
@@ -82,13 +85,14 @@ public class ExceptionEvent
* @param instance the instance that threw the exception
*/
public ExceptionEvent(Throwable exception, Thread thread, Location location,
- Location catchLocation, Object instance)
+ Location catchLocation, Class clazz, Object instance)
{
super(JdwpConstants.EventKind.EXCEPTION);
_exception = exception;
_thread = thread;
_location = location;
_catchLocation = catchLocation;
+ _klass = clazz;
_instance = instance;
}
@@ -108,17 +112,28 @@ public class ExceptionEvent
else if (type == EVENT_INSTANCE)
return _instance;
else if (type == EVENT_CLASS)
- return _instance.getClass();
+ return _klass;
else if (type == EVENT_EXCEPTION_CLASS)
return _exception.getClass();
else if (type == EVENT_EXCEPTION_CAUGHT)
- if (_catchLocation != null)
+ if (_catchLocation.getMethod() != null)
return new Boolean(true);
else
return new Boolean(false);
return null;
}
+
+ /**
+ * Sets the catchLocation, used for exceptions that are caught in different
+ * stack frames from where they are thrown.
+ *
+ * @param catchLoc the location of the catch
+ */
+ public void setCatchLoc(Location catchLoc)
+ {
+ _catchLocation = catchLoc;
+ }
/**
* Writes the event to the given stream
@@ -136,9 +151,7 @@ public class ExceptionEvent
tid.write(outStream);
_location.write(outStream);
oid.writeTagged(outStream);
- if(_catchLocation != null)
- _catchLocation.write(outStream);
- else
- outStream.write(0);
+ _catchLocation.write(outStream);
+
}
}
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
*