Ticket #23619: 23619.patch

File 23619.patch, 1.9 KB (added by GerdP, 5 weeks ago)

prefer to show key SOFTWARE
Microsoft
Windows NT
CurrentVersion\DisplayVersion

  • src/org/openstreetmap/josm/tools/PlatformHookWindows.java

     
    292292    }
    293293
    294294    /**
     295     * Returns the Windows display version from registry (example: "22H2")
     296     * @return the Windows display version from registry
     297     * @throws IllegalAccessException if Java language access control is enforced and the underlying method is inaccessible
     298     * @throws InvocationTargetException if the underlying method throws an exception
     299     * @since xxx
     300     */
     301    public static String getDisplayVersion() throws IllegalAccessException, InvocationTargetException {
     302        return WinRegistry.readString(HKEY_LOCAL_MACHINE, CURRENT_VERSION, "DisplayVersion");
     303    }
     304
     305    /**
    295306     * Returns the Windows current build number from registry (example: "15063")
    296307     * @return the Windows current build number from registry
    297308     * @throws IllegalAccessException if Java language access control is enforced and the underlying method is inaccessible
     
    306317        StringBuilder sb = new StringBuilder();
    307318        try {
    308319            sb.append(getProductName());
    309             String releaseId = getReleaseId();
    310             if (releaseId != null) {
    311                 sb.append(' ').append(releaseId);
     320            String displayVersion = getDisplayVersion();
     321            if (displayVersion != null) {
     322                sb.append(' ').append(displayVersion);
     323            } else {
     324                String releaseId = getReleaseId();
     325                if (releaseId != null) {
     326                    sb.append(' ').append(releaseId);
     327                }
    312328            }
    313329            sb.append(" (").append(getCurrentBuild()).append(')');
    314330        } catch (ReflectiveOperationException | JosmRuntimeException | NoClassDefFoundError e) {