{"id":1935,"date":"2013-06-19T09:37:24","date_gmt":"2013-06-19T07:37:24","guid":{"rendered":"http:\/\/www.tutego.de\/blog\/javainsel\/?p=1935"},"modified":"2013-06-19T09:37:24","modified_gmt":"2013-06-19T07:37:24","slug":"java-se-7-update-25","status":"publish","type":"post","link":"https:\/\/www.tutego.de\/blog\/javainsel\/2013\/06\/java-se-7-update-25\/","title":{"rendered":"Java SE 7 Update 25"},"content":{"rendered":"<p><a href=\"https:\/\/blogs.oracle.com\/java\/entry\/java_se_7_update_25\">https:\/\/blogs.oracle.com\/java\/entry\/java_se_7_update_25<\/a>. Mit den \u00fcblichen Security-Udates und sonst noch ein paar \u00c4nderungen: <a href=\"http:\/\/www.oracle.com\/technetwork\/java\/javase\/7u25-relnotes-1955741.html\">http:\/\/www.oracle.com\/technetwork\/java\/javase\/7u25-relnotes-1955741.html<\/a>. Nicht uninteressant finde ich folgendes, was die Kompatibilit\u00e4t von existierenden Anwendungen beeinflussen k\u00f6nnte:<\/p>\n<blockquote>\n<h5><a name=\"jruntime\">Changes to Runtime.exec<\/a><\/h5>\n<p>On the Windows platform, the decoding of command strings specified to<code>java.lang.ProcessBuilder<\/code> and the <code>exec<\/code> methods defined by <code>java.lang.Runtime<\/code>, has been made stricter since JDK 7u21. This may cause problems for applications that are using one or more of these methods with commands that contain spaces in the program name, or are invoking these methods with commands that are not quoted correctly. For more information see <a href=\"http:\/\/www.oracle.com\/technetwork\/java\/javase\/7u21-relnotes-1932873.html#jruntime\">JDK 7u21 Release Notes<\/a>.<\/p>\n<p>In JDK 7u25, the system property <code>jdk.lang.Process.allowAmbigousCommands<\/code> can be used to relax the checking process and may be used as a workaround for some applications that are impacted by the stricter validation. The workaround is only effective for applications that are run without a security manager. To use this workaround, either the command line should be updated to include <code>-Djdk.lang.Process.allowAmbigousCommands=true<\/code> or the java application should set the system property <code>jdk.lang.Process.allowAmbigousCommands<\/code> to true.<\/p>\n<p>Quoting and escaping commands on Windows platform is complicated. The following examples may be useful to developers if they are impacted by the stricter validation.<\/p>\n<p>Example 1: The application needs to be launched with <code>C:\\Program Files\\foo.exe<\/code>.<\/p>\n<p>Here are 3 possible ways:<\/p>\n<p><code>Process p = new ProcessBuilder(&quot;c:\\\\Program File\\\\foo.exe&quot;).start();<\/code>      <br \/><code>Process p = Runtime.getRuntime().exec(new String[] { &quot;c:\\\\Program File\\\\foo.exe&quot; });<\/code>      <br \/><code>Process p = Runtime.getRuntime().exec(&quot;\\&quot;c:\\\\Program File\\\\foo.exe\\&quot;&quot;);<\/code><\/p>\n<p>Where it is not possible to change the application to use one of the above approaches, then the system property <code>jdk.lang.Process.allowAmbigousCommands<\/code> may be used as a workaround.<\/p>\n<p>Example 2: The application needs to launch <code>&quot;dir &gt; dir.out&quot;<\/code>.      <br \/>This case requires launching <code>cmd.exe<\/code>, and also it needs the output to be redirected to a file. The best approach is to use the <code>ProcessBuilder<\/code> as shown in the following example:<\/p>\n<p><code>Process p = new ProcessBuilder(&quot;cmd&quot;, &quot;\/C&quot;, &quot;dir&quot;).redirectOutput(new File(&quot;dir.out&quot;)).start();<\/code><\/p>\n<p>Where it not possible to change code to use <code>ProcessBuilder<\/code> or <code>redirectOutput<\/code>, then the following approaches can also be used:<\/p>\n<p><code>Process p = new ProcessBuilder(&quot;cmd&quot;, &quot;\/C&quot;, &quot;dir &gt; dir.out&quot;).start();<\/code>      <br \/><code>Process p = Runtime.getRuntime().exec(&quot;cmd \/C \\&quot;dir &gt; dir.out\\&quot;&quot;);<\/code><\/p>\n<p>Example 3: The application wants to launch a command with parameters that require special quoting; for example <code>&quot;log.bat \\&quot;&gt;error&lt;\\&quot;&quot;<\/code>.      <br \/>Here are 3 possible ways to do this:<\/p>\n<p><code>Process p = new ProcessBuilder(&quot;cmd&quot;, &quot;\/C&quot;, &quot;log.bat&quot;, &quot;&gt;error&lt;&quot;).start();<\/code>      <br \/><code>Process p = Runtime.getRuntime().exec(new String[] { &quot;cmd&quot;, &quot;\/C&quot;, &quot;log.bat&quot;, &quot;&gt;error&lt;&quot; })<\/code>      <br \/><code>Process p = Runtime.getRuntime().exec(&quot;cmd \/C log.bat \\&quot;&gt;error&lt;\\&quot;&quot;);<\/code><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>https:\/\/blogs.oracle.com\/java\/entry\/java_se_7_update_25. Mit den \u00fcblichen Security-Udates und sonst noch ein paar \u00c4nderungen: http:\/\/www.oracle.com\/technetwork\/java\/javase\/7u25-relnotes-1955741.html. Nicht uninteressant finde ich folgendes, was die Kompatibilit\u00e4t von existierenden Anwendungen beeinflussen k\u00f6nnte: Changes to Runtime.exec On the Windows platform, the decoding of command strings specified tojava.lang.ProcessBuilder and the exec methods defined by java.lang.Runtime, has been made stricter since JDK 7u21. This may [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","_links_to":"","_links_to_target":""},"categories":[1],"tags":[],"class_list":["post-1935","post","type-post","status-publish","format-standard","hentry","category-allgemein"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.tutego.de\/blog\/javainsel\/wp-json\/wp\/v2\/posts\/1935","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tutego.de\/blog\/javainsel\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tutego.de\/blog\/javainsel\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tutego.de\/blog\/javainsel\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tutego.de\/blog\/javainsel\/wp-json\/wp\/v2\/comments?post=1935"}],"version-history":[{"count":0,"href":"https:\/\/www.tutego.de\/blog\/javainsel\/wp-json\/wp\/v2\/posts\/1935\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tutego.de\/blog\/javainsel\/wp-json\/wp\/v2\/media?parent=1935"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tutego.de\/blog\/javainsel\/wp-json\/wp\/v2\/categories?post=1935"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tutego.de\/blog\/javainsel\/wp-json\/wp\/v2\/tags?post=1935"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}