Bug 47084

GemBuilder for Java

3.1.3, 3.1.2, 3.1.1, 3.1, 3.0.1, 3.0

All Platforms

Enumeration over large collection of registered class instances can fail with ClassCastException

IF:

1.  Using registerStub to establish a correspondence between a java and GS Smalltalk class
2.  Enumerating over a collection of instances of this class replicated from the server
3.  The size of the preload buffer (set in GbjSession.initialize( ) ) is smaller than the number of objects in the replicated collection

THEN:

The retrieval of elements that were not preloaded will fail with a java.lang.ClassCastException.

Example:

    GbjSession s;
    // ( code to login session s here )
    s.registerStub(new TestObject(), "TestObject");
    GbjCollection c = (GbjCollection)s.doit( <code to return large collection of TestObjects> );
    for (Enumeration e = c.elements(); e.hasMoreElements(); ) {
     TestObject x = (TestObject)e.nextElement(); << will fail here
    }

Workaround

If feasible, increase the size of the preload buffer to accomodate the full collection.

If not practical, refactor code to retrieve a subsection of the full collection in batches that are small enough to fit in the preload buffer.


                

Last updated: 4/2/20