[
https://issues.apache.org/jira/browse/CALCITE-508?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16341844#comment-16341844
]
ASF GitHub Bot commented on CALCITE-508:
----------------------------------------
GitHub user asolimando opened a pull request:
https://github.com/apache/calcite-avatica/pull/23
[CALCITE-508] wrapping RuntimeException into SQLException in
Cursor.Accessor getAccessor method, added unit tests
The PR in summary:
1) I have basically followed the suggestion of wrapping RuntimeExceptions
into SQLException into accessors by handling this into the getObject methods,
as consistently invoked under the hood by the accessors themselves.
2) I have added some unit test for checking for error while accessing
columns for a cursor not initialized (i.e., next() was never called), and for
checking that the same operations were ok after calling next() on the cursor.
3) Minor refactoring of tests in
"AvaticaResultSetThrowsSqlExceptionTest.java" by the addition of an auxiliary
method.
I still have one doubt:
Line 71 in IteratorCursor.java: throw new NoSuchElementException("Invalid
cursor position");
Would it make more sense to directly throw this exception as an instance of
SQLException (as it will end up anyway, being a RuntimeException) or not?
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/asolimando/calcite-avatica master
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/calcite-avatica/pull/23.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #23
----
commit 94a9553369815b5e039f35e9859c003c71fbe0a0
Author: Alessandro Solimando <18898964+asolimando@...>
Date: 2018-01-23T21:07:39Z
[CALCITE-508] wrapping RuntimeException into SQLException in
Cursor.Accessor getAccessor method, added unit tests
----
> Reading from ResultSet before calling next() should throw SQLException not
> NoSuchElementException
> -------------------------------------------------------------------------------------------------
>
> Key: CALCITE-508
> URL: https://issues.apache.org/jira/browse/CALCITE-508
> Project: Calcite
> Issue Type: Bug
> Reporter: Julian Hyde
> Assignee: Julian Hyde
> Priority: Major
> Labels: newbie
>
> Reading from ResultSet before calling next() should throw SQLException not
> NoSuchElementException.
> Each of the Cursor.Accessor.getXxx methods should convert runtime exceptions
> to SQLException.
> JdbcTest.testExtract currently demonstrates this problem; it passes if there
> is a NoSuchElementException, but should look for a SQLException.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)