Mantis - Squeak
Viewing Issue Advanced Details
7434 System minor always 12-30-09 06:13 04-18-10 21:57
Kirtai  
laza  
normal  
closed trunk  
fixed  
none    
none trunk  
0007434: LRUCache>>#printOn: causes a ZeroDivide exception if the cache is not yet used.
When I evaluated "Object allSubInstances select: [:object | object asString ~= object printString]" it triggered a ZeroDivide exception on LRUCache>>#printOn:

That method contains the line
"(hits / calls) asFloat asString"
which of course fails if calls is zero for a not yet used cache.

A simple fix would be to check for calls being zero.
 LRUCache.jmg.1.cs [^] (636 bytes) 01-04-10 02:09

Notes
(0013454)
jgonis   
01-04-10 02:10   
Added a changeset to add a divide by zero check to the printOn: method. Hopefully this is acceptable.
(0013470)
leves   
01-13-10 14:55   
The best would be to upload an mcz with the fix to The Inbox.
(0013538)
laza   
03-09-10 20:43   
Fixed in 9653 with System-laza.289

This is a slightly different patch that should also make

LRUCache new printString

work