// TODO: Check if we can remove SuppressWarnings with a future JAI version.
@SuppressWarnings("unchecked")
final List<RenderedImageFactory> factories = registry.getOrderedFactoryList(
RenderedRegistryMode.MODE_NAME, operation, product);
if (factories != null) {
RenderedImageFactory javaFactory = null;
RenderedImageFactory nativeFactory = null;
Boolean currentState = null;
for (final RenderedImageFactory factory : factories) {
final String pack = factory.getClass().getPackage().getName();
if (pack.equals("com.sun.media.jai.mlib")) {
nativeFactory = factory;