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<File> dirs = new ArrayList<File>();
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;
}
}
--
----
------
--------
----------
Как его там "виз бест регардс энд всё такое" :)