History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: CACHE-112
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Andres March
Reporter: Sebastien Tardif
Votes: 1
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
OSCache

Exception not thrown when not serializable object is persisted instead stack trace is persisted!

Created: 29/Sep/04 04:20 PM   Updated: 19/Apr/05 02:36 PM
Component/s: Listeners
Affects Version/s: 2.1
Fix Version/s: 2.1.1

Environment: Lastest CVS version September 27, 2004


 Description  « Hide
The following JUnit test run successfully, without ever receiving an exception from the cache engine which is not normal. The persisted object are the Exception which is persisted.

public void TestNotSerializableObject() throws Exception
    {
        java.util.Properties properties = new java.util.Properties();
        final String CACHE_DIRECTORY_PATH = "\\temp\\unique\\";
        properties.setProperty("cache.path", CACHE_DIRECTORY_PATH);
        properties.setProperty("cache.persistence.class", "com.opensymphony.oscache.plugins.diskpersistence.DiskPersistenceListener");
        properties.setProperty("cache.persistence.overflow.only", "true");
        properties.setProperty("cache.algorithm", "cache.algorithm=com.opensymphony.oscache.base.algorithm.LRUCache");
        properties.setProperty("cache.capacity", "2");
        properties.setProperty("cache.unlimited.disk", "true");
        GeneralCacheAdministrator cache = new GeneralCacheAdministrator(properties);
        cache.putInCache("1", new UnSerializable());
        cache.putInCache("2", new UnSerializable());
        assertTrue(isDirectoryEmpty(CACHE_DIRECTORY_PATH));
        cache.putInCache("3", new UnSerializable());
        cache.putInCache("4", new UnSerializable());
        assertTrue(!isDirectoryEmpty(CACHE_DIRECTORY_PATH));
        cache.flushAll();
    }
    
public static class UnSerializable
    {
        int asdfasdfasdf = 234;
    };

cache directory have those files after successfully running this JUnit test:
1.cache
2.cache
having for content the serialization of the exception, look something like:
...
java.io.NotSerializableException
...

 All   Comments   Change History      Sort Order:
Andres March - [12/Mar/05 12:47 AM ]
Exception is thrown and correctly caught. This shoul not be fatal. Added cleanup to delete file.