You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bo...@apache.org on 2005/03/10 09:17:55 UTC
cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/rmic KaffeRmic.java
bodewig 2005/03/10 00:17:55
Modified: src/main/org/apache/tools/ant/taskdefs/rmic KaffeRmic.java
Log:
Kaffe keeps moving things, adapt
Revision Changes Path
1.25 +26 -18 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.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- KaffeRmic.java 2 Feb 2005 13:01:52 -0000 1.24
+++ KaffeRmic.java 10 Mar 2005 08:17:55 -0000 1.25
@@ -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,20 +49,25 @@
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());
}
cmd.setExecutable(c.getName());
- if (c.getName().equals(RMIC_CLASSNAME)) {
+ if (!c.getName().equals(RMIC_CLASSNAMES[RMIC_CLASSNAMES.length - 1])) {
+ // only supported since Kaffe 1.1.2
cmd.createArgument().setValue("-verbose");
getRmic().log(Commandline.describeCommand(cmd));
}
@@ -81,12 +91,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: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org