[
https://issues.apache.org/jira/browse/IGNITE-19928?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Pavel Tupitsyn updated IGNITE-19928:
------------------------------------
Description:
The error group and the error code in the group are defined by two bytes each
(in
https://cwiki.apache.org/confluence/display/IGNITE/IEP-84%3A+Error+handling).
On the other hand, the following methods define these parameters as int:
{code:java}
/**
* Creates a new error group with the given {@code groupName} and {@code
groupCode}.
*
* @param groupName Group name to be created.
* @param groupCode Group code to be created.
* @return New error group.
* @throws IllegalArgumentException If the specified name or group code is
already registered.
* or {@code groupCode} is greater than 0xFFFF or less than or equal
to 0.
* Also, this exception is thrown if the given {@code groupName} is
{@code null} or empty.
*/
public static synchronized ErrorGroup newGroup(String groupName, int
groupCode)
/**
* Registers a new error code within this error group.
*
* @param errorCode Error code to be registered.
* @return Full error code which includes group code and specific error
code.
* @throws IllegalArgumentException If the given {@code errorCode} is
already registered
* or {@code errorCode} is greater than 0xFFFF or less than or equal
to 0.
*/
public int registerErrorCode(int errorCode)
{code}
This fact leads to runtime checks that the error code and error group
identifier is greater or equal to 0 and less than or equal to 0xFFFF. It can be
avoided by changing the type from `int` to `short` obviously. All related
places should be corrected accordingly.
was:
The error group and the error code in the group are defined by two bytes each.
On the other hand, the following methods define these parameters as int:
{code:java}
/**
* Creates a new error group with the given {@code groupName} and {@code
groupCode}.
*
* @param groupName Group name to be created.
* @param groupCode Group code to be created.
* @return New error group.
* @throws IllegalArgumentException If the specified name or group code is
already registered.
* or {@code groupCode} is greater than 0xFFFF or less than or equal
to 0.
* Also, this exception is thrown if the given {@code groupName} is
{@code null} or empty.
*/
public static synchronized ErrorGroup newGroup(String groupName, int
groupCode)
/**
* Registers a new error code within this error group.
*
* @param errorCode Error code to be registered.
* @return Full error code which includes group code and specific error
code.
* @throws IllegalArgumentException If the given {@code errorCode} is
already registered
* or {@code errorCode} is greater than 0xFFFF or less than or equal
to 0.
*/
public int registerErrorCode(int errorCode)
{code}
This fact leads to runtime checks that the error code and error group
identifier is greater or equal to 0 and less than or equal to 0xFFFF. It can be
avoided by changing the type from `int` to `short` obviously. All related
places should be corrected accordingly.
> Fix method signature related to creating a new error group and registering a
> new error code
> -------------------------------------------------------------------------------------------
>
> Key: IGNITE-19928
> URL: https://issues.apache.org/jira/browse/IGNITE-19928
> Project: Ignite
> Issue Type: Bug
> Reporter: Vyacheslav Koptilin
> Assignee: Vyacheslav Koptilin
> Priority: Major
> Labels: ignite-3
> Fix For: 3.0.0-beta2
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> The error group and the error code in the group are defined by two bytes each
> (in
> https://cwiki.apache.org/confluence/display/IGNITE/IEP-84%3A+Error+handling).
> On the other hand, the following methods define these parameters as int:
> {code:java}
> /**
> * Creates a new error group with the given {@code groupName} and {@code
> groupCode}.
> *
> * @param groupName Group name to be created.
> * @param groupCode Group code to be created.
> * @return New error group.
> * @throws IllegalArgumentException If the specified name or group code
> is already registered.
> * or {@code groupCode} is greater than 0xFFFF or less than or equal
> to 0.
> * Also, this exception is thrown if the given {@code groupName} is
> {@code null} or empty.
> */
> public static synchronized ErrorGroup newGroup(String groupName, int
> groupCode)
> /**
> * Registers a new error code within this error group.
> *
> * @param errorCode Error code to be registered.
> * @return Full error code which includes group code and specific error
> code.
> * @throws IllegalArgumentException If the given {@code errorCode} is
> already registered
> * or {@code errorCode} is greater than 0xFFFF or less than or equal
> to 0.
> */
> public int registerErrorCode(int errorCode)
> {code}
> This fact leads to runtime checks that the error code and error group
> identifier is greater or equal to 0 and less than or equal to 0xFFFF. It can
> be avoided by changing the type from `int` to `short` obviously. All related
> places should be corrected accordingly.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)