[
https://issues.apache.org/jira/browse/CASSANDRA-18487?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17717486#comment-17717486
]
Hao Zhong commented on CASSANDRA-18487:
---------------------------------------
This bug is for Lucene. Sorry that I reported to the wrong project.
> MappedByteBufferIndexInputProvider can better throw
> UndeclaredThrowableException
> --------------------------------------------------------------------------------
>
> Key: CASSANDRA-18487
> URL: https://issues.apache.org/jira/browse/CASSANDRA-18487
> Project: Cassandra
> Issue Type: Bug
> Reporter: Hao Zhong
> Priority: Normal
>
> MappedByteBufferIndexInputProvider has the following code:
> {code:java}
> private static BufferCleaner newBufferCleaner(final MethodHandle unmapper) {
> ...
> try {
> unmapper.invokeExact(buffer);
> } catch (Throwable t) {
> throw new IOException("Unable to unmap the mapped buffer: " +
> resourceDescription, t);
> }
> }{code}
> This method rethrow IOException, when calling invokeExact fails. However,
> other methods throw UndeclaredThrowableException for the same errors. For
> example, SnowballProgram.find_among is as follows:
> {code:java}
> protected int find_among(Among v[]) {
> ..,
>
> try {
> res = (boolean) w.method.invokeExact(this);
> } catch (Error | RuntimeException e) {
> throw e;
> } catch (Throwable e) {
> throw new UndeclaredThrowableException(e);
> }
> }{code}
> Another example is AttributeFactory.{color:#000000}createInstance{color}
> :
> {code:java}
>
> protected A createInstance() {
> try {
> // be explicit with casting, so javac compiles correct call to
> polymorphic signature:
> final AttributeImpl impl = (AttributeImpl) constr.invokeExact();
> // now cast to generic type:
> return (A) impl;
> } catch (Error | RuntimeException e) {
> throw e;
> } catch (Throwable e) {
> throw new UndeclaredThrowableException(e);
> }
> }
> {code}
> UndeclaredThrowableException looks more reasonable. Can this be fixed?
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]