String serialProvider = _externalContext.getInitParameter(StateUtils.SERIAL_FACTORY);
SerialFactory serialFactory = null;
if (serialProvider == null)
{
serialFactory = new DefaultSerialFactory();
}
else
{
try
{
serialFactory = (SerialFactory) ClassUtils.newInstance(serialProvider);
}
catch (ClassCastException e)
{
log.log(Level.SEVERE, "Make sure '" + serialProvider + "' implements the correct interface", e);
}
catch (Exception e)
{
log.log(Level.SEVERE,"", e);
}
finally
{
if (serialFactory == null)
{
serialFactory = new DefaultSerialFactory();
log.severe("Using default serialization provider");
}
}
}