< prev index next >
src/java.desktop/share/classes/javax/imageio/spi/ImageReaderWriterSpi.java
Print this page
*** 602,619 ****
ex.initCause(e);
throw ex;
}
}
private Class<?> getMetadataFormatClass(String formatClassName) {
Module thisModule = ImageReaderWriterSpi.class.getModule();
Module targetModule = this.getClass().getModule();
! Class<?> c = Class.forName(targetModule, formatClassName);
if (thisModule.equals(targetModule) || c == null) {
return c;
}
! if (thisModule.isNamed()) {
int i = formatClassName.lastIndexOf(".");
String pn = i > 0 ? formatClassName.substring(0, i) : "";
if (!targetModule.isExported(pn, thisModule)) {
throw new IllegalStateException("Class " + formatClassName +
" in named module must be exported to java.desktop module.");
--- 602,628 ----
ex.initCause(e);
throw ex;
}
}
+ // If updating this method also see the same in IIOMetadata.java
private Class<?> getMetadataFormatClass(String formatClassName) {
Module thisModule = ImageReaderWriterSpi.class.getModule();
Module targetModule = this.getClass().getModule();
! Class<?> c = null;
! try {
! ClassLoader cl = this.getClass().getClassLoader();
! c = Class.forName(formatClassName, false, cl);
! if (!IIOMetadataFormat.class.isAssignableFrom(c)) {
! return null;
! }
! } catch (ClassNotFoundException e) {
! }
if (thisModule.equals(targetModule) || c == null) {
return c;
}
! if (targetModule.isNamed()) {
int i = formatClassName.lastIndexOf(".");
String pn = i > 0 ? formatClassName.substring(0, i) : "";
if (!targetModule.isExported(pn, thisModule)) {
throw new IllegalStateException("Class " + formatClassName +
" in named module must be exported to java.desktop module.");
< prev index next >