Skip to content

NativeLibraryLoader.java throws inconsistent exceptions when failing to open Jar files #1999

@drhaozhong

Description

@drhaozhong

If this class fails to open a jar file, computeNativesHash throws UnsupportedOperationException:

try{ ... conn = url.openConnection(); } catch (IOException ex) { throw new UnsupportedOperationException(ex); } finally { if (conn != null) { try { conn.getInputStream().close(); conn.getOutputStream().close(); } catch (IOException ex) { } } }

However, loadNativeLibrary throws UncheckedIOException

try { conn = url.openConnection(); in = conn.getInputStream(); } catch (IOException ex) { // Maybe put more detail here? Not sure.. throw new UncheckedIOException("Failed to open file: '" + url + "'. Error: " + ex, ex); }

This is confusing. Can this problem be fixed?

Metadata

Metadata

Assignees

No one assigned

    Labels

    defectSomething that is supposed to work, but doesn't. Less severe than a "bug"

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions