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

Fix NPE in management API for endpoints #3064

Merged
merged 1 commit into from
Dec 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,17 @@ private void handleTracing(String performedBy, JsonObject payload, MessageContex
SynapseConfiguration configuration = msgCtx.getConfiguration();
Endpoint endpoint = configuration.getEndpoint(endpointName);
if (endpoint != null) {
AspectConfiguration aspectConfiguration = ((AbstractEndpoint) endpoint).getDefinition().getAspectConfiguration();
JSONObject info = new JSONObject();
info.put(ENDPOINT_NAME, endpointName);
response = Utils.handleTracing(performedBy, Constants.AUDIT_LOG_TYPE_ENDPOINT_TRACE,
Constants.ENDPOINTS, info, aspectConfiguration, endpointName,
axisMsgCtx);
if (((AbstractEndpoint) endpoint).getDefinition() != null) {
AspectConfiguration aspectConfiguration = ((AbstractEndpoint) endpoint).getDefinition()
.getAspectConfiguration();
JSONObject info = new JSONObject();
info.put(ENDPOINT_NAME, endpointName);
response = Utils.handleTracing(performedBy, Constants.AUDIT_LOG_TYPE_ENDPOINT_TRACE,
Constants.ENDPOINTS, info, aspectConfiguration, endpointName, axisMsgCtx);
} else {
response = Utils.createJsonError("Tracing is not supported for this endpoint", axisMsgCtx,
Constants.BAD_REQUEST);
}
} else {
response = Utils.createJsonError("Specified endpoint ('" + endpointName + "') not found", axisMsgCtx,
Constants.BAD_REQUEST);
Expand Down Expand Up @@ -223,9 +228,13 @@ private JSONObject getEndpointAsJson(Endpoint endpoint) {
OMElement synapseConfiguration = EndpointSerializer.getElementFromEndpoint(endpoint);
endpointObject.put(Constants.SYNAPSE_CONFIGURATION, synapseConfiguration);
endpointObject.put(IS_ACTIVE, isEndpointActive(endpoint));
String tracingState = ((AbstractEndpoint) endpoint).getDefinition().getAspectConfiguration().isTracingEnabled() ? Constants.ENABLED : Constants.DISABLED;
endpointObject.put(TRACING, tracingState);

if (((AbstractEndpoint) endpoint).getDefinition() != null) {
String tracingState = ((AbstractEndpoint) endpoint).getDefinition().getAspectConfiguration()
.isTracingEnabled() ? Constants.ENABLED : Constants.DISABLED;
endpointObject.put(TRACING, tracingState);
} else {
endpointObject.put(TRACING, Constants.DISABLED);
}
return endpointObject;
}

Expand Down
Loading