diff --git a/fj-core/src/main/java/org/fugerit/java/core/cfg/xml/GenericListCatalogConfig.java b/fj-core/src/main/java/org/fugerit/java/core/cfg/xml/GenericListCatalogConfig.java index 16e890d6..21d8d6fb 100644 --- a/fj-core/src/main/java/org/fugerit/java/core/cfg/xml/GenericListCatalogConfig.java +++ b/fj-core/src/main/java/org/fugerit/java/core/cfg/xml/GenericListCatalogConfig.java @@ -15,9 +15,11 @@ import javax.xml.transform.dom.DOMSource; import org.fugerit.java.core.cfg.ConfigException; +import org.fugerit.java.core.cfg.ConfigRuntimeException; import org.fugerit.java.core.cfg.helpers.AbstractConfigurableObject; import org.fugerit.java.core.cfg.helpers.XMLConfigurableObject; import org.fugerit.java.core.cfg.provider.ConfigProviderFacade; +import org.fugerit.java.core.function.SafeFunction; import org.fugerit.java.core.io.helper.StreamHelper; import org.fugerit.java.core.lang.helpers.BooleanUtils; import org.fugerit.java.core.lang.helpers.ClassHelper; @@ -268,11 +270,26 @@ public GenericListCatalogConfig( String attTagDataList, String attTagData ) { private Set entryIdCheck; - public static GenericListCatalogConfig load( InputStream is, GenericListCatalogConfig config ) throws Exception { - Document doc = DOMIO.loadDOMDoc( is, true ); - Element root = doc.getDocumentElement(); - config.configure( root ); - return config; + /** + *

Configure an instance of GenericListCatalogConfig

+ * + *

NOTE: starting in version 8.4.X java.lang.Exception removed in favor of org.fugerit.java.core.cfg.ConfigRuntimeException. + * ({@link https://gist.github.com/fugerit79/fdd401c6d457b57ba4a6b72ae998c385}

+ * + * @param the type of the elements in catalog + * @param is the input stream to load from + * @param config the instance to be configured + * @return the configured instance + * @throws ConfigRuntimeException in case of issues during loading + */ + public static GenericListCatalogConfig load( InputStream is, GenericListCatalogConfig config ) { + return SafeFunction.get( () -> { + Document doc = DOMIO.loadDOMDoc( is, true ); + Element root = doc.getDocumentElement(); + config.configure( root ); + return config; + } ); + } protected Set getEntryIdCheck() {