axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ru...@apache.org
Subject cvs commit: xml-axis/java/src/org/apache/axis/utils/compiler AbstractCompiler.java Compiler.java CompilerError.java CompilerFactory.java Javac.java Jikes.java
Date Wed, 12 Dec 2001 19:36:23 GMT
rubys       01/12/12 11:36:23

  Modified:    java/src/org/apache/axis/handlers Tag: alpha-3
                        JWSProcessor.java
  Added:       java/src/org/apache/axis/utils/compiler Tag: alpha-3
                        AbstractCompiler.java Compiler.java
                        CompilerError.java CompilerFactory.java Javac.java
                        Jikes.java
  Log:
  Backport the pluggable compiler into alpha3
  Submitted by:	dims
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.30.2.1  +33 -28    xml-axis/java/src/org/apache/axis/handlers/JWSProcessor.java
  
  Index: JWSProcessor.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/handlers/JWSProcessor.java,v
  retrieving revision 1.30
  retrieving revision 1.30.2.1
  diff -u -r1.30 -r1.30.2.1
  --- JWSProcessor.java	2001/12/03 22:49:23	1.30
  +++ JWSProcessor.java	2001/12/12 19:36:22	1.30.2.1
  @@ -63,20 +63,22 @@
   import org.apache.axis.utils.AxisClassLoader;
   import org.apache.axis.utils.JavaUtils;
   import org.apache.axis.utils.XMLUtils;
  +import org.apache.axis.utils.compiler.Compiler;
  +import org.apache.axis.utils.compiler.CompilerError;
  +import org.apache.axis.utils.compiler.CompilerFactory;
   import org.apache.log4j.Category;
   import org.w3c.dom.Document;
   import org.w3c.dom.Element;
  -import sun.tools.javac.Main;
   
   import java.io.File;
   import java.io.FileInputStream;
  -import java.io.FileOutputStream;
   import java.io.FileReader;
   import java.io.FileWriter;
   import java.io.IOException;
   import java.io.InputStream;
   import java.net.URL;
   import java.net.URLClassLoader;
  +import java.util.List;
   import java.util.StringTokenizer;
   import java.util.jar.Attributes;
   import java.util.jar.JarFile;
  @@ -96,7 +98,6 @@
    */
   public class JWSProcessor extends BasicHandler
   {
  -    static String errFile = "jws.err" ;
       static Category category =
               Category.getInstance(JWSProcessor.class.getName());
   
  @@ -169,8 +170,7 @@
                   category.debug("javac " + jFile );
                   // Process proc = rt.exec( "javac " + jFile );
                   // proc.waitFor();
  -                FileOutputStream  out      = new FileOutputStream( errFile );
  -                Main              compiler = new Main( out, "javac" );
  +                Compiler          compiler = CompilerFactory.getCompiler();
                   String            outdir   = null ;
                   String[]          args     = null ;
   
  @@ -178,13 +178,12 @@
                   if ( outdir == null ) outdir = f1.getParent();
                   if ( outdir == null ) outdir = "." ;
   
  -                args = new String[] { "-d", outdir,
  -                          "-classpath",
  -                          getDefaultClasspath(msgContext),
  -                          jFile };
  +                compiler.setClasspath(getDefaultClasspath(msgContext));
  +                compiler.setDestination(outdir);
  +                compiler.setFile(jFile);
   
  -                boolean           result   = compiler.compile( args );
  -
  +                boolean result   = compiler.compile();
  +                
                   /* Delete the temporary *.java file and check return code */
                   /**********************************************************/
                   (new File(jFile)).delete();
  @@ -199,22 +198,27 @@
                       Document doc = XMLUtils.newDocument();
   
                       Element         root = doc.createElementNS("", "Errors");
  -                    StringBuffer    sbuf = new StringBuffer();
  -                    FileReader      inp  = new FileReader( errFile );
  -
  -                    buf = new char[4096];
  -
  -                    while ( (rc = inp.read(buf, 0, 4096)) > 0 )
  -                        sbuf.append( buf, 0, rc );
  -                    inp.close();
  -                    root.appendChild( doc.createTextNode( sbuf.toString() ) );
  -                    (new File(errFile)).delete();
  +                    StringBuffer message = new StringBuffer("Error compiling ");
  +                    message.append(jFile);
  +                    message.append(":\n");
  +
  +                    List errors = compiler.getErrors();
  +                    int count = errors.size();
  +                    for (int i = 0; i < count; i++) {
  +                      CompilerError error = (CompilerError) errors.get(i);
  +                      if (i > 0) message.append("\n");
  +                      message.append("Line ");
  +                      message.append(error.getStartLine());
  +                      message.append(", column ");
  +                      message.append(error.getStartColumn());
  +                      message.append(": ");
  +                      message.append(error.getMessage());
  +                    }
  +                    root.appendChild( doc.createTextNode( message.toString() ) );
                       throw new AxisFault( "Server.compileError",
                            JavaUtils.getMessage("badCompile00", jFile),
                           null, new Element[] { root } );
                   }
  -                (new File(errFile)).delete();
  -
                   AxisClassLoader.removeClassLoader( clsName );
               }
               AxisClassLoader cl = msgContext.getClassLoader();
  @@ -276,10 +280,13 @@
   
                   for(int i=0; (urls != null) && i < urls.length; i++)
                   {
  -                    classpath.append(urls[i].getPath());
  +                    String path = urls[i].getPath();
  +                    //If it is a drive letter, adjust accordingly.
  +                    if(path.charAt(0)=='/'&&path.charAt(2)==':')
  +                        path = path.substring(1);
  +                    classpath.append(path);
                       classpath.append(File.pathSeparatorChar);
   
  -
                       // if its a jar extract Class-Path entries from manifest
                       File file = new File(urls[i].getFile());
                       if(file.isFile())
  @@ -361,10 +368,8 @@
               }
           }
   
  -
           // boot classpath isn't found in above search
  -        if(System.getProperty("sun.boot.class.path") != null)
  -        {
  +        if(System.getProperty("sun.boot.class.path") != null) {
               classpath.append(System.getProperty("sun.boot.class.path"));
           }
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +1 -1      xml-axis/java/src/org/apache/axis/utils/compiler/AbstractCompiler.java
  
  Index: AbstractCompiler.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/compiler/AbstractCompiler.java,v
  retrieving revision 1.1
  retrieving revision 1.1.2.1
  diff -u -r1.1 -r1.1.2.1
  --- AbstractCompiler.java	2001/12/10 22:25:53	1.1
  +++ AbstractCompiler.java	2001/12/12 19:36:22	1.1.2.1
  @@ -65,7 +65,7 @@
    * This class implements the functionality common to all Java compilers.
    * @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version $Revision: 1.1 $ $Date: 2001/12/10 22:25:53 $
  + * @version $Revision: 1.1.2.1 $ $Date: 2001/12/12 19:36:22 $
    * @since 2.0
    */
   public abstract class AbstractCompiler implements Compiler {
  
  
  
  1.1.2.1   +1 -1      xml-axis/java/src/org/apache/axis/utils/compiler/Compiler.java
  
  Index: Compiler.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/compiler/Compiler.java,v
  retrieving revision 1.1
  retrieving revision 1.1.2.1
  diff -u -r1.1 -r1.1.2.1
  --- Compiler.java	2001/12/10 22:25:53	1.1
  +++ Compiler.java	2001/12/12 19:36:22	1.1.2.1
  @@ -63,7 +63,7 @@
    * (Java-based) compiled languages
    * @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version $Revision: 1.1 $ $Date: 2001/12/10 22:25:53 $
  + * @version $Revision: 1.1.2.1 $ $Date: 2001/12/12 19:36:22 $
    * @since 2.0
    */
   public interface Compiler {
  
  
  
  1.1.2.1   +1 -1      xml-axis/java/src/org/apache/axis/utils/compiler/CompilerError.java
  
  Index: CompilerError.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/compiler/CompilerError.java,v
  retrieving revision 1.1
  retrieving revision 1.1.2.1
  diff -u -r1.1 -r1.1.2.1
  --- CompilerError.java	2001/12/10 22:25:53	1.1
  +++ CompilerError.java	2001/12/12 19:36:22	1.1.2.1
  @@ -60,7 +60,7 @@
    * processor (whether interpreted or compiled)
    * @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version $Revision: 1.1 $ $Date: 2001/12/10 22:25:53 $
  + * @version $Revision: 1.1.2.1 $ $Date: 2001/12/12 19:36:22 $
    * @since 2.0
    */
   
  
  
  
  1.2.2.1   +1 -1      xml-axis/java/src/org/apache/axis/utils/compiler/CompilerFactory.java
  
  Index: CompilerFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/compiler/CompilerFactory.java,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- CompilerFactory.java	2001/12/11 13:16:38	1.2
  +++ CompilerFactory.java	2001/12/12 19:36:22	1.2.2.1
  @@ -61,7 +61,7 @@
    * This class implements a factory to instantiate a Compiler.
    * @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version $Revision: 1.2 $ $Date: 2001/12/11 13:16:38 $
  + * @version $Revision: 1.2.2.1 $ $Date: 2001/12/12 19:36:22 $
    * @since 2.0
    */
   public class CompilerFactory {
  
  
  
  1.2.2.1   +1 -1      xml-axis/java/src/org/apache/axis/utils/compiler/Javac.java
  
  Index: Javac.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/compiler/Javac.java,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- Javac.java	2001/12/11 13:16:38	1.2
  +++ Javac.java	2001/12/12 19:36:22	1.2.2.1
  @@ -73,7 +73,7 @@
    *
    * @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version $Revision: 1.2 $ $Date: 2001/12/11 13:16:38 $
  + * @version $Revision: 1.2.2.1 $ $Date: 2001/12/12 19:36:22 $
    * @since 2.0
    */
   
  
  
  
  1.2.2.1   +1 -1      xml-axis/java/src/org/apache/axis/utils/compiler/Jikes.java
  
  Index: Jikes.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/compiler/Jikes.java,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- Jikes.java	2001/12/11 13:16:38	1.2
  +++ Jikes.java	2001/12/12 19:36:23	1.2.2.1
  @@ -72,7 +72,7 @@
    * NOTE: inspired by the Apache Jasper implementation.
    * @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version $Revision: 1.2 $ $Date: 2001/12/11 13:16:38 $
  + * @version $Revision: 1.2.2.1 $ $Date: 2001/12/12 19:36:23 $
    * @since 2.0
    */
   
  
  
  

Mime
View raw message