You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by st...@apache.org on 2007/11/02 12:13:40 UTC

svn commit: r591304 - in /ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/rmic: DefaultRmicAdapter.java SunRmic.java WLRmic.java

Author: stevel
Date: Fri Nov  2 04:13:39 2007
New Revision: 591304

URL: http://svn.apache.org/viewvc?rev=591304&view=rev
Log:
Bug ID 43780: weblogic RMIC fails on ant1.7.0

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/rmic/SunRmic.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/rmic/WLRmic.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java?rev=591304&r1=591303&r2=591304&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java Fri Nov  2 04:13:39 2007
@@ -43,20 +43,33 @@
     private Rmic attributes;
     private FileNameMapper mapper;
     private static final Random RAND = new Random();
-    /** suffix denoting a stub file */
+    /** suffix denoting a stub file: {@value} */
     public static final String RMI_STUB_SUFFIX = "_Stub";
-    /** suffix denoting a skel file */
+    /** suffix denoting a skel file: {@value} */
     public static final String RMI_SKEL_SUFFIX = "_Skel";
-    /** suffix denoting a tie file */
+    /** suffix denoting a tie file: {@value} */
     public static final String RMI_TIE_SUFFIX = "_Tie";
-    /** arg for compat */
+    /** arg for compat: {@value} */
     public static final String STUB_COMPAT = "-vcompat";
-    /** arg for 1.1 */
+    /** arg for 1.1: {@value} */
     public static final String STUB_1_1 = "-v1.1";
-    /** arg for 1.2 */
+    /** arg for 1.2: {@value} */
     public static final String STUB_1_2 = "-v1.2";
 
     /**
+     * option for stub 1.1 in the rmic task: {@value}
+     */
+    public static final String STUB_OPTION_1_1 = "1.1";
+    /**
+     * option for stub 1.2 in the rmic task: {@value}
+     */
+    public static final String STUB_OPTION_1_2 = "1.2";
+    /**
+     * option for stub compat in the rmic task: {@value}
+     */
+    public static final String STUB_OPTION_COMPAT = "compat";
+
+    /**
      * Default constructor
      */
     public DefaultRmicAdapter() {
@@ -196,35 +209,13 @@
 
         cmd.createArgument().setValue("-classpath");
         cmd.createArgument().setPath(classpath);
-
-        //handle the many different stub options.
-        String stubVersion = attributes.getStubVersion();
-        //default is compatibility
-        String stubOption = null;
-        if (null != stubVersion) {
-            if ("1.1".equals(stubVersion)) {
-                stubOption = STUB_1_1;
-            } else if ("1.2".equals(stubVersion)) {
-                stubOption = STUB_1_2;
-            } else if ("compat".equals(stubVersion)) {
-                stubOption = STUB_COMPAT;
-            } else {
-                //anything else
-                attributes.log("Unknown stub option " + stubVersion);
-                //do nothing with the value? or go -v+stubVersion??
-            }
-        }
-        //for java1.5+, we generate compatible stubs, that is, unless
-        //the caller asked for IDL or IIOP support.
-        if (stubOption == null
-            && !attributes.getIiop()
-            && !attributes.getIdl()) {
-            stubOption = STUB_COMPAT;
-        }
+        String stubOption=addStubVersionOptions();
         if (stubOption != null) {
             //set the non-null stubOption
             cmd.createArgument().setValue(stubOption);
         }
+
+
         if (null != attributes.getSourceBase()) {
             cmd.createArgument().setValue("-keepgenerated");
         }
@@ -262,6 +253,40 @@
      }
 
     /**
+     * This is an override point; get the stub version off the rmic command and
+     * translate that into a compiler-specific argument
+     * @return a string to use for the stub version; can be null
+     * @since Ant1.7.1
+     */
+    protected String addStubVersionOptions() {
+        //handle the many different stub options.
+        String stubVersion = attributes.getStubVersion();
+        //default is compatibility
+        String stubOption = null;
+        if (null != stubVersion) {
+            if (STUB_OPTION_1_1.equals(stubVersion)) {
+                stubOption = STUB_1_1;
+            } else if (STUB_OPTION_1_2.equals(stubVersion)) {
+                stubOption = STUB_1_2;
+            } else if (STUB_OPTION_COMPAT.equals(stubVersion)) {
+                stubOption = STUB_COMPAT;
+            } else {
+                //anything else
+                attributes.log("Unknown stub option " + stubVersion);
+                //do nothing with the value? or go -v+stubVersion??
+            }
+        }
+        //for java1.5+, we generate compatible stubs, that is, unless
+        //the caller asked for IDL or IIOP support.
+        if (stubOption == null
+            && !attributes.getIiop()
+            && !attributes.getIdl()) {
+            stubOption = STUB_COMPAT;
+        }
+        return stubOption;
+    }
+
+    /**
      * Preprocess the compiler arguments in any way you see fit.
      * This is to allow compiler adapters to validate or filter the arguments.
      * The base implementation returns the original compiler arguments unchanged.
@@ -386,7 +411,7 @@
 
             if (!attributes.getIiop() && !attributes.getIdl()) {
                 // JRMP with simple naming convention
-                if ("1.2".equals(attributes.getStubVersion())) {
+                if (STUB_OPTION_1_2.equals(attributes.getStubVersion())) {
                     target = new String[] {
                         base + getStubClassSuffix() + ".class"
                     };

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/rmic/SunRmic.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/rmic/SunRmic.java?rev=591304&r1=591303&r2=591304&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/rmic/SunRmic.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/rmic/SunRmic.java Fri Nov  2 04:13:39 2007
@@ -52,7 +52,7 @@
     public static final String ERROR_NO_RMIC_ON_CLASSPATH = "Cannot use SUN rmic, as it is not "
                                          + "available.  A common solution is to "
                                          + "set the environment variable "
-                                         + "JAVA_HOME or CLASSPATH.";
+                                         + "JAVA_HOME";
     /** Error message to use when there is an error starting the sun rmic compiler */
     public static final String ERROR_RMIC_FAILED = "Error starting SUN rmic: ";
 

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/rmic/WLRmic.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/rmic/WLRmic.java?rev=591304&r1=591303&r2=591304&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/rmic/WLRmic.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/rmic/WLRmic.java Fri Nov  2 04:13:39 2007
@@ -19,6 +19,9 @@
 package org.apache.tools.ant.taskdefs.rmic;
 
 import java.lang.reflect.Method;
