Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java plain enabler does not provide metadata about z/OS #1927

Closed
pj892031 opened this issue Nov 26, 2021 · 1 comment
Closed

Java plain enabler does not provide metadata about z/OS #1927

pj892031 opened this issue Nov 26, 2021 · 1 comment
Labels
enhancement New feature or request extender this issue has been raised by an extender Priority: High technical excellence

Comments

@pj892031
Copy link
Contributor

All services using Java plain enabler got his message:

2021-11-26 08:59:26.569 <SDKATJ:main:33948876> SDKSERV (org.zowe.apiml.util.ClassOrDefaultProxyUtils:70) WARN Implementation com.ibm.jzos.ZUtil is not available with constructor signature .., it will continue with default one org.zowe.apiml.eurekaservice.client.impl.DefaultCustomMetadataHelper$$Lambda$858/0x00000000897ba730@8b1214b4 : Class org.zowe.apiml.util.ClassOrDefaultProxyUtils can notccess a member of class com.ibm.jzos.ZUtil with modifiers "private"

It means adding metadata about the operating system is out of order. This is not a requirement, just it is good to collect those values.

The reason is class DefaultCustomMetadataHelper uses com.ibm.jzos.ZUtil to fetch data. Class ZUtil has no constructor and all methods are static (see https://www.ibm.com/docs/api/v1/content/SSYKE2_7.0.0/com.ibm.java.zsecurity.api.70.doc/com.ibm.jzos/com/ibm/jzos/ZUtil.html).

return createProxyByConstructor(interfaceClass, implementationClassName, defaultImplementation, new Class[]{}, new Object[]{}, exceptionMappings);

In this particular case will be probably the best solution to create new method like:

    public static <T> T createProxyStatic(Class<T> interfaceClass, String implementationClassName, Supplier<? extends T> defaultImplementation, ExceptionMapping<? extends Exception> ... exceptionMappings) {
        try {
            return createProxy(interfaceClass, implementationClassName, defaultImplementation, new Class[]{}, new Object[]{}, exceptionMappings);
        } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {
            log.warn("Implementation {} is not available with constructor signature {}, it will continue with default one {} : " + e.getLocalizedMessage(),
                implementationClassName, new Class[]{},  defaultImplementation);
        }

        return makeProxy(interfaceClass, defaultImplementation.get(), false, exceptionMappings);
    }

    public static <T> T createProxy(Class<T> interfaceClass, String implementationClassName, Supplier<? extends T> defaultImplementation, Class[] constructorSignature, Object[] constructorParams, ExceptionMapping<? extends Exception> ... exceptionMappings)
        throws ClassNotFoundException {
        ObjectUtil.requireNotNull(interfaceClass, "interfaceClass can't be null");
        ObjectUtil.requireNotEmpty(implementationClassName, "implementationClassName can't be empty");
        ObjectUtil.requireNotNull(defaultImplementation, "defaultImplementation can't be null");
        ObjectUtil.requireNotNull(constructorSignature, "constructorSignature can't be null");
        ObjectUtil.requireNotNull(constructorParams, "constructorParams can't be null");

        final Class<?> implementationClazz = Class.forName(implementationClassName);
        return makeProxy(interfaceClass, implementationClazz, true, exceptionMappings);
    }

Anyway, this will have probably a consequence and it will be also good to check that mapping in this case (implementationClass instanceof java.lang.Class) works only with static methods (disable finding an instance method in this case).

@pj892031 pj892031 added the new New issue that has not been worked on yet label Nov 26, 2021
@achmelo achmelo added mentee and removed new New issue that has not been worked on yet labels Dec 6, 2021
@balhar-jakub balhar-jakub added extender this issue has been raised by an extender Priority: High and removed 22PI1 labels May 3, 2022
@balhar-jakub
Copy link
Member

This seems to be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request extender this issue has been raised by an extender Priority: High technical excellence
Projects
None yet
Development

No branches or pull requests

4 participants