@@ -1376,14 +1376,26 @@ public Object get( String key, Integer hashCode, boolean asString ) {
1376
1376
if ( log .isInfoEnabled () )
1377
1377
log .info ( "++++ deserializing " + o .getClass () );
1378
1378
}
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
+ }
1379
1391
catch ( ClassNotFoundException e ) {
1380
1392
1381
1393
// if we have an errorHandler, use its hook
1382
1394
if ( errorHandler != null )
1383
1395
errorHandler .handleErrorOnGet ( this , e , key );
1384
1396
1397
+ o = null ;
1385
1398
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 );
1387
1399
}
1388
1400
}
1389
1401
}
@@ -1717,19 +1729,32 @@ private void loadMulti( LineInputStream input, Map<String,Object> hm, boolean as
1717
1729
if ( log .isInfoEnabled () )
1718
1730
log .info ( "++++ deserializing " + o .getClass () );
1719
1731
}
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
+ }
1720
1744
catch ( ClassNotFoundException e ) {
1721
1745
1722
1746
// if we have an errorHandler, use its hook
1723
1747
if ( errorHandler != null )
1724
1748
errorHandler .handleErrorOnGet ( this , e , key );
1725
1749
1750
+ o = null ;
1726
1751
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 );
1728
1752
}
1729
1753
}
1730
1754
1731
1755
// store the object into the cache
1732
- hm .put ( key , o );
1756
+ if ( o != null )
1757
+ hm .put ( key , o );
1733
1758
}
1734
1759
else if ( END .equals ( line ) ) {
1735
1760
if ( log .isDebugEnabled () )
0 commit comments