From 3f5d7a15ff6f51679897221a48c663a5c7e88c13 Mon Sep 17 00:00:00 2001 From: Marcus Handte Date: Fri, 1 Dec 2023 17:49:40 +0100 Subject: [PATCH] Workaround for removal of deprecated ProductConfig constructor. See: https://github.com/wildfly/wildfly-core/commit/01460071c0033917e349d6ee1db99875e18aba58 --- .../patching/generator/DistributionProcessor.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/patch-gen/src/main/java/org/jboss/as/patching/generator/DistributionProcessor.java b/patch-gen/src/main/java/org/jboss/as/patching/generator/DistributionProcessor.java index 3005f9c..2362980 100644 --- a/patch-gen/src/main/java/org/jboss/as/patching/generator/DistributionProcessor.java +++ b/patch-gen/src/main/java/org/jboss/as/patching/generator/DistributionProcessor.java @@ -95,13 +95,16 @@ static void process(final DistributionContentItem parent, final File distributio final Class clazz = module.getClassLoader().loadClass("org.jboss.as.version.ProductConfig"); final Method resolveName = clazz.getMethod("resolveName"); final Method resolveVersion = clazz.getMethod("resolveVersion"); - final Constructor constructor = clazz.getConstructor(ModuleLoader.class, String.class, Map.class); - - final Object productConfig = constructor.newInstance(loader, distributionRoot.getAbsolutePath(), Collections.emptyMap()); - + Object productConfig = null; + try { + final Method fromFilesystemSlot = clazz.getMethod("fromFilesystemSlot", ModuleLoader.class, String.class, Map.class); + productConfig = fromFilesystemSlot.invoke(null, loader, distributionRoot.getAbsolutePath(), Collections.emptyMap()); + } catch (NoSuchMethodException e) { + final Constructor constructor = clazz.getConstructor(ModuleLoader.class, String.class, Map.class); + productConfig = constructor.newInstance(loader, distributionRoot.getAbsolutePath(), Collections.emptyMap()); + } distribution.setName((String) resolveName.invoke(productConfig)); distribution.setVersion((String) resolveVersion.invoke(productConfig)); - } catch (Exception e) { throw new IOException(e); }