ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 61853] New: ReplaceRegExp task does not work in java
Date Sun, 03 Dec 2017 23:46:00 GMT
https://bz.apache.org/bugzilla/show_bug.cgi?id=61853

            Bug ID: 61853
           Summary: ReplaceRegExp task does not work in java
           Product: Ant
           Version: 1.10.1
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core tasks
          Assignee: notifications@ant.apache.org
          Reporter: chen8002014@163.com
  Target Milestone: ---

ReplaceRegExp task works fine when I am using it in build.xml. However, when I
call it in JAVA code, exception will be thrown. I am sure that Project is not
empty for this task.
JAVA code:
    ReplaceRegExp replaceTask = new ReplaceRegExp();
    replaceTask.setProject(getProject());
    replaceTask.setTaskName(getTaskName());
    FileSet fs1 = new FileSet();
    fs1.setDir(new File(destDir.getPath() + "/tmp/wsdlc/generated"));
    fs1.setIncludes("**/*.java");
    replaceTask.addFileset(fs1);
    replaceTask.setMatch("public class (\\w+) implements java.io.Serializable
\\{");
    replaceTask.setReplace("public class \\1 implements java.io.Serializable
{
    public \\1\\(\\)\\{\\}");
    replaceTask.setByLine(false);
    replaceTask.execute();

Exception:
java.lang.NullPointerException
        at org.apache.tools.ant.types.AbstractFileSet.setupDirectoryScanner(
)
        at org.apache.tools.ant.types.AbstractFileSet.getDirectoryScanner(Ab

        at org.apache.tools.ant.types.FileSet.iterator(FileSet.java:70)
        at org.apache.tools.ant.types.resources.Union.getAllResources(Union.

        at org.apache.tools.ant.types.resources.Union.getCollection(Union.ja

        at org.apache.tools.ant.types.resources.BaseResourceCollectionContai
ResourceCollectionContainer.java:263)
        at org.apache.tools.ant.types.resources.BaseResourceCollectionContai
eCollectionContainer.java:142)
        at org.apache.tools.ant.taskdefs.optional.ReplaceRegExp.execute(Repl

        at com.bea.wlcp.wlng.ant.MyTask.modifySource(MyTask.java:464)

-- 
You are receiving this mail because:
You are the assignee for the bug.
Mime
View raw message