bodewig     2005/03/10 00:19:58

  Modified:    src/main/org/apache/tools/ant/taskdefs/rmic Tag:
                        ANT_16_BRANCH KaffeRmic.java
  Log:
  merge
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.11.2.7  +24 -17    
ant/src/main/org/apache/tools/ant/taskdefs/rmic/KaffeRmic.java
  
  Index: KaffeRmic.java
  ===================================================================
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/rmic/KaffeRmic.java,v
  retrieving revision 1.11.2.6
  retrieving revision 1.11.2.7
  diff -u -r1.11.2.6 -r1.11.2.7
  --- KaffeRmic.java    4 Feb 2005 08:13:47 -0000       1.11.2.6
  +++ KaffeRmic.java    10 Mar 2005 08:19:58 -0000      1.11.2.7
  @@ -28,9 +28,14 @@
    * @since Ant 1.4
    */
   public class KaffeRmic extends DefaultRmicAdapter {
  -    public static final String RMIC_CLASSNAME = "gnu.java.rmi.rmic.RMIC";
  -    // pre Kaffe 1.1.2
  -    private static final String OLD_RMIC_CLASSNAME = "kaffe.rmi.rmic.RMIC";
  +    // sorted by newest Kaffe version first
  +    private static final String[] RMIC_CLASSNAMES = new String[] {
  +        "gnu.classpath.tools.rmi.rmic.RMIC",
  +        // pre Kaffe 1.1.5
  +        "gnu.java.rmi.rmic.RMIC",
  +        // pre Kaffe 1.1.2
  +        "kaffe.rmi.rmic.RMIC",
  +    };
   
       /**
        * the name of this adapter for users to select
  @@ -44,15 +49,19 @@
   
           Class c = getRmicClass();
           if (c == null) {
  -            throw new BuildException("Cannot use Kaffe rmic, as it is not "
  -                                     + "available.  Neither "
  -                                     + RMIC_CLASSNAME
  -                                     + " nor "
  -                                     + OLD_RMIC_CLASSNAME
  -                                     + " have been found.  "
  -                                     + "A common solution is to "
  -                                     + "set the environment variable "
  -                                     + "JAVA_HOME or CLASSPATH.",
  +            StringBuffer buf = new StringBuffer("Cannot use Kaffe rmic, as 
it"
  +                                                + " is not available.  None"
  +                                                + " of ");
  +            for (int i = 0; i < RMIC_CLASSNAMES.length; i++) {
  +                if (i != 0) {
  +                    buf.append(", ");
  +                }
  +                
  +                buf.append(RMIC_CLASSNAMES[i]);
  +            }
  +            buf.append(" have been found. A common solution is to set the"
  +                       + " environment variable JAVA_HOME or CLASSPATH.");
  +            throw new BuildException(buf.toString(),
                                        getRmic().getLocation());
           }
   
  @@ -77,12 +86,10 @@
        * @return null if neither class can get loaded.
        */
       private static Class getRmicClass() {
  -        try {
  -            return Class.forName(RMIC_CLASSNAME);
  -        } catch (ClassNotFoundException cnfe) {
  +        for (int i = 0; i < RMIC_CLASSNAMES.length; i++) {
               try {
  -                return Class.forName(OLD_RMIC_CLASSNAME);
  -            } catch (ClassNotFoundException cnfe2) {
  +                return Class.forName(RMIC_CLASSNAMES[i]);
  +            } catch (ClassNotFoundException cnfe) {
               }
           }
           return null;
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to