You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ne...@apache.org on 2003/01/20 23:15:00 UTC
cvs commit: xml-xerces/java/tools/src XJavac.java
neilg 2003/01/20 14:15:00
Modified: java/tools/bin xjavac.jar
java/tools/src XJavac.java
Log:
re-enable successful builds on SUN 1.4.x platforms. This requires making sure our APIs are prepended to the bootclasspath, since the Sun JDKs contain a slightly different version of the HTML DOM than we do.
Revision Changes Path
1.2 +6 -27 xml-xerces/java/tools/bin/xjavac.jar
<<Binary file>>
1.2 +20 -27 xml-xerces/java/tools/src/XJavac.java
Index: XJavac.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/tools/src/XJavac.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XJavac.java 27 Sep 2002 22:31:04 -0000 1.1
+++ XJavac.java 20 Jan 2003 22:15:00 -0000 1.2
@@ -56,17 +56,13 @@
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
-import org.apache.tools.ant.taskdefs.PumpStreamHandler;
-import org.apache.tools.ant.taskdefs.Execute;
-import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.util.JavaEnvUtils;
import org.apache.tools.ant.taskdefs.Javac;
-import java.io.OutputStream;
-import java.io.IOException;
-import java.io.ByteArrayOutputStream;
import java.lang.StringBuffer;
+import java.util.Properties;
+import java.util.Locale;
/**
* The implementation of the javac compiler for IBM JDK 1.4
@@ -90,29 +86,16 @@
public void execute() throws BuildException {
if(JavaEnvUtils.getJavaVersion().equals(JavaEnvUtils.JAVA_1_4)) {
// maybe the right one; check vendor:
- // by running "java -version" in the shell:
- ByteArrayOutputStream bOut = new ByteArrayOutputStream();
- ByteArrayOutputStream bErr = new ByteArrayOutputStream();
- PumpStreamHandler pH = new PumpStreamHandler(bOut, bErr);
- Execute exe = new Execute(pH);
- String javaExecutablePath = JavaEnvUtils.getJreExecutable("java");
- String versionOption = "-version";
- exe.setCommandline(new String[] {javaExecutablePath, versionOption});
- exe.setVMLauncher(false);
+ // by checking system properties:
+ Properties props = null;
try {
- if(exe.execute() != 0) {
- throw new BuildException("unable to determine java version!");
- }
- } catch (IOException e) {
- throw new BuildException("Something went wrong while invoking java while " +
- "attempting to determine its version; error: " + e.getMessage());
+ props = System.getProperties();
+ } catch (Exception e) {
+ throw new BuildException("unable to determine java vendor because could not access system properties!");
}
- // safe to say the version string will be in the platform's
- // default encoding. Try both stdout and stderr to be safe:
- String bOutStr = bOut.toString();
- String bErrStr = bErr.toString();
- if(bErrStr.indexOf("IBM") > -1 ||
- bOutStr.indexOf("IBM") > -1) {
+ // this is supposed to be provided by all JVM's from time immemorial
+ String vendor = ((String)props.get("java.vendor")).toUpperCase(Locale.ENGLISH);
+ if(vendor.indexOf("IBM") >= 0){
// we're on an IBM 1.4; fiddle with the bootclasspath.
Path bcp = createBootclasspath();
String javaHome = System.getProperty("java.home");
@@ -145,6 +128,16 @@
bcp.createPathElement().setPath(bcpMember.toString());
bcpMember.replace(javaHome.length(), bcpMember.length(), "/lib/ext/oldcertpath.jar");
bcp.createPathElement().setPath(bcpMember.toString());
+ setBootclasspath(bcp);
+ }
+ // need to do special things for Sun too...
+ else if(vendor.indexOf("SUN") >= 0){
+ // we're on an SUN 1.4; fiddle with the bootclasspath.
+ Path bcp = createBootclasspath();
+ String bcpMember = "./tools/xml-apis.jar";
+ bcp.createPathElement().setPath(bcpMember);
+ String currBCP = (String)props.get("sun.boot.class.path");
+ bcp.createPathElement().setPath(currBCP);
setBootclasspath(bcp);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org