Skip to content
Merged
Show file tree
Hide file tree
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 @@ -74,7 +74,7 @@
import static org.opensearch.security.dlic.rest.api.Responses.conflict;
import static org.opensearch.security.dlic.rest.api.Responses.forbidden;
import static org.opensearch.security.dlic.rest.api.Responses.forbiddenMessage;
import static org.opensearch.security.dlic.rest.api.Responses.internalSeverError;
import static org.opensearch.security.dlic.rest.api.Responses.internalServerError;
import static org.opensearch.security.dlic.rest.api.Responses.payload;
import static org.opensearch.security.dlic.rest.support.Utils.withIOException;

Expand Down Expand Up @@ -482,7 +482,7 @@ public final void onFailure(Exception e) {
if (ExceptionsHelper.unwrapCause(e) instanceof VersionConflictEngineException) {
conflict(channel, e.getMessage());
} else {
internalSeverError(channel, "Error " + e.getMessage());
internalServerError(channel, "Error " + e.getMessage());
}
}

Expand Down Expand Up @@ -579,7 +579,7 @@ protected final RestChannelConsumer prepareRequest(RestRequest request, NodeClie

// check if .opendistro_security index has been initialized
if (!ensureIndexExists()) {
return channel -> internalSeverError(channel, RequestContentValidator.ValidationError.SECURITY_NOT_INITIALIZED.message());
return channel -> internalServerError(channel, RequestContentValidator.ValidationError.SECURITY_NOT_INITIALIZED.message());
}

// check if request is authorized
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import org.opensearch.security.securityconf.impl.CType;
import org.opensearch.threadpool.ThreadPool;

import static org.opensearch.security.dlic.rest.api.Responses.internalSeverError;
import static org.opensearch.security.dlic.rest.api.Responses.internalServerError;
import static org.opensearch.security.dlic.rest.api.Responses.ok;
import static org.opensearch.security.dlic.rest.support.Utils.addRoutesPrefix;

Expand Down Expand Up @@ -73,7 +73,7 @@ private void flushCacheApiRequestHandlers(RequestHandler.RequestHandlersBuilder
public void onResponse(ConfigUpdateResponse configUpdateResponse) {
if (configUpdateResponse.hasFailures()) {
LOGGER.error("Cannot flush cache due to", configUpdateResponse.failures().get(0));
internalSeverError(
internalServerError(
channel,
"Cannot flush cache due to " + configUpdateResponse.failures().get(0).getMessage() + "."
);
Expand All @@ -86,7 +86,7 @@ public void onResponse(ConfigUpdateResponse configUpdateResponse) {
@Override
public void onFailure(final Exception e) {
LOGGER.error("Cannot flush cache due to", e);
internalSeverError(channel, "Cannot flush cache due to " + e.getMessage() + ".");
internalServerError(channel, "Cannot flush cache due to " + e.getMessage() + ".");
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
import org.opensearch.threadpool.ThreadPool;

import static org.opensearch.security.dlic.rest.api.Responses.badRequest;
import static org.opensearch.security.dlic.rest.api.Responses.internalSeverError;
import static org.opensearch.security.dlic.rest.api.Responses.internalServerError;
import static org.opensearch.security.dlic.rest.api.Responses.ok;
import static org.opensearch.security.dlic.rest.support.Utils.addRoutesPrefix;
// CS-ENFORCE-SINGLE
Expand Down Expand Up @@ -209,7 +209,7 @@ public void onResponse(CreateIndexResponse response) {
}
} catch (final IOException e1) {
LOGGER.error("Unable to create bulk request " + e1, e1);
internalSeverError(channel, "Unable to create bulk request.");
internalServerError(channel, "Unable to create bulk request.");
return;
}

Expand All @@ -226,7 +226,7 @@ public void onResponse(BulkResponse response) {
"Unable to upload migrated configuration because of "
+ response.buildFailureMessage()
);
internalSeverError(
internalServerError(
channel,
"Unable to upload migrated configuration (bulk index failed)."
);
Expand All @@ -240,7 +240,7 @@ public void onResponse(BulkResponse response) {
@Override
public void onFailure(Exception e) {
LOGGER.error("Unable to upload migrated configuration because of " + e, e);
internalSeverError(channel, "Unable to upload migrated configuration.");
internalServerError(channel, "Unable to upload migrated configuration.");
}
}
)
Expand All @@ -251,7 +251,7 @@ public void onFailure(Exception e) {
@Override
public void onFailure(Exception e) {
LOGGER.error("Unable to create opendistro_security index because of " + e, e);
internalSeverError(channel, "Unable to create opendistro_security index.");
internalServerError(channel, "Unable to create opendistro_security index.");
}
});

Expand All @@ -263,7 +263,7 @@ public void onFailure(Exception e) {
@Override
public void onFailure(Exception e) {
LOGGER.error("Unable to delete opendistro_security index because of " + e, e);
internalSeverError(channel, "Unable to delete opendistro_security index.");
internalServerError(channel, "Unable to delete opendistro_security index.");
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static void conflict(final RestChannel channel, final String message) {
response(channel, RestStatus.CONFLICT, message);
}

public static void internalSeverError(final RestChannel channel, final String message) {
public static void internalServerError(final RestChannel channel, final String message) {
response(channel, RestStatus.INTERNAL_SERVER_ERROR, message);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
import org.opensearch.threadpool.ThreadPool;

import static org.opensearch.security.dlic.rest.api.Responses.badRequest;
import static org.opensearch.security.dlic.rest.api.Responses.internalSeverError;
import static org.opensearch.security.dlic.rest.api.Responses.internalServerError;
import static org.opensearch.security.dlic.rest.api.Responses.ok;
import static org.opensearch.security.dlic.rest.support.Utils.addRoutesPrefix;

Expand Down Expand Up @@ -125,7 +125,7 @@ protected void validate(RestChannel channel, RestRequest request) throws IOExcep

ok(channel, "OK.");
} catch (Exception e) {
internalSeverError(channel, "Configuration is not valid.");
internalServerError(channel, "Configuration is not valid.");
}
}

Expand Down