Skip to content
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 @@ -352,7 +352,8 @@ public static ElasticsearchException readException(StreamInput input, int id) th
public static boolean isRegistered(Class<? extends Throwable> exception, TransportVersion version) {
ElasticsearchExceptionHandle elasticsearchExceptionHandle = CLASS_TO_ELASTICSEARCH_EXCEPTION_HANDLE.get(exception);
if (elasticsearchExceptionHandle != null) {
return version.onOrAfter(elasticsearchExceptionHandle.versionAdded);
return version.onOrAfter(elasticsearchExceptionHandle.versionAdded)
|| Arrays.stream(elasticsearchExceptionHandle.patchVersions).anyMatch(version::isPatchFrom);
}
return false;
}
Expand Down Expand Up @@ -1986,19 +1987,23 @@ private enum ElasticsearchExceptionHandle {
final Class<? extends ElasticsearchException> exceptionClass;
final CheckedFunction<StreamInput, ? extends ElasticsearchException, IOException> constructor;
final int id;
final TransportVersion versionAdded;
private final TransportVersion versionAdded;
private final TransportVersion[] patchVersions;

<E extends ElasticsearchException> ElasticsearchExceptionHandle(
Class<E> exceptionClass,
CheckedFunction<StreamInput, E, IOException> constructor,
int id,
TransportVersion versionAdded
TransportVersion versionAdded,
TransportVersion... patchVersions
) {
// We need the exceptionClass because you can't dig it out of the constructor reliably.
this.exceptionClass = exceptionClass;
this.constructor = constructor;
this.versionAdded = versionAdded;

this.id = id;
this.versionAdded = versionAdded;
this.patchVersions = patchVersions;
}
}

Expand Down