help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] buglet in FileDescriptor>>pastEnd


From: Stefan Schmiedl
Subject: [Help-smalltalk] buglet in FileDescriptor>>pastEnd
Date: Wed, 15 Jul 2009 16:15:12 +0200

Interesting things happen when you write to a file, forget to close
it, and then try to read from it ... with ObjectDumper.

ObjectDumpter>>nextByte does no error checking

    nextByte [
        "Return the next byte in the byte array"

        <category: 'private - binary I/O'>
        ^stream next asInteger
    ]

Now according to the docs, stream next answers nil if there is nothing
left, however the error was "FileStream does not understand asInteger"...


diff --git a/kernel/FileDescr.st b/kernel/FileDescr.st
index 043f204..3fd061f 100644
--- a/kernel/FileDescr.st
+++ b/kernel/FileDescr.st
@@ -778,7 +778,7 @@ do arbitrary processing on the files.'>
 
         <category: 'polymorphism'>
        atEnd := true.
-       super pastEnd
+       ^super pastEnd
     ]
 
     nextAvailable: n into: aCollection startingAt: position [

With this patch applied, I get the correct error

UndefinedObject(Object)>>doesNotUnderstand: #asInteger (AnsiExcept.st:1556)
ObjectDumper>>nextByte (ObjDumper.st:644)
ObjectDumper>>loadClass (ObjDumper.st:390)

which still should be caught somewhere in ObjectDumper, I think.

s.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]