< prev index next >

src/java.desktop/share/classes/javax/imageio/metadata/IIOMetadata.java

Print this page

        

*** 412,429 **** ex.initCause(e); throw ex; } } private Class<?> getMetadataFormatClass(String formatClassName) { Module thisModule = IIOMetadata.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."); --- 412,438 ---- ex.initCause(e); throw ex; } } + // If updating this method also see the same in ImageReaderWriterSpi.java private Class<?> getMetadataFormatClass(String formatClassName) { Module thisModule = IIOMetadata.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 >