You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Youngho Cho (JIRA)" <ji...@apache.org> on 2015/05/09 14:29:00 UTC

[jira] [Updated] (JCS-149) When reading keys from disk, a StreamCorruptedException happen when custom serialzer applied.

     [ https://issues.apache.org/jira/browse/JCS-149?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Youngho Cho updated JCS-149:
----------------------------
    Summary: When reading keys from disk, a StreamCorruptedException happen when custom serialzer applied.  (was: When reading keys from disk StreamCorruptedException happen when custom serialzer applied.)

> When reading keys from disk, a StreamCorruptedException happen when custom serialzer applied.
> ---------------------------------------------------------------------------------------------
>
>                 Key: JCS-149
>                 URL: https://issues.apache.org/jira/browse/JCS-149
>             Project: Commons JCS
>          Issue Type: Bug
>          Components: Indexed Disk Cache
>    Affects Versions: jcs-2.0-beta-1, jcs-2.0
>            Reporter: Youngho Cho
>
> When reading keys from disk, following StreamCorruptedException happen when custom serialzer applied.
> I attached the patch for this bug.
> 2015-05-09 21:15:41,368 [main] ERROR org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCache - Region [com_nannet_fulcrum_morphology_ko_entry_WordEntry] Problem loading keys for file com_nannet_fulcrum_morphology_ko_entry_WordEntry
> java.io.StreamCorruptedException: invalid stream header: 78DA5BF3
> 	at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:806)
> 	at java.io.ObjectInputStream.<init>(ObjectInputStream.java:299)
> 	at org.apache.commons.jcs.io.ObjectInputStreamClassLoaderAware.<init>(ObjectInputStreamClassLoaderAware.java:33)
> 	at org.apache.commons.jcs.utils.serialization.StandardSerializer.deSerialize(StandardSerializer.java:79)
> 	at org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDisk.readObject(IndexedDisk.java:118)
> 	at org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCache.loadKeys(IndexedDiskCache.java:333)
> 	at org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCache.initializeStoreFromPersistedData(IndexedDiskCache.java:285)
> 	at org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCache.initializeKeysAndData(IndexedDiskCache.java:249)
> 	at org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCache.<init>(IndexedDiskCache.java:182)
> 	at org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCache.<init>(IndexedDiskCache.java:154)
> 	at org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCacheFactory.createCache(IndexedDiskCacheFactory.java:61)
> Here is a patch.
> We need an ElementSerializer during IndexedDiskCache object creation because when key read from disk, we need serializer info.
> Index: indexed/IndexedDiskCacheFactory.java
> ===================================================================
> --- indexed/IndexedDiskCacheFactory.java	(revision 1678464)
> +++ indexed/IndexedDiskCacheFactory.java	(working copy)
> @@ -57,9 +57,8 @@
>              log.debug( "Creating DiskCache for attributes = " + idca );
>          }
>  
> -        IndexedDiskCache<K, V> cache = new IndexedDiskCache<K, V>( idca );
> +        IndexedDiskCache<K, V> cache = new IndexedDiskCache<K, V>( idca, elementSerializer);
>          cache.setCacheEventLogger( cacheEventLogger );
> -        cache.setElementSerializer(elementSerializer);
>  
>          return cache;
>      }
> Thanks
> Youngho



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)