diff --git a/modules/api/src/main/java/org/apache/ignite/lang/IgniteException.java b/modules/api/src/main/java/org/apache/ignite/lang/IgniteException.java index ab5f5c61e46..8f49116b405 100644 --- a/modules/api/src/main/java/org/apache/ignite/lang/IgniteException.java +++ b/modules/api/src/main/java/org/apache/ignite/lang/IgniteException.java @@ -20,7 +20,6 @@ import static org.apache.ignite.lang.ErrorGroup.ERR_PREFIX; import static org.apache.ignite.lang.ErrorGroup.errorMessage; import static org.apache.ignite.lang.ErrorGroup.extractErrorCode; -import static org.apache.ignite.lang.ErrorGroups.Common.INTERNAL_ERR; import static org.apache.ignite.lang.ErrorGroups.errorGroupByCode; import static org.apache.ignite.lang.ErrorGroups.extractGroupCode; import static org.apache.ignite.lang.util.TraceIdUtils.getOrCreateTraceId; @@ -57,45 +56,6 @@ public class IgniteException extends RuntimeException implements TraceableExcept @SuppressWarnings({"NonFinalFieldOfException", "FieldMayBeFinal"}) private UUID traceId; - /** - * Creates an empty exception. - */ - @Deprecated - public IgniteException() { - this(INTERNAL_ERR); - } - - /** - * Creates an exception with the given error message. - * - * @param msg Error message. - */ - @Deprecated - public IgniteException(String msg) { - this(INTERNAL_ERR, msg); - } - - /** - * Creates a grid exception with the given throwable as a cause and source of the error message. - * - * @param cause Non-null throwable cause. - */ - @Deprecated - public IgniteException(Throwable cause) { - this(INTERNAL_ERR, cause); - } - - /** - * Creates an exception with the given error message and optional nested exception. - * - * @param msg Error message. - * @param cause Optional nested exception (can be {@code null}). - */ - @Deprecated - public IgniteException(String msg, @Nullable Throwable cause) { - this(INTERNAL_ERR, msg, cause); - } - /** * Creates an exception with the given error code. * diff --git a/modules/api/src/main/java/org/apache/ignite/lang/MarshallerException.java b/modules/api/src/main/java/org/apache/ignite/lang/MarshallerException.java index c7227d49661..af14e61fccc 100644 --- a/modules/api/src/main/java/org/apache/ignite/lang/MarshallerException.java +++ b/modules/api/src/main/java/org/apache/ignite/lang/MarshallerException.java @@ -18,7 +18,7 @@ package org.apache.ignite.lang; import java.util.UUID; -import org.apache.ignite.lang.ErrorGroups.Common; +import org.apache.ignite.lang.ErrorGroups.Marshalling; import org.jetbrains.annotations.Nullable; /** @@ -33,7 +33,7 @@ public class MarshallerException extends IgniteException { * @param cause Non-null throwable cause. */ public MarshallerException(String msg, @Nullable Throwable cause) { - super(Common.USER_OBJECT_SERIALIZATION_ERR, msg, cause); + super(Marshalling.COMMON_ERR, msg, cause); } /** diff --git a/modules/api/src/main/java/org/apache/ignite/tx/TransactionException.java b/modules/api/src/main/java/org/apache/ignite/tx/TransactionException.java index d1f2581b88c..b94ab24334e 100644 --- a/modules/api/src/main/java/org/apache/ignite/tx/TransactionException.java +++ b/modules/api/src/main/java/org/apache/ignite/tx/TransactionException.java @@ -23,26 +23,6 @@ /** This exception is thrown if a transaction can't be finished for some reason. */ public class TransactionException extends IgniteException { - /** - * Creates a new transaction exception with a message. - * - * @param message The message. - */ - @Deprecated - public TransactionException(String message) { - super(message); - } - - /** - * Creates a new transaction exception with a cause. - * - * @param cause The cause. - */ - @Deprecated - public TransactionException(Throwable cause) { - super(cause); - } - /** * Creates a new transaction exception with the given error code and cause. * diff --git a/modules/client-handler/src/main/java/org/apache/ignite/client/handler/ClientResource.java b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/ClientResource.java index ee38d808dc7..34aca6ff2e9 100644 --- a/modules/client-handler/src/main/java/org/apache/ignite/client/handler/ClientResource.java +++ b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/ClientResource.java @@ -17,6 +17,8 @@ package org.apache.ignite.client.handler; +import static org.apache.ignite.lang.ErrorGroups.Common.INTERNAL_ERR; + import org.apache.ignite.lang.IgniteException; import org.jetbrains.annotations.Nullable; @@ -43,7 +45,9 @@ public ClientResource(Object obj, @Nullable Runnable releaseRunnable) { */ public T get(Class type) { if (!type.isInstance(obj)) { - throw new IgniteException("Incorrect resource type. Expected " + type.getName() + ", but got " + obj.getClass().getName()); + throw new IgniteException( + INTERNAL_ERR, + "Incorrect resource type. Expected " + type.getName() + ", but got " + obj.getClass().getName()); } return (T) obj; diff --git a/modules/client/src/main/java/org/apache/ignite/internal/client/HostAndPort.java b/modules/client/src/main/java/org/apache/ignite/internal/client/HostAndPort.java index fb2691b7662..f66faf08f03 100644 --- a/modules/client/src/main/java/org/apache/ignite/internal/client/HostAndPort.java +++ b/modules/client/src/main/java/org/apache/ignite/internal/client/HostAndPort.java @@ -20,6 +20,7 @@ import java.io.Serializable; import java.net.Inet6Address; import java.net.UnknownHostException; +import org.apache.ignite.lang.ErrorGroups.Client; import org.apache.ignite.lang.IgniteException; /** @@ -107,7 +108,7 @@ public static HostAndPort parse(String addrStr, int dfltPort, String errMsgPrefi * @return Parsed port. * @throws IgniteException If failed. */ - private static int parsePort(String portStr, String addrStr, String errMsgPrefix) throws IgniteException { + private static int parsePort(String portStr, String addrStr, String errMsgPrefix) { try { int port = Integer.parseInt(portStr); @@ -129,8 +130,8 @@ private static int parsePort(String portStr, String addrStr, String errMsgPrefix * @param errMsg Error message. * @return Exception. */ - private static IgniteException createParseError(String addrStr, String errMsgPrefix, String errMsg) { - return new IgniteException(errMsgPrefix + " (" + errMsg + "): " + addrStr); + private static RuntimeException createParseError(String addrStr, String errMsgPrefix, String errMsg) { + return new IgniteException(Client.CONFIGURATION_ERR, errMsgPrefix + " (" + errMsg + "): " + addrStr); } /** @@ -142,8 +143,8 @@ private static IgniteException createParseError(String addrStr, String errMsgPre * @param cause Cause exception. * @return Exception. */ - private static IgniteException createParseError(String addrStr, String errMsgPrefix, String errMsg, Throwable cause) { - return new IgniteException(errMsgPrefix + " (" + errMsg + "): " + addrStr, cause); + private static RuntimeException createParseError(String addrStr, String errMsgPrefix, String errMsg, Throwable cause) { + return new IgniteException(Client.CONFIGURATION_ERR, errMsgPrefix + " (" + errMsg + "): " + addrStr, cause); } /** diff --git a/modules/client/src/test/java/org/apache/ignite/client/TestClientHandlerModule.java b/modules/client/src/test/java/org/apache/ignite/client/TestClientHandlerModule.java index 5b3911231c4..875c8b18b80 100644 --- a/modules/client/src/test/java/org/apache/ignite/client/TestClientHandlerModule.java +++ b/modules/client/src/test/java/org/apache/ignite/client/TestClientHandlerModule.java @@ -19,6 +19,7 @@ import static java.util.concurrent.CompletableFuture.failedFuture; import static org.apache.ignite.internal.util.CompletableFutures.nullCompletedFuture; +import static org.apache.ignite.lang.ErrorGroups.Common.INTERNAL_ERR; import io.netty.bootstrap.ServerBootstrap; import io.netty.channel.Channel; @@ -153,13 +154,13 @@ public TestClientHandlerModule( @Override public CompletableFuture startAsync(ComponentContext componentContext) { if (channel != null) { - throw new IgniteException("ClientHandlerModule is already started."); + throw new IgniteException(INTERNAL_ERR, "ClientHandlerModule is already started."); } try { channel = startEndpoint().channel(); } catch (InterruptedException e) { - throw new IgniteException(e); + throw new IgniteException(INTERNAL_ERR, e); } return nullCompletedFuture(); @@ -250,13 +251,13 @@ protected void initChannel(Channel ch) { if (bindRes.isSuccess()) { ch = bindRes.channel(); } else if (!(bindRes.cause() instanceof BindException)) { - throw new IgniteException(bindRes.cause()); + throw new IgniteException(INTERNAL_ERR, bindRes.cause()); } if (ch == null) { String msg = "Cannot start thin client connector endpoint. Port " + port + " is in use."; - throw new IgniteException(msg); + throw new IgniteException(INTERNAL_ERR, msg); } return ch.closeFuture(); diff --git a/modules/client/src/test/java/org/apache/ignite/client/fakes/FakeIgniteTables.java b/modules/client/src/test/java/org/apache/ignite/client/fakes/FakeIgniteTables.java index 539b8c8bb39..94605d8553f 100644 --- a/modules/client/src/test/java/org/apache/ignite/client/fakes/FakeIgniteTables.java +++ b/modules/client/src/test/java/org/apache/ignite/client/fakes/FakeIgniteTables.java @@ -18,6 +18,7 @@ package org.apache.ignite.client.fakes; import static java.util.concurrent.CompletableFuture.completedFuture; +import static org.apache.ignite.lang.ErrorGroups.Common.INTERNAL_ERR; import static org.mockito.Mockito.mock; import java.util.ArrayList; @@ -106,7 +107,7 @@ public TableViewInternal createTable(String name, int id) { var oldTable = tables.putIfAbsent(name, newTable); if (oldTable != null) { - throw new IgniteException(TABLE_EXISTS); + throw new IgniteException(INTERNAL_ERR, TABLE_EXISTS); } tablesById.put(newTable.tableId(), newTable); diff --git a/modules/configuration-presentation/src/main/java/org/apache/ignite/internal/configuration/presentation/HoconPresentation.java b/modules/configuration-presentation/src/main/java/org/apache/ignite/internal/configuration/presentation/HoconPresentation.java index 1964d8cf847..80cb0ca5c73 100644 --- a/modules/configuration-presentation/src/main/java/org/apache/ignite/internal/configuration/presentation/HoconPresentation.java +++ b/modules/configuration-presentation/src/main/java/org/apache/ignite/internal/configuration/presentation/HoconPresentation.java @@ -17,6 +17,8 @@ package org.apache.ignite.internal.configuration.presentation; +import static org.apache.ignite.lang.ErrorGroups.Common.INTERNAL_ERR; + import com.typesafe.config.Config; import com.typesafe.config.ConfigException; import com.typesafe.config.ConfigFactory; @@ -89,7 +91,7 @@ public CompletableFuture update(String cfgUpdate) { } else if (e instanceof ConfigurationChangeException) { throw (RuntimeException) e.getCause(); } else { - throw new IgniteException(e); + throw new IgniteException(INTERNAL_ERR, e); } }); } diff --git a/modules/marshaller-common/src/main/java/org/apache/ignite/internal/marshaller/MarshallerWriter.java b/modules/marshaller-common/src/main/java/org/apache/ignite/internal/marshaller/MarshallerWriter.java index 1a553f4be1f..e10917ae57e 100644 --- a/modules/marshaller-common/src/main/java/org/apache/ignite/internal/marshaller/MarshallerWriter.java +++ b/modules/marshaller-common/src/main/java/org/apache/ignite/internal/marshaller/MarshallerWriter.java @@ -23,7 +23,6 @@ import java.time.LocalDateTime; import java.time.LocalTime; import java.util.UUID; -import org.apache.ignite.lang.IgniteException; /** * Binary writer. @@ -145,98 +144,4 @@ public interface MarshallerWriter { * @param val Value. */ void writeDateTime(LocalDateTime val); - - /** - * Writes an object value. - * - * @param col Column. - * @param val Value. - */ - default void writeValue(MarshallerColumn col, Object val) { - if (val == null) { - writeNull(); - - return; - } - - switch (col.type()) { - case BOOLEAN: { - writeBoolean((boolean) val); - - break; - } - case BYTE: { - writeByte((byte) val); - - break; - } - case SHORT: { - writeShort((short) val); - - break; - } - case INT: { - writeInt((int) val); - - break; - } - case LONG: { - writeLong((long) val); - - break; - } - case FLOAT: { - writeFloat((float) val); - - break; - } - case DOUBLE: { - writeDouble((double) val); - - break; - } - case UUID: { - writeUuid((UUID) val); - - break; - } - case TIME: { - writeTime((LocalTime) val); - - break; - } - case DATE: { - writeDate((LocalDate) val); - - break; - } - case DATETIME: { - writeDateTime((LocalDateTime) val); - - break; - } - case TIMESTAMP: { - writeTimestamp((Instant) val); - - break; - } - case STRING: { - writeString((String) val); - - break; - } - case BYTE_ARR: { - writeBytes((byte[]) val); - - break; - } - case DECIMAL: { - writeBigDecimal((BigDecimal) val, col.scale()); - - break; - } - default: - throw new IgniteException("Unexpected value: " + col.type()); - } - } } diff --git a/modules/network/src/main/java/org/apache/ignite/internal/network/DefaultMessagingService.java b/modules/network/src/main/java/org/apache/ignite/internal/network/DefaultMessagingService.java index 0c2ad4ffed6..a18ba5e1ca9 100644 --- a/modules/network/src/main/java/org/apache/ignite/internal/network/DefaultMessagingService.java +++ b/modules/network/src/main/java/org/apache/ignite/internal/network/DefaultMessagingService.java @@ -28,6 +28,7 @@ import static org.apache.ignite.internal.util.IgniteUtils.closeAll; import static org.apache.ignite.internal.util.IgniteUtils.safeAbs; import static org.apache.ignite.internal.util.IgniteUtils.shutdownAndAwaitTermination; +import static org.apache.ignite.lang.ErrorGroups.Common.INTERNAL_ERR; import it.unimi.dsi.fastutil.ints.IntOpenHashSet; import it.unimi.dsi.fastutil.ints.IntSet; @@ -349,7 +350,7 @@ private CompletableFuture sendViaNetwork( try { descriptors = prepareMarshal(message); } catch (Exception e) { - return failedFuture(new IgniteException("Failed to marshal message: " + e.getMessage(), e)); + return failedFuture(new IgniteException(INTERNAL_ERR, "Failed to marshal message: " + e.getMessage(), e)); } return connectionManager.channel(consistentId, type, addr) @@ -479,7 +480,7 @@ private void unmarshalMessage(InNetworkObject obj) { try { obj.message().unmarshal(marshaller, obj.registry()); } catch (Exception e) { - throw new IgniteException("Failed to unmarshal message: " + e.getMessage(), e); + throw new IgniteException(INTERNAL_ERR, "Failed to unmarshal message: " + e.getMessage(), e); } } diff --git a/modules/network/src/main/java/org/apache/ignite/internal/network/serialization/ClassDescriptorFactory.java b/modules/network/src/main/java/org/apache/ignite/internal/network/serialization/ClassDescriptorFactory.java index 20d208b0362..1f6275833fa 100644 --- a/modules/network/src/main/java/org/apache/ignite/internal/network/serialization/ClassDescriptorFactory.java +++ b/modules/network/src/main/java/org/apache/ignite/internal/network/serialization/ClassDescriptorFactory.java @@ -24,6 +24,7 @@ import static org.apache.ignite.internal.network.serialization.Classes.hasWriteReplace; import static org.apache.ignite.internal.network.serialization.Classes.isExternalizable; import static org.apache.ignite.internal.network.serialization.Classes.isSerializable; +import static org.apache.ignite.lang.ErrorGroups.Common.INTERNAL_ERR; import java.io.Externalizable; import java.io.ObjectInputStream; @@ -213,7 +214,7 @@ private static void checkHasPublicNoArgConstructor(Class testExceptions() { arguments(new AuthenticationException("authentication-exception"), UNAUTHORIZED, "Unauthorized", "authentication-exception"), arguments(new AuthorizationException(null), UNAUTHORIZED, "Unauthorized", null), - arguments(new IgniteException("ignite-exception"), INTERNAL_SERVER_ERROR, "Internal Server Error", "ignite-exception"), - arguments(new IgniteInternalCheckedException("ignite-internal-exception"), INTERNAL_SERVER_ERROR, + arguments(new IgniteException(INTERNAL_ERR, "ignite-exception"), INTERNAL_SERVER_ERROR, + "Internal Server Error", "ignite-exception"), + arguments(new IgniteInternalCheckedException(INTERNAL_ERR, "ignite-internal-exception"), INTERNAL_SERVER_ERROR, "Internal Server Error", "ignite-internal-exception"), - arguments(new IgniteInternalException("ignite-internal-exception"), INTERNAL_SERVER_ERROR, + arguments(new IgniteInternalException(INTERNAL_ERR, "ignite-internal-exception"), INTERNAL_SERVER_ERROR, "Internal Server Error", "ignite-internal-exception"), arguments(new RuntimeException("runtime-exception"), INTERNAL_SERVER_ERROR, "Internal Server Error", "runtime-exception"), arguments(new Exception("exception"), INTERNAL_SERVER_ERROR, "Internal Server Error", "exception"), diff --git a/modules/rest/src/main/java/org/apache/ignite/internal/rest/cluster/ClusterManagementController.java b/modules/rest/src/main/java/org/apache/ignite/internal/rest/cluster/ClusterManagementController.java index a9ae750979f..8c8e09f912d 100644 --- a/modules/rest/src/main/java/org/apache/ignite/internal/rest/cluster/ClusterManagementController.java +++ b/modules/rest/src/main/java/org/apache/ignite/internal/rest/cluster/ClusterManagementController.java @@ -17,6 +17,8 @@ package org.apache.ignite.internal.rest.cluster; +import static org.apache.ignite.lang.ErrorGroups.Common.INTERNAL_ERR; + import io.micronaut.http.annotation.Body; import io.micronaut.http.annotation.Controller; import java.util.concurrent.CompletableFuture; @@ -103,7 +105,7 @@ private static RuntimeException mapException(Throwable ex) { } else if (cause instanceof IgniteException) { return (RuntimeException) cause; } else { - return new IgniteException(cause); + return new IgniteException(INTERNAL_ERR, cause); } } diff --git a/modules/rest/src/main/java/org/apache/ignite/internal/rest/configuration/AbstractConfigurationController.java b/modules/rest/src/main/java/org/apache/ignite/internal/rest/configuration/AbstractConfigurationController.java index 9b76585f477..882070e72f8 100644 --- a/modules/rest/src/main/java/org/apache/ignite/internal/rest/configuration/AbstractConfigurationController.java +++ b/modules/rest/src/main/java/org/apache/ignite/internal/rest/configuration/AbstractConfigurationController.java @@ -17,6 +17,8 @@ package org.apache.ignite.internal.rest.configuration; +import static org.apache.ignite.lang.ErrorGroups.Common.INTERNAL_ERR; + import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionException; import org.apache.ignite.configuration.validation.ConfigurationValidationException; @@ -55,7 +57,7 @@ public String getConfigurationByPath(String path) { try { return cfgPresentation.representByPath(path); } catch (IllegalArgumentException ex) { - throw new IgniteException(ex); + throw new IgniteException(INTERNAL_ERR, ex); } } @@ -71,10 +73,10 @@ public CompletableFuture updateConfiguration(String updatedConfiguration) var cause = ex.getCause(); if (cause instanceof IllegalArgumentException || cause instanceof ConfigurationValidationException) { - throw new IgniteException(cause); + throw new IgniteException(INTERNAL_ERR, cause); } } - throw new IgniteException(ex); + throw new IgniteException(INTERNAL_ERR, ex); }); } diff --git a/modules/runner/src/main/java/org/apache/ignite/internal/app/IgniteImpl.java b/modules/runner/src/main/java/org/apache/ignite/internal/app/IgniteImpl.java index 2a06eb95c4b..aeea8fd4c74 100644 --- a/modules/runner/src/main/java/org/apache/ignite/internal/app/IgniteImpl.java +++ b/modules/runner/src/main/java/org/apache/ignite/internal/app/IgniteImpl.java @@ -30,6 +30,7 @@ import static org.apache.ignite.internal.thread.ThreadOperation.STORAGE_WRITE; import static org.apache.ignite.internal.util.CompletableFutures.copyStateTo; import static org.apache.ignite.internal.util.CompletableFutures.nullCompletedFuture; +import static org.apache.ignite.lang.ErrorGroups.Common.INTERNAL_ERR; import com.typesafe.config.Config; import com.typesafe.config.ConfigFactory; @@ -1513,7 +1514,7 @@ private RuntimeException handleStartException(Throwable e) { LOG.error(errMsg, e); - IgniteException igniteException = new IgniteException(errMsg, e); + IgniteException igniteException = new IgniteException(INTERNAL_ERR, errMsg, e); ExecutorService lifecycleExecutor = stopExecutor(); diff --git a/modules/runner/src/testFixtures/java/org/apache/ignite/internal/testframework/TestIgnitionManager.java b/modules/runner/src/testFixtures/java/org/apache/ignite/internal/testframework/TestIgnitionManager.java index 3df4f5463cd..ea55c8a1c5d 100644 --- a/modules/runner/src/testFixtures/java/org/apache/ignite/internal/testframework/TestIgnitionManager.java +++ b/modules/runner/src/testFixtures/java/org/apache/ignite/internal/testframework/TestIgnitionManager.java @@ -21,6 +21,7 @@ import static java.nio.file.StandardOpenOption.SYNC; import static java.nio.file.StandardOpenOption.TRUNCATE_EXISTING; import static org.apache.ignite.internal.util.Constants.MiB; +import static org.apache.ignite.lang.ErrorGroups.Common.INTERNAL_ERR; import com.typesafe.config.ConfigException; import com.typesafe.config.parser.ConfigDocument; @@ -119,7 +120,7 @@ public static IgniteServer start(String nodeName, @Nullable String configStr, Pa return IgniteServer.start(nodeName, configPath, workDir); } catch (IOException e) { - throw new IgniteException("Couldn't write node config.", e); + throw new IgniteException(INTERNAL_ERR, "Couldn't write node config.", e); } } @@ -130,7 +131,7 @@ public static void addDefaultsToConfigurationFile(Path configPath) { try { addDefaultsToConfigurationFile(null, configPath); } catch (IOException e) { - throw new IgniteException("Couldn't update node configuration file", e); + throw new IgniteException(INTERNAL_ERR, "Couldn't update node configuration file", e); } } diff --git a/modules/schema/src/main/java/org/apache/ignite/internal/schema/marshaller/reflection/RowWriter.java b/modules/schema/src/main/java/org/apache/ignite/internal/schema/marshaller/reflection/RowWriter.java index 726f353df36..399149acf1e 100644 --- a/modules/schema/src/main/java/org/apache/ignite/internal/schema/marshaller/reflection/RowWriter.java +++ b/modules/schema/src/main/java/org/apache/ignite/internal/schema/marshaller/reflection/RowWriter.java @@ -23,7 +23,6 @@ import java.time.LocalDateTime; import java.time.LocalTime; import java.util.UUID; -import org.apache.ignite.internal.marshaller.MarshallerColumn; import org.apache.ignite.internal.marshaller.MarshallerWriter; import org.apache.ignite.internal.schema.row.RowAssembler; @@ -121,9 +120,4 @@ public void writeTimestamp(Instant val) { public void writeDateTime(LocalDateTime val) { rowAssembler.appendDateTimeNotNull(val); } - - @Override - public void writeValue(MarshallerColumn col, Object val) { - rowAssembler.appendValue(val); - } } diff --git a/modules/storage-api/src/main/java/org/apache/ignite/internal/storage/TxIdMismatchException.java b/modules/storage-api/src/main/java/org/apache/ignite/internal/storage/TxIdMismatchException.java index 83b718f9aa4..edc2316f825 100644 --- a/modules/storage-api/src/main/java/org/apache/ignite/internal/storage/TxIdMismatchException.java +++ b/modules/storage-api/src/main/java/org/apache/ignite/internal/storage/TxIdMismatchException.java @@ -17,6 +17,8 @@ package org.apache.ignite.internal.storage; +import static org.apache.ignite.lang.ErrorGroups.Common.INTERNAL_ERR; + import java.util.UUID; import org.apache.ignite.internal.tostring.S; import org.apache.ignite.lang.IgniteException; @@ -38,7 +40,7 @@ public class TxIdMismatchException extends IgniteException { * @param conflictingTxId Conflicting transaction id. */ public TxIdMismatchException(UUID expectedTxId, UUID conflictingTxId) { - super(S.toString( + super(INTERNAL_ERR, S.toString( "Mismatched transaction id", "expectedTxId", expectedTxId, false, "actualTxId", conflictingTxId, false diff --git a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java index 3fdafb9c4d5..e2a9f94fdbf 100644 --- a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java +++ b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java @@ -62,6 +62,8 @@ import static org.apache.ignite.internal.util.IgniteUtils.inBusyLock; import static org.apache.ignite.internal.util.IgniteUtils.inBusyLockAsync; import static org.apache.ignite.internal.util.IgniteUtils.shutdownAndAwaitTermination; +import static org.apache.ignite.lang.ErrorGroups.Common.INTERNAL_ERR; +import static org.apache.ignite.lang.ErrorGroups.Common.NODE_STOPPING_ERR; import it.unimi.dsi.fastutil.ints.IntOpenHashSet; import java.nio.file.Path; @@ -231,7 +233,6 @@ import org.apache.ignite.internal.util.SafeTimeValuesTracker; import org.apache.ignite.internal.utils.RebalanceUtilEx; import org.apache.ignite.internal.worker.ThreadAssertions; -import org.apache.ignite.lang.ErrorGroups.Common; import org.apache.ignite.lang.IgniteException; import org.apache.ignite.lang.util.IgniteNameUtils; import org.apache.ignite.network.ClusterNode; @@ -2005,7 +2006,7 @@ public CompletableFuture tableAsync(int tableId) { */ public CompletableFuture localPartitionSetAsync(long causalityToken, int tableId) { if (!busyLock.enterBusy()) { - throw new IgniteException(new NodeStoppingException()); + throw new IgniteException(NODE_STOPPING_ERR, new NodeStoppingException()); } try { @@ -2115,7 +2116,7 @@ private static RuntimeException convertThrowable(Throwable th) { return (RuntimeException) th; } - return new IgniteException(th); + return new IgniteException(INTERNAL_ERR, th); } /** @@ -2769,7 +2770,7 @@ private void destroyReplicationProtocolStorages(TablePartitionId tablePartitionI try { replicaMgr.destroyReplicationProtocolStorages(tablePartitionId, internalTbl.storage().isVolatile()); } catch (NodeStoppingException e) { - throw new IgniteInternalException(Common.NODE_STOPPING_ERR, e); + throw new IgniteInternalException(NODE_STOPPING_ERR, e); } } @@ -2952,7 +2953,7 @@ private void destroyTableStorageOnRecoveryBusy(CatalogTableDescriptor tableDescr private synchronized ScheduledExecutorService streamerFlushExecutor() { if (!busyLock.enterBusy()) { - throw new IgniteException(new NodeStoppingException()); + throw new IgniteException(NODE_STOPPING_ERR, new NodeStoppingException()); } try { diff --git a/modules/table/src/testFixtures/java/org/apache/ignite/internal/table/TxAbstractTest.java b/modules/table/src/testFixtures/java/org/apache/ignite/internal/table/TxAbstractTest.java index d4c3e298d41..86c7e31ae19 100644 --- a/modules/table/src/testFixtures/java/org/apache/ignite/internal/table/TxAbstractTest.java +++ b/modules/table/src/testFixtures/java/org/apache/ignite/internal/table/TxAbstractTest.java @@ -24,6 +24,7 @@ import static org.apache.ignite.internal.testframework.IgniteTestUtils.assertThrowsWithCode; import static org.apache.ignite.internal.testframework.IgniteTestUtils.waitForCondition; import static org.apache.ignite.internal.testframework.matchers.CompletableFutureMatcher.willBe; +import static org.apache.ignite.lang.ErrorGroups.Common.INTERNAL_ERR; import static org.apache.ignite.lang.ErrorGroups.Transactions.TX_ALREADY_FINISHED_ERR; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.contains; @@ -1012,7 +1013,7 @@ public void testPutAll() throws TransactionException { assertThrows(IgniteException.class, () -> igniteTransactions.runInTransaction(tx -> { accounts.recordView().upsertAll(tx, List.of(makeValue(3, 300.), makeValue(4, 400.))); if (true) { - throw new IgniteException(); + throw new IgniteException(INTERNAL_ERR, "Test error"); } })); @@ -1806,7 +1807,7 @@ public void uncaughtException(Thread t, Throwable e) { } if (firstErr.get() != null) { - throw new IgniteException(firstErr.get()); + throw new IgniteException(INTERNAL_ERR, firstErr.get()); } log.info("After test ops={} fails={}", ops.sum(), fails.sum()); diff --git a/modules/table/src/testFixtures/java/org/apache/ignite/internal/table/impl/DummyInternalTableImpl.java b/modules/table/src/testFixtures/java/org/apache/ignite/internal/table/impl/DummyInternalTableImpl.java index 23f2ea84c92..570282eef8d 100644 --- a/modules/table/src/testFixtures/java/org/apache/ignite/internal/table/impl/DummyInternalTableImpl.java +++ b/modules/table/src/testFixtures/java/org/apache/ignite/internal/table/impl/DummyInternalTableImpl.java @@ -382,7 +382,7 @@ public void patch(HybridTimestamp safeTs) { try { partitionListener.onWrite(List.of(clo).iterator()); } catch (Throwable e) { - res.completeExceptionally(new TransactionException(e)); + res.completeExceptionally(new TransactionException(0, e)); } return res; diff --git a/modules/transactions/src/main/java/org/apache/ignite/internal/tx/Timestamp.java b/modules/transactions/src/main/java/org/apache/ignite/internal/tx/Timestamp.java index af7597cbe03..4a422b35229 100644 --- a/modules/transactions/src/main/java/org/apache/ignite/internal/tx/Timestamp.java +++ b/modules/transactions/src/main/java/org/apache/ignite/internal/tx/Timestamp.java @@ -17,6 +17,8 @@ package org.apache.ignite.internal.tx; +import static org.apache.ignite.lang.ErrorGroups.Common.INTERNAL_ERR; + import java.io.Serializable; import java.net.InetAddress; import java.net.NetworkInterface; @@ -223,7 +225,7 @@ private static long getLocalNodeId() { return buffer.getLong(); } catch (Exception e) { - throw new IgniteException("Failed to get local node id", e); + throw new IgniteException(INTERNAL_ERR, "Failed to get local node id", e); } } } diff --git a/modules/transactions/src/test/java/org/apache/ignite/internal/tx/AbstractLockManagerTest.java b/modules/transactions/src/test/java/org/apache/ignite/internal/tx/AbstractLockManagerTest.java index 17d56f8535f..76b75dc91ff 100644 --- a/modules/transactions/src/test/java/org/apache/ignite/internal/tx/AbstractLockManagerTest.java +++ b/modules/transactions/src/test/java/org/apache/ignite/internal/tx/AbstractLockManagerTest.java @@ -25,6 +25,7 @@ import static org.apache.ignite.internal.tx.LockMode.S; import static org.apache.ignite.internal.tx.LockMode.SIX; import static org.apache.ignite.internal.tx.LockMode.X; +import static org.apache.ignite.lang.ErrorGroups.Common.INTERNAL_ERR; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.hasSize; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -1214,7 +1215,7 @@ public void uncaughtException(Thread t, Throwable e) { } if (firstErr.get() != null) { - throw new IgniteException(firstErr.get()); + throw new IgniteException(INTERNAL_ERR, firstErr.get()); } log.info("After test readLocks={} writeLocks={} failedLocks={}", readLocks.sum(), writeLocks.sum(),