Ticket #17006: 17006.patch
| File 17006.patch, 2.4 KB (added by , 7 years ago) |
|---|
-
src/org/openstreetmap/josm/tools/PlatformHookWindows.java
172 172 private static final String CURRENT_VERSION = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"; 173 173 174 174 private String oSBuildNumber; 175 private Integer powerShellVersion; 175 176 177 176 178 @Override 177 179 public Platform getPlatform() { 178 180 return Platform.WINDOWS; … … 747 749 * @return the major version number of PowerShell. -1 in case of error 748 750 * @since 13465 749 751 */ 750 public static int getPowerShellVersion() { 751 try { 752 return Integer.parseInt(Utils.execOutput(Arrays.asList( 753 "powershell", "-Command", "$PSVersionTable.PSVersion.Major"), 2, TimeUnit.SECONDS)); 754 } catch (ExecutionException e) { 755 // PowerShell 2.0 (included in Windows 7) does not even support this 756 Logging.debug(e); 757 return -1; 758 } catch (NumberFormatException | IOException | InterruptedException e) { 759 Logging.error(e); 760 return -1; 761 } 752 public int getPowerShellVersion() { 753 if (powerShellVersion == null) { 754 powerShellVersion = -1; 755 try { 756 powerShellVersion = Integer.parseInt(Utils.execOutput(Arrays.asList( 757 "powershell", "-Command", "$PSVersionTable.PSVersion.Major"), 2, TimeUnit.SECONDS)); 758 } catch (ExecutionException e) { 759 // PowerShell 2.0 (included in Windows 7) does not even support this 760 Logging.debug(e); 761 } catch (NumberFormatException | IOException | InterruptedException e) { 762 Logging.error(e); 763 } 764 } 765 return powerShellVersion; 762 766 } 763 767 764 768 /** … … 769 773 * @throws IOException if any I/O error occurs 770 774 * @since 13458 771 775 */ 772 public staticString webRequest(String uri) throws IOException {776 public String webRequest(String uri) throws IOException { 773 777 // With PS 6.0 (not yet released in Windows) we could simply use: 774 778 // Invoke-WebRequest -SSlProtocol Tsl12 $uri 775 779 // .NET framework < 4.5 does not support TLS 1.2 (https://stackoverflow.com/a/43240673/2257172)
