You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by an...@apache.org on 2013/04/28 21:53:25 UTC
svn commit: r1476822 - in /ant/core/trunk: WHATSNEW
src/main/org/apache/tools/ant/taskdefs/Execute.java
Author: antoine
Date: Sun Apr 28 19:53:25 2013
New Revision: 1476822
URL: http://svn.apache.org/r1476822
Log:
simplifying Execute.getEnvironmentVariables since we are now always at least on Java 1.5
Modified:
ant/core/trunk/WHATSNEW
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Execute.java
Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=1476822&r1=1476821&r2=1476822&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Sun Apr 28 19:53:25 2013
@@ -27,6 +27,8 @@ Other changes:
* strict attribute added to <signjar>.
Bugzilla Report 54889.
+ * simplifying Execute.getEnvironmentVariables since we are only running on Java 1.5 or higher now
+
Changes from Ant 1.8.4 TO Ant 1.9.0
===================================
Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Execute.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Execute.java?rev=1476822&r1=1476821&r2=1476822&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Execute.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Execute.java Sun Apr 28 19:53:25 2013
@@ -38,7 +38,6 @@ import org.apache.tools.ant.taskdefs.con
import org.apache.tools.ant.taskdefs.launcher.CommandLauncher;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.util.FileUtils;
-import org.apache.tools.ant.util.JavaEnvUtils;
import org.apache.tools.ant.util.StringUtils;
/**
@@ -109,14 +108,9 @@ public class Execute {
if (procEnvironment != null) {
return procEnvironment;
}
- if (JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_1_5)
- && !Os.isFamily("openvms")) {
+ if (!Os.isFamily("openvms")) {
try {
- @SuppressWarnings("unchecked")
- final Map<String, String> cast = (Map<String, String>) System.class
- .getMethod("getenv", new Class[0])
- .invoke(null, new Object[0]);
- procEnvironment = cast;
+ procEnvironment = System.getenv();
return procEnvironment;
} catch (Exception x) {
x.printStackTrace();
Re: svn commit: r1476822 - in /ant/core/trunk: WHATSNEW src/main/org/apache/tools/ant/taskdefs/Execute.java
Posted by Vimil Saju <vi...@yahoo.com>.
Hi Antoine,
Sometime back I had worked on an issue related to CommandLaunchers and I noticed that there is a VMSCommandLauncher class for launching processes on OpenVMS. Is it possible that this code can be moved there? I think this is not going to be straightforward but won't moving OS specific code to their corresponding CommandLaunchers help in insulating Ant Core from the specifics of the underlying OS.
Thanks
Vimil
________________________________
From: Antoine Levy Lambert <an...@gmx.de>
To: dev@ant.apache.org
Sent: Sunday, April 28, 2013 1:37 PM
Subject: Re: svn commit: r1476822 - in /ant/core/trunk: WHATSNEW src/main/org/apache/tools/ant/taskdefs/Execute.java
Hi,
I did this change while investigating a bug report 45530 which was saying that Ant incorrectly copies env variables with non-latin text.
It seems that there is now a lot of code which is remaining only for openvms and I wonder whether this is necessary. If JVMs on openvms are now able to deal properly with the environment variables,
the complete getProcEnvCommand method in Execute.java can go away, and getEnvironmentVariables will be much shorter. in private String[] patchEnvironment there is also some special handling of OpenVMS.
Regards,
Antoine
On Apr 28, 2013, at 3:53 PM, antoine@apache.org wrote:
> Author: antoine
> Date: Sun Apr 28 19:53:25 2013
> New Revision: 1476822
>
> URL: http://svn.apache.org/r1476822
> Log:
> simplifying Execute.getEnvironmentVariables since we are now always at least on Java 1.5
>
> Modified:
> ant/core/trunk/WHATSNEW
> ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Execute.java
>
> Modified: ant/core/trunk/WHATSNEW
> URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=1476822&r1=1476821&r2=1476822&view=diff
> ==============================================================================
> --- ant/core/trunk/WHATSNEW (original)
> +++ ant/core/trunk/WHATSNEW Sun Apr 28 19:53:25 2013
> @@ -27,6 +27,8 @@ Other changes:
> * strict attribute added to <signjar>.
> Bugzilla Report 54889.
>
> + * simplifying Execute.getEnvironmentVariables since we are only running on Java 1.5 or higher now
> +
> Changes from Ant 1.8.4 TO Ant 1.9.0
> ===================================
>
>
> Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Execute.java
> URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Execute.java?rev=1476822&r1=1476821&r2=1476822&view=diff
> ==============================================================================
> --- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Execute.java (original)
> +++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Execute.java Sun Apr 28 19:53:25 2013
> @@ -38,7 +38,6 @@ import org.apache.tools.ant.taskdefs.con
> import org.apache.tools.ant.taskdefs.launcher.CommandLauncher;
> import org.apache.tools.ant.types.Commandline;
> import org.apache.tools.ant.util.FileUtils;
> -import org.apache.tools.ant.util.JavaEnvUtils;
> import org.apache.tools.ant.util.StringUtils;
>
> /**
> @@ -109,14 +108,9 @@ public class Execute {
> if (procEnvironment != null) {
> return procEnvironment;
> }
> - if (JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_1_5)
> - && !Os.isFamily("openvms")) {
> + if (!Os.isFamily("openvms")) {
> try {
> - @SuppressWarnings("unchecked")
> - final Map<String, String> cast = (Map<String, String>) System.class
> - .getMethod("getenv", new Class[0])
> - .invoke(null, new Object[0]);
> - procEnvironment = cast;
> + procEnvironment = System.getenv();
> return procEnvironment;
> } catch (Exception x) {
> x.printStackTrace();
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: svn commit: r1476822 - in /ant/core/trunk: WHATSNEW src/main/org/apache/tools/ant/taskdefs/Execute.java
Posted by Antoine Levy Lambert <an...@gmx.de>.
Hi,
I did this change while investigating a bug report 45530 which was saying that Ant incorrectly copies env variables with non-latin text.
It seems that there is now a lot of code which is remaining only for openvms and I wonder whether this is necessary. If JVMs on openvms are now able to deal properly with the environment variables,
the complete getProcEnvCommand method in Execute.java can go away, and getEnvironmentVariables will be much shorter. in private String[] patchEnvironment there is also some special handling of OpenVMS.
Regards,
Antoine
On Apr 28, 2013, at 3:53 PM, antoine@apache.org wrote:
> Author: antoine
> Date: Sun Apr 28 19:53:25 2013
> New Revision: 1476822
>
> URL: http://svn.apache.org/r1476822
> Log:
> simplifying Execute.getEnvironmentVariables since we are now always at least on Java 1.5
>
> Modified:
> ant/core/trunk/WHATSNEW
> ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Execute.java
>
> Modified: ant/core/trunk/WHATSNEW
> URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=1476822&r1=1476821&r2=1476822&view=diff
> ==============================================================================
> --- ant/core/trunk/WHATSNEW (original)
> +++ ant/core/trunk/WHATSNEW Sun Apr 28 19:53:25 2013
> @@ -27,6 +27,8 @@ Other changes:
> * strict attribute added to <signjar>.
> Bugzilla Report 54889.
>
> + * simplifying Execute.getEnvironmentVariables since we are only running on Java 1.5 or higher now
> +
> Changes from Ant 1.8.4 TO Ant 1.9.0
> ===================================
>
>
> Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Execute.java
> URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Execute.java?rev=1476822&r1=1476821&r2=1476822&view=diff
> ==============================================================================
> --- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Execute.java (original)
> +++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Execute.java Sun Apr 28 19:53:25 2013
> @@ -38,7 +38,6 @@ import org.apache.tools.ant.taskdefs.con
> import org.apache.tools.ant.taskdefs.launcher.CommandLauncher;
> import org.apache.tools.ant.types.Commandline;
> import org.apache.tools.ant.util.FileUtils;
> -import org.apache.tools.ant.util.JavaEnvUtils;
> import org.apache.tools.ant.util.StringUtils;
>
> /**
> @@ -109,14 +108,9 @@ public class Execute {
> if (procEnvironment != null) {
> return procEnvironment;
> }
> - if (JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_1_5)
> - && !Os.isFamily("openvms")) {
> + if (!Os.isFamily("openvms")) {
> try {
> - @SuppressWarnings("unchecked")
> - final Map<String, String> cast = (Map<String, String>) System.class
> - .getMethod("getenv", new Class[0])
> - .invoke(null, new Object[0]);
> - procEnvironment = cast;
> + procEnvironment = System.getenv();
> return procEnvironment;
> } catch (Exception x) {
> x.printStackTrace();
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org