570 if (supportsStandard && formatName.equals
571 (IIOMetadataFormatImpl.standardMetadataFormatName)) {
572
573 return IIOMetadataFormatImpl.getStandardFormatInstance();
574 }
575 String formatClassName = null;
576 if (formatName.equals(nativeName)) {
577 formatClassName = nativeClassName;
578 } else if (extraNames != null) {
579 for (int i = 0; i < extraNames.length; i++) {
580 if (formatName.equals(extraNames[i])) {
581 formatClassName = extraClassNames[i];
582 break; // out of for
583 }
584 }
585 }
586 if (formatClassName == null) {
587 throw new IllegalArgumentException("Unsupported format name");
588 }
589 try {
590 Class cls = Class.forName(formatClassName, true,
591 ClassLoader.getSystemClassLoader());
592 Method meth = cls.getMethod("getInstance");
593 return (IIOMetadataFormat) meth.invoke(null);
594 } catch (Exception e) {
595 RuntimeException ex =
596 new IllegalStateException ("Can't obtain format");
597 ex.initCause(e);
598 throw ex;
599 }
600 }
601 }
|
570 if (supportsStandard && formatName.equals
571 (IIOMetadataFormatImpl.standardMetadataFormatName)) {
572
573 return IIOMetadataFormatImpl.getStandardFormatInstance();
574 }
575 String formatClassName = null;
576 if (formatName.equals(nativeName)) {
577 formatClassName = nativeClassName;
578 } else if (extraNames != null) {
579 for (int i = 0; i < extraNames.length; i++) {
580 if (formatName.equals(extraNames[i])) {
581 formatClassName = extraClassNames[i];
582 break; // out of for
583 }
584 }
585 }
586 if (formatClassName == null) {
587 throw new IllegalArgumentException("Unsupported format name");
588 }
589 try {
590 Class<?> cls = Class.forName(formatClassName, true,
591 ClassLoader.getSystemClassLoader());
592 Method meth = cls.getMethod("getInstance");
593 return (IIOMetadataFormat) meth.invoke(null);
594 } catch (Exception e) {
595 RuntimeException ex =
596 new IllegalStateException ("Can't obtain format");
597 ex.initCause(e);
598 throw ex;
599 }
600 }
601 }
|