Search in sources :

Example 1 with InvalidEndpointRequestException

use of org.springframework.boot.actuate.endpoint.InvalidEndpointRequestException in project spring-boot by spring-projects.

the class EndpointMBean method invoke.

private Object invoke(JmxOperation operation, Object[] params) throws MBeanException, ReflectionException {
    try {
        String[] parameterNames = operation.getParameters().stream().map(JmxOperationParameter::getName).toArray(String[]::new);
        Map<String, Object> arguments = getArguments(parameterNames, params);
        InvocationContext context = new InvocationContext(SecurityContext.NONE, arguments);
        Object result = operation.invoke(context);
        if (REACTOR_PRESENT) {
            result = ReactiveHandler.handle(result);
        }
        return this.responseMapper.mapResponse(result);
    } catch (InvalidEndpointRequestException ex) {
        throw new ReflectionException(new IllegalArgumentException(ex.getMessage()), ex.getMessage());
    } catch (Exception ex) {
        throw new MBeanException(translateIfNecessary(ex), ex.getMessage());
    }
}
Also used : ReflectionException(javax.management.ReflectionException) InvalidEndpointRequestException(org.springframework.boot.actuate.endpoint.InvalidEndpointRequestException) MBeanException(javax.management.MBeanException) InvocationContext(org.springframework.boot.actuate.endpoint.InvocationContext) AttributeNotFoundException(javax.management.AttributeNotFoundException) InvalidEndpointRequestException(org.springframework.boot.actuate.endpoint.InvalidEndpointRequestException) InvalidAttributeValueException(javax.management.InvalidAttributeValueException) MBeanException(javax.management.MBeanException) ReflectionException(javax.management.ReflectionException)

Aggregations

AttributeNotFoundException (javax.management.AttributeNotFoundException)1 InvalidAttributeValueException (javax.management.InvalidAttributeValueException)1 MBeanException (javax.management.MBeanException)1 ReflectionException (javax.management.ReflectionException)1 InvalidEndpointRequestException (org.springframework.boot.actuate.endpoint.InvalidEndpointRequestException)1 InvocationContext (org.springframework.boot.actuate.endpoint.InvocationContext)1