You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2002/09/09 04:37:43 UTC

DO NOT REPLY [Bug 12407] New: - ReplaceRegExp task adds unwanted end of line at end of result

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12407>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12407

ReplaceRegExp task adds unwanted end of line at end of result

           Summary: ReplaceRegExp task adds unwanted end of line at end of
                    result
           Product: Ant
           Version: 1.5
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Optional Tasks
        AssignedTo: ant-dev@jakarta.apache.org
        ReportedBy: careye@spamcop.net


I'm using the ReplaceRegExp task to remove extra newlines from our JSPs before
they get deployed, like this:

    <replaceregexp
        match='(["\s])((--)?%>)(([\r\n]*)(&lt;/jsp:useBean&gt;))?([\r\n]+)'
        replace="\1\5\7\2\6" flags="g">
      <fileset dir="${web.destdir}" includes="*.jsp"/>
    </replaceregexp>

However, I get an extra \r\n at the end of the result, when I don't want the
file to end with any newline at all.

The problem seems to be at line 357 of
src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java:

                pw.println(res);

where, for consistency with the br.read(...) above, it should be:

                pw.write(res);

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>