Changeset 6962 in josm for trunk/src/org/openstreetmap/josm/tools
- Timestamp:
- 2014-04-07T23:49:09+02:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/PlatformHookUnixoid.java
r6953 r6962 48 48 os.startsWith("Linux Debian GNU/Linux 7") || os.startsWith("Linux Mint") || 49 49 os.startsWith("Linux Ubuntu 12") || os.startsWith("Linux Ubuntu 13") || os.startsWith("Linux Ubuntu 14"))) { 50 askUpdateJava(java, "apt://openjdk-7-jre"); 50 String url; 51 // apturl does not exist on Debian (see #8465) 52 if (os.startsWith("Linux Debian")) { 53 url = "https://packages.debian.org/stable/openjdk-7-jre"; 54 } else if (getPackageDetails("apturl") != null) { 55 url = "apt://openjdk-7-jre"; 56 } else if (os.startsWith("Linux Mint")) { 57 url = "http://community.linuxmint.com/software/view/openjdk-7-jre"; 58 } else { 59 url = "http://packages.ubuntu.com/trusty/openjdk-7-jre"; 60 } 61 askUpdateJava(java, url); 51 62 } 52 63 } … … 149 160 * @return The package name and package version if it can be identified, null otherwise 150 161 */ 151 public String getPackageDetails(String packageName) {162 public static String getPackageDetails(String packageName) { 152 163 try { 153 String version = Utils.execOutput(Arrays.asList("dpkg-query", "--show", "--showformat", "${Architecture}-${Version}", packageName)); 154 return packageName + ":" + version; 164 String version = Utils.execOutput(Arrays.asList( 165 "dpkg-query", "--show", "--showformat", "${Architecture}-${Version}", packageName)); 166 if (version != null) { 167 return packageName + ":" + version; 168 } 155 169 } catch (IOException e) { 156 170 Main.warn(e); 157 return null;158 }171 } 172 return null; 159 173 } 160 174 -
trunk/src/org/openstreetmap/josm/tools/Utils.java
r6889 r6962 804 804 */ 805 805 public static String execOutput(List<String> command) throws IOException { 806 if (Main.isDebugEnabled()) { 807 Main.debug(join(" ", command)); 808 } 806 809 Process p = new ProcessBuilder(command).start(); 807 810 BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream())); … … 817 820 } 818 821 Utils.close(input); 819 return all .toString();822 return all != null ? all.toString() : null; 820 823 } 821 824
Note:
See TracChangeset
for help on using the changeset viewer.