@@ -1376,14 +1376,26 @@ public Object get( String key, Integer hashCode, boolean asString ) {
13761376 if ( log .isInfoEnabled () )
13771377 log .info ( "++++ deserializing " + o .getClass () );
13781378 }
1379+ catch ( InvalidClassException e ) {
1380+ /* Errors de-serializing are to be expected in the case of a
1381+ * long running server that spans client restarts with updated
1382+ * classes.
1383+ */
1384+ // if we have an errorHandler, use its hook
1385+ if ( errorHandler != null )
1386+ errorHandler .handleErrorOnGet ( this , e , key );
1387+
1388+ o = null ;
1389+ log .error ( "++++ InvalidClassException thrown while trying to deserialize for key: " + key + " -- " + e .getMessage () );
1390+ }
13791391 catch ( ClassNotFoundException e ) {
13801392
13811393 // if we have an errorHandler, use its hook
13821394 if ( errorHandler != null )
13831395 errorHandler .handleErrorOnGet ( this , e , key );
13841396
1397+ o = null ;
13851398 log .error ( "++++ ClassNotFoundException thrown while trying to deserialize for key: " + key + " -- " + e .getMessage () );
1386- throw new NestedIOException ( "+++ failed while trying to deserialize for key: " + key , e );
13871399 }
13881400 }
13891401 }
@@ -1717,19 +1729,32 @@ private void loadMulti( LineInputStream input, Map<String,Object> hm, boolean as
17171729 if ( log .isInfoEnabled () )
17181730 log .info ( "++++ deserializing " + o .getClass () );
17191731 }
1732+ catch ( InvalidClassException e ) {
1733+ /* Errors de-serializing are to be expected in the case of a
1734+ * long running server that spans client restarts with updated
1735+ * classes.
1736+ */
1737+ // if we have an errorHandler, use its hook
1738+ if ( errorHandler != null )
1739+ errorHandler .handleErrorOnGet ( this , e , key );
1740+
1741+ o = null ;
1742+ log .error ( "++++ InvalidClassException thrown while trying to deserialize for key: " + key + " -- " + e .getMessage () );
1743+ }
17201744 catch ( ClassNotFoundException e ) {
17211745
17221746 // if we have an errorHandler, use its hook
17231747 if ( errorHandler != null )
17241748 errorHandler .handleErrorOnGet ( this , e , key );
17251749
1750+ o = null ;
17261751 log .error ( "++++ ClassNotFoundException thrown while trying to deserialize for key: " + key + " -- " + e .getMessage () );
1727- throw new NestedIOException ( "+++ failed while trying to deserialize for key: " + key , e );
17281752 }
17291753 }
17301754
17311755 // store the object into the cache
1732- hm .put ( key , o );
1756+ if ( o != null )
1757+ hm .put ( key , o );
17331758 }
17341759 else if ( END .equals ( line ) ) {
17351760 if ( log .isDebugEnabled () )
0 commit comments