drzhonghao opened a new issue, #12250:
URL: https://github.com/apache/lucene/issues/12250

   ### Description
   
   MappedByteBufferIndexInputProvider has the following code:
   
    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);
         }
   
    }
   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:
   
   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);
           }
   }
   Another example is AttributeFactory.createInstance
   
   :
   
    
    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);
           }
         }
   
      
   UndeclaredThrowableException looks more reasonable.  Can this be fixed?
   
   ### Version and environment details
   
   _No response_


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

To unsubscribe, e-mail: [email protected]

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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to