+                    for (int i = firstFileName; i < args.length; i++) {
+                        out.println(args[i]);
+                    }
+                    out.flush();
+                    commandArray = new String[firstFileName+1];
+                    System.arraycopy(args, 0, commandArray, 0, firstFileName);
+                    commandArray[firstFileName] = "@" + tmpFile.getAbsolutePath();
+                } catch (IOException e) {
+                    throw new BuildException("Error creating temporary file", e, location);
+                } finally {
+                    if (out != null) {
+                        try {out.close();} catch (Throwable t) {}
+                    }
+                }
+            } else {
+                commandArray = args;
+            }
+            
+            try {
+                Execute exe = new Execute(new LogStreamHandler(attributes, 
+                                                               Project.MSG_INFO,
+                                                               Project.MSG_WARN));
+                exe.setAntRun(project);
+                exe.setWorkingDirectory(project.getBaseDir());
+                exe.setCommandline(commandArray);
+                exe.execute();
+                return exe.getExitValue();
+            } catch (IOException e) {
+                throw new BuildException("Error running " + args[0] 
+                        + " compiler", e, location);
+            }
+        } finally {
+            if (tmpFile != null) {
+                tmpFile.delete();
+            }
+        }
+    }
+}
diff -urN orig/src/main/org/apache/tools/ant/taskdefs/rmic/KaffeRmic.java src/main/org/apache/tools/ant/taskdefs/rmic/KaffeRmic.java
--- orig/src/main/org/apache/tools/ant/taskdefs/rmic/KaffeRmic.java	Thu Jan  1 09:00:00 1970
+++ src/main/org/apache/tools/ant/taskdefs/rmic/KaffeRmic.java	Sat Mar 10 23:54:06 2001
@@ -0,0 +1,99 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Apache Software Foundation.  All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ *    any, must include the following acknowlegement:
+ *       "This product includes software developed by the
+ *        Apache Software Foundation (http://www.apache.org/)."
+ *    Alternately, this acknowlegement may appear in the software itself,
+ *    if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Ant", and "Apache Software
+ *    Foundation" must not be used to endorse or promote products derived
+ *    from this software without prior written permission. For written
+ *    permission, please contact [email protected].
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ *    nor may "Apache" appear in their names without prior written
+ *    permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+package org.apache.tools.ant.taskdefs.rmic;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.LogOutputStream;
+import org.apache.tools.ant.types.Commandline;
+
+import java.io.*;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+
+/**
+ * The implementation of the rmic for Kaffe
+ *
+ * @author Takashi Okamoto <[email protected]>
+ */
+public class KaffeRmic extends DefaultRmicAdapter {
+
+    public boolean execute() throws BuildException {
+        attributes.log("Using Kaffe rmic", Project.MSG_VERBOSE);
+        Commandline cmd = setupRmicCommand();
+
+        try {
+            // Create an instance of the rmic
+	    Class c = Class.forName("kaffe.rmi.rmic.RMIC");
+	    Constructor cons = c.getConstructor(new Class[] { String[].class });
+	    Object rmic = cons.newInstance(new Object[] { cmd.getArguments() });
+	    Method doRmic = c.getMethod("run", null);
+	    String str[] = cmd.getArguments();
+	    Boolean ok = (Boolean)doRmic.invoke(rmic, null);
+	    return ok.booleanValue();
+	} catch (ClassNotFoundException ex) {
+	    throw new BuildException("Cannot use Kaffe rmic, as it is not available"+
+				     " A common solution is to set the environment variable"+
+				     " JAVA_HOME or CLASSPATH.", location );
+	}
+	catch (Exception ex) {
+	    if (ex instanceof BuildException) {
+                throw (BuildException) ex;
+	    } else {
+                throw new BuildException("Error starting Kaffe rmic: ", ex, location);
+	    }
+	}
+    }
+}
diff -urN orig/src/main/org/apache/tools/ant/taskdefs/rmic/KaffeRmic.java~ src/main/org/apache/tools/ant/taskdefs/rmic/KaffeRmic.java~
--- orig/src/main/org/apache/tools/ant/taskdefs/rmic/KaffeRmic.java~	Thu Jan  1 09:00:00 1970
+++ src/main/org/apache/tools/ant/taskdefs/rmic/KaffeRmic.java~	Sat Mar 10 23:54:06 2001
@@ -0,0 +1,119 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Apache Software Foundation.  All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ *    any, must include the following acknowlegement:
+ *       "This product includes software developed by the
+ *        Apache Software Foundation (http://www.apache.org/)."
+ *    Alternately, this acknowlegement may appear in the software itself,
+ *    if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Ant", and "Apache Software
+ *    Foundation" must not be used to endorse or promote products derived
+ *    from this software without prior written permission. For written
+ *    permission, please contact [email protected].
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ *    nor may "Apache" appear in their names without prior written
+ *    permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+package org.apache.tools.ant.taskdefs.rmic;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.LogOutputStream;
+import org.apache.tools.ant.types.Commandline;
+
+import java.io.*;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+
+/**
+ * The implementation of the javac compiler for JDK 1.2
+ * This is primarily a cut-and-paste from the original javac task before it
+ * was refactored.
+ *
+ * @author James Davidson <a href="mailto:[email protected]";>[email protected]</a>
+ * @author Robin Green <a href="mailto:[email protected]";>[email protected]</a>
+ * @author <a href="mailto:[email protected]";>Stefan Bodewig</a> 
+ * @author <a href="mailto:[email protected]";>J D Glanville</a>
+ */
+public class KaffeRmic extends DefaultRmicAdapter {
+
+    public boolean execute() throws BuildException {
+        attributes.log("Using classic compiler", Project.MSG_VERBOSE);
+        Commandline cmd = setupRmicCommand();
+
+        try {
+            // Create an instance of the compiler, redirecting output to
+            // the project log
+            OutputStream logstr = new LogOutputStream(attributes, Project.MSG_WARN);
+	    Class c = Class.forName("kaffe.rmi.rmic.RMIC");
+	    Constructor cons = c.getConstructor(new Class[] { String[].class });
+	    Object rmic = cons.newInstance(new Object[] { cmd.getArguments() });
+	    Method doRmic = c.getMethod("run", null);
+	    String str[] = cmd.getArguments();
+	    for(int zzz=0;zzz<str.length;zzz++){
+	      System.out.println(zzz+":"+str[zzz]);
+	    }
+	    Boolean ok = (Boolean)doRmic.invoke(rmic, null);
+	    /*
+	    if (null != sourceBase) {
+	      for (int j = 0; j < fileCount; j++) {
+                moveGeneratedFile(baseDir, sourceBase, (String) compileList.elementAt(j));
+	      }
+	    }
+	    compileList.removeAllElements();
+	    */
+	    System.out.println("result="+ok);
+	    return ok.booleanValue();
+	    
+	    } catch (ClassNotFoundException ex) {
+	      throw new BuildException("Cannot use classic compiler, as it is not available"+
+				       " A common solution is to set the environment variable"+
+				       " JAVA_HOME to your jdk directory.", location );
+	    }
+	    catch (Exception ex) {
+	      if (ex instanceof BuildException) {
+                throw (BuildException) ex;
+	      } else {
+                throw new BuildException("Error starting classic compiler: ", ex, location);
+	      }
+	    }
+    }
+}
diff -urN orig/src/main/org/apache/tools/ant/taskdefs/rmic/RmicAdapter.java src/main/org/apache/tools/ant/taskdefs/rmic/RmicAdapter.java
--- orig/src/main/org/apache/tools/ant/taskdefs/rmic/RmicAdapter.java	Thu Jan  1 09:00:00 1970
+++ src/main/org/apache/tools/ant/taskdefs/rmic/RmicAdapter.java	Sat Mar 10 23:54:06 2001
@@ -0,0 +1,87 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Apache Software Foundation.  All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ *    any, must include the following acknowlegement:
+ *       "This product includes software developed by the
+ *        Apache Software Foundation (http://www.apache.org/)."
+ *    Alternately, this acknowlegement may appear in the software itself,
+ *    if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Ant", and "Apache Software
+ *    Foundation" must not be used to endorse or promote products derived
+ *    from this software without prior written permission. For written
+ *    permission, please contact [email protected].
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ *    nor may "Apache" appear in their names without prior written
+ *    permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+package org.apache.tools.ant.taskdefs.rmic;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.taskdefs.Rmic;
+
+/**
+ * The interface that all rmic adapters must adher to.  
+ *
+ * <p>A rmic adapter is an adapter that interprets the rmic's
+ * parameters in preperation to be passed off to the compier this
+ * adapter represents.  As all the necessary values are stored in the
+ * Rmic task itself, the only thing all adapters need is the rmic
+ * task, the execute command and a parameterless constructor (for
+ * reflection).</p>
+ *
+ * @author Jay Dickon Glanville <a href="mailto:[email protected]";>[email protected]</a>
+ * @author Takashi Okamoto <[email protected]>
+ */
+
+public interface RmicAdapter {
+
+    /**
+     * Sets the rmic attributes, which are stored in the Rmic task.
+     */
+    public void setRmic( Rmic attributes );
+
+    /**
+     * Executes the task.
+     *
+     * @return has the compilation been successful
+     */
+    public boolean execute() throws BuildException;
+}
diff -urN orig/src/main/org/apache/tools/ant/taskdefs/rmic/RmicAdapter.java~ src/main/org/apache/tools/ant/taskdefs/rmic/RmicAdapter.java~
--- orig/src/main/org/apache/tools/ant/taskdefs/rmic/RmicAdapter.java~	Thu Jan  1 09:00:00 1970
+++ src/main/org/apache/tools/ant/taskdefs/rmic/RmicAdapter.java~	Sat Mar 10 23:54:06 2001
@@ -0,0 +1,87 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Apache Software Foundation.  All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ *    any, must include the following acknowlegement:
+ *       "This product includes software developed by the
+ *        Apache Software Foundation (http://www.apache.org/)."
+ *    Alternately, this acknowlegement may appear in the software itself,
+ *    if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Ant", and "Apache Software
+ *    Foundation" must not be used to endorse or promote products derived
+ *    from this software without prior written permission. For written
+ *    permission, please contact [email protected].
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ *    nor may "Apache" appear in their names without prior written
+ *    permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+package org.apache.tools.ant.taskdefs.rmic;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.taskdefs.Rmic;
+
+/**
+ * The interface that all rmic adapters must adher to.  
+ *
+ * <p>A rmic adapter is an adapter that interprets the rmic's
+ * parameters in preperation to be passed off to the compier this
+ * adapter represents.  As all the necessary values are stored in the
+ * Rmic task itself, the only thing all adapters need is the rmic
+ * task, the execute command and a parameterless constructor (for
+ * reflection).</p>
+ *
+ * @author Takashi Okamoto <a href="mailto:[email protected]";>[email protected]</a>
+ * @author Jay Dickon Glanville <a href="mailto:[email protected]";>[email protected]</a>
+ */
+
+public interface RmicAdapter {
+
+    /**
+     * Sets the rmic attributes, which are stored in the Rmic task.
+     */
+    public void setRmic( Rmic attributes );
+
+    /**
+     * Executes the task.
+     *
+     * @return has the compilation been successful
+     */
+    public boolean execute() throws BuildException;
+}
diff -urN orig/src/main/org/apache/tools/ant/taskdefs/rmic/RmicAdapterFactory.java src/main/org/apache/tools/ant/taskdefs/rmic/RmicAdapterFactory.java
--- orig/src/main/org/apache/tools/ant/taskdefs/rmic/RmicAdapterFactory.java	Thu Jan  1 09:00:00 1970
+++ src/main/org/apache/tools/ant/taskdefs/rmic/RmicAdapterFactory.java	Sat Mar 10 23:54:06 2001
@@ -0,0 +1,145 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Apache Software Foundation.  All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ *    any, must include the following acknowlegement:
+ *       "This product includes software developed by the
+ *        Apache Software Foundation (http://www.apache.org/)."
+ *    Alternately, this acknowlegement may appear in the software itself,
+ *    if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Ant", and "Apache Software
+ *    Foundation" must not be used to endorse or promote products derived
+ *    from this software without prior written permission. For written
+ *    permission, please contact [email protected].
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ *    nor may "Apache" appear in their names without prior written
+ *    permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+package org.apache.tools.ant.taskdefs.rmic;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.Project;
+
+/**
+ * Creates the necessary rmic adapter, given basic criteria.
+ *
+ * @author <a href="mailto:[email protected]";>J D Glanville</a>
+ * @author Takashi Okamoto <[email protected]>
+ */
+public class RmicAdapterFactory {
+
+    /** This is a singlton -- can't create instances!! */
+    private RmicAdapterFactory() {
+    }
+
+    /**
+     * Based on the parameter passed in, this method creates the necessary
+     * factory desired.
+     *
+     * The current mapping for rmic names are as follows:
+     * <ul><li>sun = SUN's rmic
+     * <li>kaffe = Kaffe's rmic
+     * <li><i>a fully quallified classname</i> = the name of a rmic
+     * adapter
+     * </ul>
+     *
+     * @param rmicType either the name of the desired rmic, or the
+     * full classname of the rmic's adapter.
+     * @param task a task to log through.
+     * @throws BuildException if the rmic type could not be resolved into
+     * a rmic adapter.
+     */
+    public static RmicAdapter getRmic( String rmicType, Task task ) 
+        throws BuildException {
+	if( rmicType == null){
+	    /* When not specified rmicType ,search SUN's rmic and
+	    /* Kaffe's rmic.
+	    */
+	    try {
+		Class.forName("sun.rmi.rmic.Main");
+		rmicType = "sun";
+	    } catch (ClassNotFoundException cnfe) {
+		try {
+		    Class.forName("kaffe.rmi.rmic.RMIC");
+		    Class.forName("kaffe.tools.compiler.Compiler");
+		    rmicType = "kaffe";
+		} catch (ClassNotFoundException cnfk) {
+		    // swallow as we've hit the max class version that
+		    // we have
+		    cnfk.printStackTrace();
+		}
+	    }
+	}
+
+	if ( rmicType.equalsIgnoreCase("sun") ) {
+	    return new SunRmic();
+	} if ( rmicType.equalsIgnoreCase("kaffe") ) {
+	    return new KaffeRmic();
+	}
+	return resolveClassName( rmicType );
+    }
+
+    /**
+     * Tries to resolve the given classname into a rmic adapter.
+     * Throws a fit if it can't.
+     *
+     * @param className The fully qualified classname to be created.
+     * @throws BuildException This is the fit that is thrown if className
+     * isn't an instance of RmicAdapter.
+     */
+    private static RmicAdapter resolveClassName( String className )
+        throws BuildException {
+        try {
+            Class c = Class.forName( className );
+            Object o = c.newInstance();
+            return (RmicAdapter) o;
+        } catch ( ClassNotFoundException cnfe ) {
+            throw new BuildException( className + " can\'t be found.", cnfe );
+        } catch ( ClassCastException cce ) {
+            throw new BuildException(className + " isn\'t the classname of "
+				     + "a rmic adapter.", cce);
+        } catch ( Throwable t ) {
+            // for all other possibilities
+            throw new BuildException(className + " caused an interesting "
+				     + "exception.", t);
+        }
+    }
+}
diff -urN orig/src/main/org/apache/tools/ant/taskdefs/rmic/RmicAdapterFactory.java~ src/main/org/apache/tools/ant/taskdefs/rmic/RmicAdapterFactory.java~
--- orig/src/main/org/apache/tools/ant/taskdefs/rmic/RmicAdapterFactory.java~	Thu Jan  1 09:00:00 1970
+++ src/main/org/apache/tools/ant/taskdefs/rmic/RmicAdapterFactory.java~	Sat Mar 10 23:54:06 2001
@@ -0,0 +1,147 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Apache Software Foundation.  All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ *    any, must include the following acknowlegement:
+ *       "This product includes software developed by the
+ *        Apache Software Foundation (http://www.apache.org/)."
+ *    Alternately, this acknowlegement may appear in the software itself,
+ *    if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Ant", and "Apache Software
+ *    Foundation" must not be used to endorse or promote products derived
+ *    from this software without prior written permission. For written
+ *    permission, please contact [email protected].
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ *    nor may "Apache" appear in their names without prior written
+ *    permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+package org.apache.tools.ant.taskdefs.rmic;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.Project;
+
+/**
+ * Creates the necessary rmic adapter, given basic criteria.
+ *
+ * @author Takashi Okamoto [email protected]
+ * @author <a href="mailto:[email protected]";>J D Glanville</a>
+ */
+public class RmicAdapterFactory {
+
+    /** This is a singlton -- can't create instances!! */
+    private RmicAdapterFactory() {
+    }
+
+    /**
+     * Based on the parameter passed in, this method creates the necessary
+     * factory desired.
+     *
+     * The current mapping for rmic names are as follows:
+     * <ul><li>sun = SUN's rmic
+     * <li>kaffe = Kaffe's rmic
+     * <li><i>a fully quallified classname</i> = the name of a rmic
+     * adapter
+     * </ul>
+     *
+     * @param rmicType either the name of the desired rmic, or the
+     * full classname of the rmic's adapter.
+     * @param task a task to log through.
+     * @throws BuildException if the rmic type could not be resolved into
+     * a rmic adapter.
+     */
+    public static RmicAdapter getRmic( String rmicType, Task task ) 
+        throws BuildException {
+            /* If I've done things right, this should be the extent of the
+             * conditional statements required.
+             */
+      if( rmicType == null){
+        try {
+	  Class.forName("sun.rmi.rmic.Main");
+	  rmicType = "sun";
+        } catch (ClassNotFoundException cnfe) {
+	  try {
+	    Class.forName("kaffe.rmi.rmic.RMIC");
+	    System.out.println("pass kaffe rmic");
+	    Class.forName("kaffe.tools.compiler.Compiler");
+	    System.out.println("pass compiler");
+	    rmicType = "kaffe";
+	  } catch (ClassNotFoundException cnfk) {
+	    // swallow as we've hit the max class version that
+	    // we have
+	    cnfk.printStackTrace();
+	  }
+        }
+      }
+            if ( rmicType.equalsIgnoreCase("sun") ) {
+                return new SunRmic();
+            } if ( rmicType.equalsIgnoreCase("kaffe") ) {
+                return new KaffeRmic();
+	    }
+            return resolveClassName( rmicType );
+        }
+
+    /**
+     * Tries to resolve the given classname into a rmic adapter.
+     * Throws a fit if it can't.
+     *
+     * @param className The fully qualified classname to be created.
+     * @throws BuildException This is the fit that is thrown if className
+     * isn't an instance of RmicAdapter.
+     */
+    private static RmicAdapter resolveClassName( String className )
+        throws BuildException {
+        try {
+            Class c = Class.forName( className );
+            Object o = c.newInstance();
+            return (RmicAdapter) o;
+        } catch ( ClassNotFoundException cnfe ) {
+            throw new BuildException( className + " can\'t be found.", cnfe );
+        } catch ( ClassCastException cce ) {
+            throw new BuildException(className + " isn\'t the classname of "
+                    + "a rmic adapter.", cce);
+        } catch ( Throwable t ) {
+            // for all other possibilities
+            throw new BuildException(className + " caused an interesting "
+                    + "exception.", t);
+        }
+    }
+
+}
diff -urN orig/src/main/org/apache/tools/ant/taskdefs/rmic/SunRmic.java src/main/org/apache/tools/ant/taskdefs/rmic/SunRmic.java
--- orig/src/main/org/apache/tools/ant/taskdefs/rmic/SunRmic.java	Thu Jan  1 09:00:00 1970
+++ src/main/org/apache/tools/ant/taskdefs/rmic/SunRmic.java	Sat Mar 10 23:54:06 2001
@@ -0,0 +1,103 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Apache Software Foundation.  All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ *    any, must include the following acknowlegement:
+ *       "This product includes software developed by the
+ *        Apache Software Foundation (http://www.apache.org/)."
+ *    Alternately, this acknowlegement may appear in the software itself,
+ *    if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Ant", and "Apache Software
+ *    Foundation" must not be used to endorse or promote products derived
+ *    from this software without prior written permission. For written
+ *    permission, please contact [email protected].
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ *    nor may "Apache" appear in their names without prior written
+ *    permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+package org.apache.tools.ant.taskdefs.rmic;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.LogOutputStream;
+import org.apache.tools.ant.types.Commandline;
+
+import java.io.*;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+
+/**
+ * The implementation of the rmic for SUN's JDK.
+ *
+ * @author Takashi Okamoto <[email protected]>
+ */
+public class SunRmic extends DefaultRmicAdapter {
+
+    public boolean execute() throws BuildException {
+        attributes.log("Using SUN rmic compiler", Project.MSG_VERBOSE);
+        Commandline cmd = setupRmicCommand();
+
+        try {
+            // Create an instance of the rmic, redirecting output to
+            // the project log
+            OutputStream logstr = new LogOutputStream(attributes, Project.MSG_WARN);
+	    Class c = Class.forName("sun.rmi.rmic.Main");
+	    Constructor cons = c.getConstructor(new Class[] 
+		{ OutputStream.class, String.class });
+	    Object rmic = cons.newInstance(new Object[] { logstr, "rmic" });
+	    Method doRmic = c.getMethod("compile", 
+					new Class [] { String[].class });
+	    Boolean ok = (Boolean)doRmic.invoke(rmic, 
+						(new Object[] {cmd.getArguments()} ));
+	    return ok.booleanValue();
+	} catch (ClassNotFoundException ex) {
+	    throw new BuildException("Cannot use SUN rmic, as it is not available"+
+				     " A common solution is to set the environment variable"+
+				     " JAVA_HOME or CLASSPATH.", location );
+	}
+	catch (Exception ex) {
+	    if (ex instanceof BuildException) {
+                throw (BuildException) ex;
+	    } else {
+                throw new BuildException("Error starting SUN rmic: ", ex, location);
+	    }
+	}
+    }
+}
diff -urN orig/src/main/org/apache/tools/ant/taskdefs/rmic/SunRmic.java~ src/main/org/apache/tools/ant/taskdefs/rmic/SunRmic.java~
--- orig/src/main/org/apache/tools/ant/taskdefs/rmic/SunRmic.java~	Thu Jan  1 09:00:00 1970
+++ src/main/org/apache/tools/ant/taskdefs/rmic/SunRmic.java~	Sat Mar 10 23:54:06 2001
@@ -0,0 +1,108 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Apache Software Foundation.  All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ *    any, must include the following acknowlegement:
+ *       "This product includes software developed by the
+ *        Apache Software Foundation (http://www.apache.org/)."
+ *    Alternately, this acknowlegement may appear in the software itself,
+ *    if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Ant", and "Apache Software
+ *    Foundation" must not be used to endorse or promote products derived
+ *    from this software without prior written permission. For written
+ *    permission, please contact [email protected].
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ *    nor may "Apache" appear in their names without prior written
+ *    permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+package org.apache.tools.ant.taskdefs.rmic;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.LogOutputStream;
+import org.apache.tools.ant.types.Commandline;
+
+import java.io.*;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+
+/**
+ * The implementation of the javac compiler for JDK 1.2
+ * This is primarily a cut-and-paste from the original javac task before it
+ * was refactored.
+ *
+ * @author James Davidson <a href="mailto:[email protected]";>[email protected]</a>
+ * @author Robin Green <a href="mailto:[email protected]";>[email protected]</a>
+ * @author <a href="mailto:[email protected]";>Stefan Bodewig</a> 
+ * @author <a href="mailto:[email protected]";>J D Glanville</a>
+ */
+public class SunRmic extends DefaultRmicAdapter {
+
+    public boolean execute() throws BuildException {
+        attributes.log("Using classic compiler", Project.MSG_VERBOSE);
+        Commandline cmd = setupRmicCommand();
+
+        try {
+            // Create an instance of the compiler, redirecting output to
+            // the project log
+            OutputStream logstr = new LogOutputStream(attributes, Project.MSG_WARN);
+	    Class c = Class.forName("sun.rmi.rmic.Main");
+	    Constructor cons = c.getConstructor(new Class[] 
+	      { OutputStream.class, String.class });
+	    Object rmic = cons.newInstance(new Object[] { logstr, "rmic" });
+	    Method doRmic = c.getMethod("compile", new Class [] 
+	      { String[].class });
+	    Boolean ok = (Boolean)doRmic.invoke(rmic, (new Object[] {cmd.getArguments()} ));
+	    return ok.booleanValue();
+	    
+	    } catch (ClassNotFoundException ex) {
+	      throw new BuildException("Cannot use classic compiler, as it is not available"+
+				       " A common solution is to set the environment variable"+
+				       " JAVA_HOME to your jdk directory.", location );
+	    }
+	    catch (Exception ex) {
+	      if (ex instanceof BuildException) {
+                throw (BuildException) ex;
+	      } else {
+                throw new BuildException("Error starting classic compiler: ", ex, location);
+	      }
+	    }
+    }
+}

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to