Uploaded image for project: 'Commons JCS'
  1. Commons JCS
  2. JCS-149

When reading keys from disk, a StreamCorruptedException happen when custom serialzer applied.

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

      Description

      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

        Attachments

          Activity

            People

            • Assignee:
              tv Thomas Vandahl
              Reporter:
              youngho Youngho Cho

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment