Repository: netty/netty
File: common/src/main/java/io/netty/util/internal/PlatformDependent.java (Java)

Code before:
        if (CLEANER == NOOP && !PlatformDependent0.isExplicitNoUnsafe()) {
            logger.info(
                    "Your platform does not provide complete low-level API for accessing direct buffers reliably. " +
                    "Unless explicitly requested, heap buffer will always be preferred to avoid potential system " +
                    "instability.");
        }

        final Set<String> availableClassifiers = new LinkedHashSet<>();

        if (!addPropertyOsClassifiers(availableClassifiers)) {
            addFilesystemOsClassifiers(availableClassifiers);
        }
        LINUX_OS_CLASSIFIERS = Collections.unmodifiableSet(availableClassifiers);

        boolean jfrAvailable;
        Throwable jfrFailure = null;
        try {
            //noinspection Since15
            jfrAvailable = FlightRecorder.isAvailable();
        } catch (Throwable t) {
            jfrFailure = t;
            jfrAvailable = false;
        }
        JFR = SystemPropertyUtil.getBoolean("io.netty.jfr.enabled", jfrAvailable);
        if (logger.isDebugEnabled()) {
            logger.debug("-Dio.netty.jfr.enabled: {}", JFR, jfrFailure);
        }
    }

    // For specifications, see https://www.freedesktop.org/software/systemd/man/os-release.html
    static void addFilesystemOsClassifiers(final Set<String> availableClassifiers) {
        if (processOsReleaseFile("/etc/os-release", availableClassifiers)) {
            return;
        }
        processOsReleaseFile("/usr/lib/os-release", availableClassifiers);
    }

    private static boolean processOsReleaseFile(String osReleaseFileName, Set<String> availableClassifiers) {
        Path file = Paths.get(osReleaseFileName);
        return AccessController.doPrivileged((PrivilegedAction<Boolean>) () -> {
            try {
                if (Files.exists(file)) {
                    try (BufferedReader reader = new BufferedReader(new InputStreamReader(
                            new BoundedInputStream(Files.newInputStream(file)), StandardCharsets.UTF_8))) {
                        String line;
                        while ((line = reader.readLine()) != null) {
                            if (line.startsWith(LINUX_ID_PREFIX)) {
                                String id = normalizeOsReleaseVariableValue(
                                        line.substring(LINUX_ID_PREFIX.length()));
                                addClassifier(availableClassifiers, id);
                            } else if (line.startsWith(LINUX_ID_LIKE_PREFIX)) {

Review comment (suggestion):
Maybe only include the stack trace if trace-level logging is enabled, like we do in a few places in `PlatformDependent0`

Code after:
        if (CLEANER == NOOP && !PlatformDependent0.isExplicitNoUnsafe()) {
            logger.info(
                    "Your platform does not provide complete low-level API for accessing direct buffers reliably. " +
                    "Unless explicitly requested, heap buffer will always be preferred to avoid potential system " +
                    "instability.");
        }

        final Set<String> availableClassifiers = new LinkedHashSet<>();

        if (!addPropertyOsClassifiers(availableClassifiers)) {
            addFilesystemOsClassifiers(availableClassifiers);
        }
        LINUX_OS_CLASSIFIERS = Collections.unmodifiableSet(availableClassifiers);

        boolean jfrAvailable;
        Throwable jfrFailure = null;
        try {
            //noinspection Since15
            jfrAvailable = FlightRecorder.isAvailable();
        } catch (Throwable t) {
            jfrFailure = t;
            jfrAvailable = false;
        }
        JFR = SystemPropertyUtil.getBoolean("io.netty.jfr.enabled", jfrAvailable);
        if (logger.isTraceEnabled() && jfrFailure != null) {
            logger.debug("-Dio.netty.jfr.enabled: {}", JFR, jfrFailure);
        } else if (logger.isDebugEnabled()) {
            logger.debug("-Dio.netty.jfr.enabled: {}", JFR);
        }
    }

    // For specifications, see https://www.freedesktop.org/software/systemd/man/os-release.html
    static void addFilesystemOsClassifiers(final Set<String> availableClassifiers) {
        if (processOsReleaseFile("/etc/os-release", availableClassifiers)) {
            return;
        }
        processOsReleaseFile("/usr/lib/os-release", availableClassifiers);
    }

    private static boolean processOsReleaseFile(String osReleaseFileName, Set<String> availableClassifiers) {
        Path file = Paths.get(osReleaseFileName);
        return AccessController.doPrivileged((PrivilegedAction<Boolean>) () -> {
            try {
                if (Files.exists(file)) {
                    try (BufferedReader reader = new BufferedReader(new InputStreamReader(
                            new BoundedInputStream(Files.newInputStream(file)), StandardCharsets.UTF_8))) {
                        String line;
                        while ((line = reader.readLine()) != null) {
                            if (line.startsWith(LINUX_ID_PREFIX)) {
                                String id = normalizeOsReleaseVariableValue(
                                        line.substring(LINUX_ID_PREFIX.length()));