java-native-access/jna · error · RuntimeException

RuntimeException(e)

Error message

RuntimeException(e)

What it means

Wraps an UnsupportedEncodingException raised while decoding an extended-attribute name from bytes using the charset name passed to the helper; the fault is an invalid or unsupported charset name for attribute decoding, not the attribute data itself.

Solutions

  1. Pass a valid charset name guaranteed by the JVM (e.g. UTF-8) instead of an arbitrary one
  2. Catch RuntimeException at the list() call site and treat the attribute set as undecodable rather than aborting
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at contrib/platform/src/com/sun/jna/platform/bsd/ExtAttrUtil.java:108 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of java-native-access/jna@d036ad9781 (2026-09-12). Data as JSON: /api/errors/28e50edda764393b. Report an issue: GitHub.

Appendix: source

Thrown at contrib/platform/src/com/sun/jna/platform/bsd/ExtAttrUtil.java:108

    public static void delete(String path, String name) throws IOException {
        int r = ExtAttr.INSTANCE.extattr_delete_file(path, ExtAttr.EXTATTR_NAMESPACE_USER, name);
        if (r < 0) {
            throw new IOException("errno: " + Native.getLastError());
        }
    }

    private static List<String> decodeStringList(ByteBuffer buffer) {
        List<String> list = new ArrayList<>();

        while (buffer.hasRemaining()) {
            int length = buffer.get() & 0xFF;
            byte[] value = new byte[length];
            buffer.get(value);

            try {
                list.add(new String(value, "UTF-8"));
            } catch (UnsupportedEncodingException e) {
                throw new RuntimeException(e);
            }
        }

        return list;
    }

}

View on GitHub (pinned to d036ad9781)