Examples of LogOutputStream


Examples of org.apache.tools.ant.taskdefs.LogOutputStream

     *
     * @return default output stream for a formatter
     * @since Ant 1.3
     */
    protected OutputStream getDefaultOutput() {
        return new LogOutputStream(this, Project.MSG_INFO);
    }
View Full Code Here

Examples of org.apache.tools.ant.taskdefs.LogOutputStream

            tmp2 = new File("pvcs_ant_" + rand.nextLong() + ".log");
            log(commandLine.describeCommand(), Project.MSG_VERBOSE);
            try {
                result = runCmd(commandLine,
                                new PumpStreamHandler(fos,
                                    new LogOutputStream(this,
                                                        Project.MSG_WARN)));
            } finally {
                FileUtils.close(fos);
            }
View Full Code Here

Examples of org.apache.tools.ant.taskdefs.LogOutputStream

    public boolean execute() throws BuildException {
        attributes.log("Using classic compiler", Project.MSG_VERBOSE);
        Commandline cmd = setupJavacCommand();

        OutputStream logstr = new LogOutputStream(attributes, Project.MSG_WARN);
        try {
            // Create an instance of the compiler, redirecting output to
            // the project log
            Class c = Class.forName("sun.tools.javac.Main");
            Constructor cons = c.getConstructor(new Class[] { OutputStream.class, String.class });
            Object compiler = cons.newInstance(new Object[] { logstr, "javac" });

            // Call the compile() method
            Method compile = c.getMethod("compile", new Class [] { String[].class });
            Boolean ok = (Boolean)compile.invoke(compiler, 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);
            }
        } finally {
            try {
                logstr.close();
            } catch (IOException e) {
                // plain impossible
                throw new BuildException(e);
            }
        }
View Full Code Here

Examples of org.apache.tools.ant.taskdefs.LogOutputStream

        getRmic().log("Using SUN rmic compiler", Project.MSG_VERBOSE);
        Commandline cmd = setupRmicCommand();

        // Create an instance of the rmic, redirecting output to
        // the project log
        LogOutputStream logstr = new LogOutputStream(getRmic(), Project.MSG_WARN);

        try {
            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.", getRmic().getLocation() );
        }
        catch (Exception ex) {
            if (ex instanceof BuildException) {
                throw (BuildException) ex;
            } else {
                throw new BuildException("Error starting SUN rmic: ", ex, getRmic().getLocation());
            }
        } finally {
            try {
                logstr.close();
            } catch (IOException e) {
                throw new BuildException(e);
            }
        }
    }
View Full Code Here

Examples of org.apache.tools.ant.taskdefs.LogOutputStream

 
//  protected Thread inputThread = null;
 
  public TaskExecuteStreamHandler(Task task, int outlevel, int errlevel, String script)
  {
    super(new LogOutputStream(task, outlevel),
        new LogOutputStream(task, errlevel));
    this.script = script;
  }
View Full Code Here

Examples of org.apache.tools.ant.taskdefs.LogOutputStream

    /**
     * Get the default output for a formatter.
     */
    protected OutputStream getDefaultOutput(){
        return new LogOutputStream(this, Project.MSG_INFO);
    }
View Full Code Here

Examples of org.apache.tools.ant.taskdefs.LogOutputStream

        try {
            Random rand = new Random(System.currentTimeMillis());
            tmp = new File("pvcs_ant_"+rand.nextLong()+".log");
            tmp2 = new File("pvcs_ant_"+rand.nextLong()+".log");
            log("Executing " + commandLine.toString(), Project.MSG_VERBOSE);
            result = runCmd(commandLine, new PumpStreamHandler(new FileOutputStream(tmp), new LogOutputStream(this,Project.MSG_WARN)));
            if ( result != 0 && !ignorerc) {
                String msg = "Failed executing: " + commandLine.toString();
                throw new BuildException(msg, location);
            }
View Full Code Here

Examples of org.apache.tools.ant.taskdefs.LogOutputStream

     *
     * @return default output stream for a formatter
     * @since Ant 1.3
     */
    protected OutputStream getDefaultOutput() {
        return new LogOutputStream(this, Project.MSG_INFO);
    }
View Full Code Here

Examples of org.apache.tools.ant.taskdefs.LogOutputStream

        private AuditListener createDefaultLogger(Task aTask)
            throws IOException
        {
            if ((mToFile == null) || !mUseFile) {
                return new DefaultLogger(
                    new LogOutputStream(aTask, Project.MSG_DEBUG),
                    true, new LogOutputStream(aTask, Project.MSG_ERR), true);
            }
            return new DefaultLogger(new FileOutputStream(mToFile), true);
        }
View Full Code Here

Examples of org.apache.tools.ant.taskdefs.LogOutputStream

         * @throws IOException if an error occurs
         */
        private AuditListener createXMLLogger(Task aTask) throws IOException
        {
            if ((mToFile == null) || !mUseFile) {
                return new XMLLogger(new LogOutputStream(aTask,
                        Project.MSG_INFO), true);
            }
            return new XMLLogger(new FileOutputStream(mToFile), true);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.