[ 
https://issues.apache.org/jira/browse/IGNITE-19534?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vyacheslav Koptilin updated IGNITE-19534:
-----------------------------------------
    Description: 
Error code can be duplicated in the message as follows:

{code:java}
org.apache.ignite.sql.SqlException: IGN-SQL-20 
TraceId:8c53228d-6463-4dec-8ef6-7f7a19baab49 IGN-SQL-20 
TraceId:8c53228d-6463-4dec-8ef6-7f7a19baab49 IGN-SQL-20 
TraceId:8c53228d-6463-4dec-8ef6-7f7a19baab49
  at 
java.base@11.0.17/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native
 Method)
  at 
java.base@11.0.17/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
  at 
java.base@11.0.17/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
  at 
java.base@11.0.17/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
  at app//org.apache.ignite.lang.IgniteException.wrap(IgniteException.java:276)
  at app//org.apache.ignite.sql.Session.execute(Session.java:60)
  at 
app//org.apache.ignite.internal.sqllogic.ScriptContext.executeQuery(ScriptContext.java:89)
  at 
app//org.apache.ignite.internal.sqllogic.Statement.execute(Statement.java:108)
  ... 7 more
Caused by: org.apache.ignite.sql.SqlException: IGN-SQL-20 
TraceId:8c53228d-6463-4dec-8ef6-7f7a19baab49 IGN-SQL-20 
TraceId:8c53228d-6463-4dec-8ef6-7f7a19baab49
  ...
  ... 3 more
Caused by: org.apache.ignite.sql.SqlException: IGN-SQL-20 
TraceId:8c53228d-6463-4dec-8ef6-7f7a19baab49
  at 
app//org.apache.ignite.internal.sql.engine.exec.ExecutionServiceImpl.convertDdlException(ExecutionServiceImpl.java:311)
  at 
app//org.apache.ignite.internal.sql.engine.exec.ExecutionServiceImpl.lambda$executeDdl$8(ExecutionServiceImpl.java:289)
  ... 12 more
Caused by: java.util.concurrent.TimeoutException
  ... 8 more
{code}

-It seems to me, this behavior is caused by `IgniteException.wrap`.
By the way, this method is a good candidate to be moved to `ExceptionUtils` 
along with `IgniteException.getIgniteErrorCode()`.-

It seems to me, that the real cause of the issue is that `IgniteException` 
extends the user-provided message with an error code and trace id, but this 
behavior contradicts the implementation of Throwable: 
 - the user-defined message should not be changed in any way, and 
`getMessage()` should return exactly the same message. 
 - any additional information is included by `toString()` implementation (such 
as adding FQCN, error code and traceId)

  was:
Error code can be duplicated in the message as follows:

{code:java}
org.apache.ignite.sql.SqlException: IGN-SQL-20 
TraceId:8c53228d-6463-4dec-8ef6-7f7a19baab49 IGN-SQL-20 
TraceId:8c53228d-6463-4dec-8ef6-7f7a19baab49 IGN-SQL-20 
TraceId:8c53228d-6463-4dec-8ef6-7f7a19baab49
  at 
java.base@11.0.17/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native
 Method)
  at 
java.base@11.0.17/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
  at 
java.base@11.0.17/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
  at 
java.base@11.0.17/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
  at app//org.apache.ignite.lang.IgniteException.wrap(IgniteException.java:276)
  at app//org.apache.ignite.sql.Session.execute(Session.java:60)
  at 
app//org.apache.ignite.internal.sqllogic.ScriptContext.executeQuery(ScriptContext.java:89)
  at 
app//org.apache.ignite.internal.sqllogic.Statement.execute(Statement.java:108)
  ... 7 more
Caused by: org.apache.ignite.sql.SqlException: IGN-SQL-20 
TraceId:8c53228d-6463-4dec-8ef6-7f7a19baab49 IGN-SQL-20 
TraceId:8c53228d-6463-4dec-8ef6-7f7a19baab49
  ...
  ... 3 more