+import java.util.List;
+import java.util.ArrayList;
+
 import org.apache.tools.ant.AntClassLoader;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Project;
@@ -40,9 +43,7 @@
     /** The error string to use if not able to find the weblogic rmic */
     public static final String ERROR_NO_WLRMIC_ON_CLASSPATH =
         "Cannot use WebLogic rmic, as it is not "
-        + "available.  A common solution is to "
-        + "set the environment variable "
-        + "CLASSPATH.";
+        + "available. Add it to Ant's classpath with the -lib option";
 
     /** The error string to use if not able to start the weblogic rmic */
     public static final String ERROR_WLRMIC_FAILED = "Error starting WebLogic rmic: ";
@@ -50,6 +51,7 @@
     public static final String WL_RMI_STUB_SUFFIX = "_WLStub";
     /** The skeleton suffix */
     public static final String WL_RMI_SKEL_SUFFIX = "_WLSkel";
+    public static final String UNSUPPORTED_STUB_OPTION = "Unsupported stub option: ";
 
     /**
      * Carry out the rmic compilation.
@@ -116,4 +118,19 @@
     protected String[] preprocessCompilerArgs(String[] compilerArgs) {
         return filterJvmCompilerArgs(compilerArgs);
     }
+
+    /**
+     * This is an override point; no stub version is returned. If any
+     * stub option is set, a warning is printed.
+     * @return null, for no stub version
+     */
+    protected String addStubVersionOptions() {
+        //handle the many different stub options.
+        String stubVersion = getRmic().getStubVersion();
+        if (null != stubVersion) {
+            getRmic().log(UNSUPPORTED_STUB_OPTION + stubVersion,Project.MSG_WARN);
+        }
+        return null;
+    }
+
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org