Currently, if a source file is not found, this will pass null to
writeString, which will cause an NPE, crashing the communication thread
causing the VM to stop responding to commands from the debugger. This
patch fixes this by checking if the found source file string is null,
and if so, throwing an AbsentInformationException, causing the VM to
report it could not find the source file.
ChangeLog
2007-04-11 Kyle Galloway <[EMAIL PROTECTED]>
* gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java
(executeSourceFile): Throw an exception if no source file was found.
Questions/comments/concerns?
Thanks,
Kyle
Index: gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java
===================================================================
RCS file: /sources/classpath/classpath/gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java,v
retrieving revision 1.10
diff -u -r1.10 ReferenceTypeCommandSet.java
--- gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java 9 Mar 2007 21:23:10 -0000 1.10
+++ gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java 11 Apr 2007 14:58:43 -0000
@@ -42,6 +42,7 @@
import gnu.classpath.jdwp.JdwpConstants;
import gnu.classpath.jdwp.VMMethod;
import gnu.classpath.jdwp.VMVirtualMachine;
+import gnu.classpath.jdwp.exception.AbsentInformationException;
import gnu.classpath.jdwp.exception.InvalidFieldException;
import gnu.classpath.jdwp.exception.JdwpException;
import gnu.classpath.jdwp.exception.JdwpInternalErrorException;
@@ -249,6 +250,10 @@
// We'll need to go into the jvm for this unless there's an easier way
String sourceFileName = VMVirtualMachine.getSourceFile(clazz);
+
+ if (sourceFileName == null)
+ throw new AbsentInformationException("Source file not found");
+
JdwpString.writeString(os, sourceFileName);
// clazz.getProtectionDomain().getCodeSource().getLocation();
}