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

ASF GitHub Bot commented on PHOENIX-6185:
-----------------------------------------

shahrs87 commented on a change in pull request #919:
URL: https://github.com/apache/phoenix/pull/919#discussion_r505758010



##########
File path: 
phoenix-core/src/test/java/org/apache/phoenix/util/SQLExceptionCodeTest.java
##########
@@ -0,0 +1,59 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.phoenix.util;
+
+import com.sun.javaws.exceptions.InvalidArgumentException;

Review comment:
       Do we use exceptions from this package anywhere else ? Haven't come 
across this library. Can we add some generic exception ?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


> OPERATION_TIMED_OUT#newException method swallows the exception message and 
> root cause exception.
> ------------------------------------------------------------------------------------------------
>
>                 Key: PHOENIX-6185
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-6185
>             Project: Phoenix
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 4.14.3
>            Reporter: Rushabh Shah
>            Assignee: Viraj Jasani
>            Priority: Major
>             Fix For: 5.1.0, 4.16.0
>
>
> BaseResultIterators#getIterators encountered TimeoutException 
> [here|https://github.com/apache/phoenix/blob/master/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java#L1383-L1389]
> {code:java}
>         } catch (TimeoutException e) {
>             context.getOverallQueryMetrics().queryTimedOut();
>             GLOBAL_QUERY_TIMEOUT_COUNTER.increment();
>             // thrown when a thread times out waiting for the future.get() 
> call to return
>             toThrow = new SQLExceptionInfo.Builder(OPERATION_TIMED_OUT)
>                     .setMessage(". Query couldn't be completed in the 
> allotted time: "
>                             + queryTimeOut + " 
> ms").setRootCause(e).build().buildException();
> {code}
> It creates SQLExceptionInfo object with message indicating the timeout and 
> the root cause exception.
> But 
> [SQLExceptionCode#OPERATION_TIMED_OUT#newException|https://github.com/apache/phoenix/blob/master/phoenix-core/src/main/java/org/apache/phoenix/exception/SQLExceptionCode.java#L453-L459]
>  ignores all that information and creates SQLException with just template 
> message and loses the root cause exception also.
> {code:java}
>     OPERATION_TIMED_OUT(6000, "TIM01", "Operation timed out.", new Factory() {
>         @Override
>         public SQLException newException(SQLExceptionInfo info) {
>             return new SQLTimeoutException(OPERATION_TIMED_OUT.getMessage(),
>                     OPERATION_TIMED_OUT.getSQLState(), 
> OPERATION_TIMED_OUT.getErrorCode());
>         }
>     }),
> {code}
> Instead it should create SQLTimeoutException from SQLExceptionInfo object.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to