[Rename] ElasticsearchWrapperException class in server module ()

This commit refactors the ElasticsearchWrapperException class in the server
module to OpenSearchWrapperException. References and usages throughout the rest
of the codebase are fully refactored.

Signed-off-by: Nicholas Knize <nknize@amazon.com>
This commit is contained in:
Nick Knize 2021-03-03 19:23:00 -06:00
parent e60906fc11
commit c42c2101a8
11 changed files with 22 additions and 22 deletions

@ -84,7 +84,7 @@ public final class ExceptionsHelper {
public static Throwable unwrapCause(Throwable t) {
int counter = 0;
Throwable result = t;
while (result instanceof ElasticsearchWrapperException) {
while (result instanceof OpenSearchWrapperException) {
if (result.getCause() == null) {
return result;
}

@ -232,7 +232,7 @@ public class OpenSearchException extends RuntimeException implements ToXContentF
/**
* Unwraps the actual cause from the exception for cases when the exception is a
* {@link ElasticsearchWrapperException}.
* {@link OpenSearchWrapperException}.
*
* @see ExceptionsHelper#unwrapCause(Throwable)
*/

@ -24,6 +24,6 @@ package org.elasticsearch;
* as an error because its is {@link #getCause() cause}, if non-null is
* <strong>always</strong> more useful to the user than the exception itself.
*/
public interface ElasticsearchWrapperException {
public interface OpenSearchWrapperException {
Throwable getCause();
}

@ -20,7 +20,7 @@
package org.elasticsearch.action.support.broadcast;
import org.elasticsearch.OpenSearchException;
import org.elasticsearch.ElasticsearchWrapperException;
import org.elasticsearch.OpenSearchWrapperException;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.index.shard.ShardId;
@ -31,7 +31,7 @@ import java.io.IOException;
*
*
*/
public class BroadcastShardOperationFailedException extends OpenSearchException implements ElasticsearchWrapperException {
public class BroadcastShardOperationFailedException extends OpenSearchException implements OpenSearchWrapperException {
public BroadcastShardOperationFailedException(ShardId shardId, String msg) {
this(shardId, msg, null);

@ -20,12 +20,12 @@
package org.elasticsearch.indices;
import org.elasticsearch.OpenSearchException;
import org.elasticsearch.ElasticsearchWrapperException;
import org.elasticsearch.OpenSearchWrapperException;
import org.elasticsearch.common.io.stream.StreamInput;
import java.io.IOException;
public class IndexCreationException extends OpenSearchException implements ElasticsearchWrapperException {
public class IndexCreationException extends OpenSearchException implements OpenSearchWrapperException {
public IndexCreationException(String index, Throwable cause) {
super("failed to create index [{}]", cause, index);

@ -20,7 +20,7 @@
package org.elasticsearch.indices.recovery;
import org.elasticsearch.OpenSearchException;
import org.elasticsearch.ElasticsearchWrapperException;
import org.elasticsearch.OpenSearchWrapperException;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.unit.ByteSizeValue;
@ -29,7 +29,7 @@ import org.elasticsearch.index.shard.ShardId;
import java.io.IOException;
import java.util.Objects;
public class RecoverFilesRecoveryException extends OpenSearchException implements ElasticsearchWrapperException {
public class RecoverFilesRecoveryException extends OpenSearchException implements OpenSearchWrapperException {
private final int numberOfFiles;

@ -20,16 +20,16 @@
package org.elasticsearch.ingest;
import org.elasticsearch.OpenSearchException;
import org.elasticsearch.ElasticsearchWrapperException;
import org.elasticsearch.OpenSearchWrapperException;
import org.elasticsearch.common.io.stream.StreamInput;
import java.io.IOException;
/**
* A dedicated wrapper for exceptions encountered executing an ingest processor. The wrapper is needed as we currently only unwrap causes
* for instances of {@link ElasticsearchWrapperException}.
* for instances of {@link OpenSearchWrapperException}.
*/
public class IngestProcessorException extends OpenSearchException implements ElasticsearchWrapperException {
public class IngestProcessorException extends OpenSearchException implements OpenSearchWrapperException {
IngestProcessorException(final Exception cause) {
super(cause);

@ -20,13 +20,13 @@
package org.elasticsearch.search;
import org.elasticsearch.OpenSearchException;
import org.elasticsearch.ElasticsearchWrapperException;
import org.elasticsearch.OpenSearchWrapperException;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import java.io.IOException;
public class SearchException extends OpenSearchException implements ElasticsearchWrapperException {
public class SearchException extends OpenSearchException implements OpenSearchWrapperException {
private final SearchShardTarget shardTarget;

@ -19,7 +19,7 @@
package org.elasticsearch.transport;
import org.elasticsearch.ElasticsearchWrapperException;
import org.elasticsearch.OpenSearchWrapperException;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.transport.TransportAddress;
@ -31,7 +31,7 @@ import java.io.IOException;
*
*
*/
public class RemoteTransportException extends ActionTransportException implements ElasticsearchWrapperException {
public class RemoteTransportException extends ActionTransportException implements OpenSearchWrapperException {
public RemoteTransportException(String msg, Throwable cause) {
super(msg, null, null, cause);

@ -19,13 +19,13 @@
package org.elasticsearch.transport;
import org.elasticsearch.ElasticsearchWrapperException;
import org.elasticsearch.OpenSearchWrapperException;
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.common.io.stream.StreamInput;
import java.io.IOException;
public class SendRequestTransportException extends ActionTransportException implements ElasticsearchWrapperException {
public class SendRequestTransportException extends ActionTransportException implements OpenSearchWrapperException {
public SendRequestTransportException(DiscoveryNode node, String action, Throwable cause) {
super(node == null ? null : node.getName(), node == null ? null : node.getAddress(), action, cause);

@ -237,24 +237,24 @@ public class BytesRestResponseTests extends ESTestCase {
case 3:
TransportAddress address = buildNewFakeTransportAddress();
original = new RemoteTransportException("remote", address, "action",
new ResourceAlreadyExistsException("ElasticsearchWrapperException with a cause that has a custom status"));
new ResourceAlreadyExistsException("OpenSearchWrapperException with a cause that has a custom status"));
status = RestStatus.BAD_REQUEST;
if (detailed) {
type = "resource_already_exists_exception";
reason = "ElasticsearchWrapperException with a cause that has a custom status";
reason = "OpenSearchWrapperException with a cause that has a custom status";
} else {
reason = "RemoteTransportException[[remote][" + address.toString() + "][action]]";
}
break;
case 4:
original = new RemoteTransportException("ElasticsearchWrapperException with a cause that has a special treatment",
original = new RemoteTransportException("OpenSearchWrapperException with a cause that has a special treatment",
new IllegalArgumentException("wrong"));
status = RestStatus.BAD_REQUEST;
if (detailed) {
type = "illegal_argument_exception";
reason = "wrong";
} else {
reason = "RemoteTransportException[[ElasticsearchWrapperException with a cause that has a special treatment]]";
reason = "RemoteTransportException[[OpenSearchWrapperException with a cause that has a special treatment]]";
}
break;
case 5: