You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Vyacheslav Koptilin (Jira)" <ji...@apache.org> on 2023/07/13 11:50:00 UTC

[jira] [Commented] (IGNITE-19928) Fix method signature related to creating a new error group and registering a new error code

    [ https://issues.apache.org/jira/browse/IGNITE-19928?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17742772#comment-17742772 ] 

Vyacheslav Koptilin commented on IGNITE-19928:
----------------------------------------------

Hello [~sanpwc], [~ptupitsyn],

Guys, could you please take a look at the proposed change?

> 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. 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)