[kaffe] Reproducible bugs running Freenet under Kaffe

Oskar Sandberg oskar@freenetproject.org
Thu, 24 Oct 2002 16:52:52 +0200


--UlVJffcvxoiEqYs2
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Thu, Oct 24, 2002 at 03:18:41PM +0100, Matthew Toseland wrote:
> Ok, I've got CVS working now, and I get a NullPointerException,
> reliably, in java.lang.Class.getResourceAsStream. Attached.

Class.java throws an NPE if getResourceAsStream is run for a resource
that does not exist. This is obviously when looking at the code. I've
attached a (trivial) patch.

-- 

Oskar Sandberg
oskar@freenetproject.org

--UlVJffcvxoiEqYs2
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=classdiff

Index: libraries/javalib/java/lang/Class.java
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/javalib/java/lang/Class.java,v
retrieving revision 1.37
diff -c -r1.37 Class.java
*** libraries/javalib/java/lang/Class.java	4 Sep 2002 16:08:13 -0000	1.37
--- libraries/javalib/java/lang/Class.java	24 Oct 2002 14:48:50 -0000
***************
*** 367,373 ****
   */
  public InputStream getResourceAsStream(String name) {
    	try {
!   		return (getResource(name).openStream());
    	}
    	catch (IOException e) {
    		return null;
--- 367,374 ----
   */
  public InputStream getResourceAsStream(String name) {
    	try {
!             URL res = getResource(name);
!             return (res == null ? null : res.openStream());
    	}
    	catch (IOException e) {
    		return null;

--UlVJffcvxoiEqYs2--