Caused by: org.apache.ignite.sql.SqlException: IGN-SQL-20 
TraceId:8c53228d-6463-4dec-8ef6-7f7a19baab49
  at 
app//org.apache.ignite.internal.sql.engine.exec.ExecutionServiceImpl.convertDdlException(ExecutionServiceImpl.java:311)
  at 
app//org.apache.ignite.internal.sql.engine.exec.ExecutionServiceImpl.lambda$executeDdl$8(ExecutionServiceImpl.java:289)
  ... 12 more
Caused by: java.util.concurrent.TimeoutException
  ... 8 more
{code}

It seems to me, this behavior is caused by `IgniteException.wrap`.
By the way, this method is a good candidate to be moved to `ExceptionUtils` 
along with `IgniteException.getIgniteErrorCode()`.


> Duplicating error code in the message.
> --------------------------------------
>
>                 Key: IGNITE-19534
>                 URL: https://issues.apache.org/jira/browse/IGNITE-19534
>             Project: Ignite
>          Issue Type: Bug
>            Reporter: Vyacheslav Koptilin
>            Assignee: Vyacheslav Koptilin
>            Priority: Major
>              Labels: iep-84, ignite-3
>             Fix For: 3.0.0-beta2
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Error code can be duplicated in the message as follows:
> {code:java}
> org.apache.ignite.sql.SqlException: IGN-SQL-20 
> TraceId:8c53228d-6463-4dec-8ef6-7f7a19baab49 IGN-SQL-20 
> TraceId:8c53228d-6463-4dec-8ef6-7f7a19baab49 IGN-SQL-20 
> TraceId:8c53228d-6463-4dec-8ef6-7f7a19baab49
>   at 
> java.base@11.0.17/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native
>  Method)
>   at 
> java.base@11.0.17/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
>   at 
> java.base@11.0.17/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
>   at 
> java.base@11.0.17/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
>   at 
> app//org.apache.ignite.lang.IgniteException.wrap(IgniteException.java:276)
>   at app//org.apache.ignite.sql.Session.execute(Session.java:60)
>   at 
> app//org.apache.ignite.internal.sqllogic.ScriptContext.executeQuery(ScriptContext.java:89)
>   at 
> app//org.apache.ignite.internal.sqllogic.Statement.execute(Statement.java:108)
>   ... 7 more
> Caused by: org.apache.ignite.sql.SqlException: IGN-SQL-20 
> TraceId:8c53228d-6463-4dec-8ef6-7f7a19baab49 IGN-SQL-20 
> TraceId:8c53228d-6463-4dec-8ef6-7f7a19baab49
>   ...
>   ... 3 more
> Caused by: org.apache.ignite.sql.SqlException: IGN-SQL-20 
> TraceId:8c53228d-6463-4dec-8ef6-7f7a19baab49
>   at 
> app//org.apache.ignite.internal.sql.engine.exec.ExecutionServiceImpl.convertDdlException(ExecutionServiceImpl.java:311)
>   at 
> app//org.apache.ignite.internal.sql.engine.exec.ExecutionServiceImpl.lambda$executeDdl$8(ExecutionServiceImpl.java:289)
>   ... 12 more
> Caused by: java.util.concurrent.TimeoutException
>   ... 8 more
> {code}
> -It seems to me, this behavior is caused by `IgniteException.wrap`.
> By the way, this method is a good candidate to be moved to `ExceptionUtils` 
> along with `IgniteException.getIgniteErrorCode()`.-
> It seems to me, that the real cause of the issue is that `IgniteException` 
> extends the user-provided message with an error code and trace id, but this 
> behavior contradicts the implementation of Throwable: 
>  - the user-defined message should not be changed in any way, and 
> `getMessage()` should return exactly the same message. 
>  - any additional information is included by `toString()` implementation 
> (such as adding FQCN, error code and traceId)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to