Return-Path: Delivered-To: apmail-ant-user-archive@www.apache.org Received: (qmail 57920 invoked from network); 14 Sep 2007 14:21:29 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 14 Sep 2007 14:21:29 -0000 Received: (qmail 89210 invoked by uid 500); 14 Sep 2007 14:21:17 -0000 Delivered-To: apmail-ant-user-archive@ant.apache.org Received: (qmail 89174 invoked by uid 500); 14 Sep 2007 14:21:17 -0000 Mailing-List: contact user-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Users List" Reply-To: "Ant Users List" Delivered-To: mailing list user@ant.apache.org Received: (qmail 89163 invoked by uid 99); 14 Sep 2007 14:21:17 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 Sep 2007 07:21:17 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of alexey.melnikoff@gmail.com designates 64.233.166.180 as permitted sender) Received: from [64.233.166.180] (HELO py-out-1112.google.com) (64.233.166.180) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 Sep 2007 14:21:15 +0000 Received: by py-out-1112.google.com with SMTP id a73so1880299pye for ; Fri, 14 Sep 2007 07:20:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=b4ieKS5vr8iozIBZQLgnk29sAheF+T0mjnQgsgiA9qY=; b=bCNtRenElgTB8djZ/1IlfukDy2azhDD2X0as2p0rJ/dplNTJz6mGccbDvHeMsIJLjufjywn0VwSiG9PXBtXaayL3L/m8mNcZ1p66W4J5iyM/APtCzhsQFr74xjco9LgzT7MFkjrGtMFDRsfnDAIPhoUZ0h6INDCmO1zs/eYQQC0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=hTjsCkJtAOXvJxLxt8R26FiV5QnhmKnw2lenpp6w7254YUozyeW9UaR0KJI8BmiEP7Ea4k2wV+Aa23gyMOZLgel2UBmmL1t9earZaCeJQRmr2Lkbwpd0uR1i+6U8E8/E5cXrqWTGmue1A4lZW9pfIp+A140JjgqIIBJQng2fASk= Received: by 10.35.41.12 with SMTP id t12mr2335869pyj.1189779653257; Fri, 14 Sep 2007 07:20:53 -0700 (PDT) Received: by 10.90.69.17 with HTTP; Fri, 14 Sep 2007 07:20:53 -0700 (PDT) Message-ID: <2fc9a9c80709140720j2420f9bbv2d8a99f7e728055c@mail.gmail.com> Date: Fri, 14 Sep 2007 18:20:53 +0400 From: "Alexey Mel'nikoff" To: "Ant Users List" Subject: Re: When using ExecuteJava in other class, JVM don't allow to create streams. In-Reply-To: <2fc9a9c80709140439y14d2ccgfc87a199e46da742@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <2fc9a9c80709140439y14d2ccgfc87a199e46da742@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org Any one can help me? I try to extend Java task, and I get same error. Class which I try to execute cannot get output and input streams. This my code: package com.reksoft.documentum.tools.ant.taskdefs.dai; import java.io.File; import java.util.ArrayList; import java.util.Collection; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.ExitStatusException; import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.Java; import org.apache.tools.ant.types.CommandlineJava; import org.apache.tools.ant.types.Reference; public class InstallDocAppsTask extends Java { private boolean failonerror = false; private File docapppath; private Reference classpathref; private String classname; private String docbase; private String domain; private String installlog; private String username; private String userpass; private Cmdline cmdl = new Cmdline(); public InstallDocAppsTask() { super(); } /** * Do the execution. * * @throws BuildException * if failOnError is set to true and the application returns a * nonzero result code. */ public void execute() throws BuildException { String[] files = docapppath.list(); Collection dirs = new ArrayList(); for (int i = 0; i < files.length; i++) { File tmp = new File(docapppath.getAbsolutePath() + "\\" + files[i]); if (tmp.isDirectory()) { dirs.add(tmp); } } if (dirs.size() != 0) { int err = -1; for (File dir : dirs) { Cmdline cmd = new Cmdline(); cmd.setClassname(classname); cmd.createClasspath(getProject()).createPath().setRefid(classpathref); cmd.createArgument().setValue("-d " + docbase); cmd.createArgument().setValue("-n " + username); cmd.createArgument().setValue("-p " + userpass); if (domain != null && domain.trim().length() != 0) { cmd.createArgument().setValue("-m " + domain); } cmd.createArgument().setValue("-a " + "\"" + dir.getAbsolutePath() + "\""); if (installlog != null && installlog.trim().length() != 0) { cmd.createArgument().setValue("-l " + "\"" + (installlog.endsWith("\\") ? installlog : installlog + "\\") + dir.getName() + "\""); } setCommandLine(cmd); err = executeJava(); if (err != 0) { if (isFailonerror()) { throw new ExitStatusException("Java returned: " + err, err, getLocation()); } else { log("Java Result: " + err, Project.MSG_ERR); } } } } else { log("Direcory " + docapppath + " does not contain subdirectories, wich may contain DocApps", Project.MSG_ERR); } } public void setDocbase(String docbase) { this.docbase = docbase; } public void setUsername(String username) { this.username = username; } public void setUserpass(String userpass) { this.userpass = userpass; } public void setDomain(String domain) { this.domain = domain; } public void setInstalllog(String installlog) { this.installlog = installlog; } public void setDocapppath(File docapppath) { this.docapppath = docapppath; } public void setFailonerror(boolean failonerror) { this.failonerror = failonerror; } public void setClasspathrefId(Reference classpathref) { this.classpathref = classpathref; } public void setClassname(String classname) { this.classname = classname; } public class Cmdline extends CommandlineJava { @Override public String describeCommand() { return ""; } } public boolean isFailonerror() { return failonerror; } public Cmdline getCommandLine() { return cmdl; } public void setCommandLine(Cmdline cmdline) { this.cmdl = cmdline; } } --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org