git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@703516 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -239,6 +239,7 @@ Rick Beton | |||||
| Robert Anderson | Robert Anderson | ||||
| Robert Flaherty | Robert Flaherty | ||||
| Robert Shaw | Robert Shaw | ||||
| Robert Streich | |||||
| Robert Watkins | Robert Watkins | ||||
| Roberto Scaramuzzi | Roberto Scaramuzzi | ||||
| Robin Green | Robin Green | ||||
| @@ -236,6 +236,10 @@ Fixed bugs: | |||||
| find the corresponding source files. | find the corresponding source files. | ||||
| Bugzilla Report 45916. | Bugzilla Report 45916. | ||||
| * <javadoc> failed if the nested <bottom> or <head> contained line | |||||
| breaks. | |||||
| Bugzilla Report 43342. | |||||
| Other changes: | Other changes: | ||||
| -------------- | -------------- | ||||
| @@ -972,6 +972,10 @@ | |||||
| <first>Robert</first> | <first>Robert</first> | ||||
| <last>Shaw</last> | <last>Shaw</last> | ||||
| </name> | </name> | ||||
| <name> | |||||
| <first>Robert</first> | |||||
| <last>Streich</last> | |||||
| </name> | |||||
| <name> | <name> | ||||
| <first>Robert</first> | <first>Robert</first> | ||||
| <last>Watkins</last> | <last>Watkins</last> | ||||
| @@ -413,7 +413,7 @@ to ensure that this command supports the attributes you wish to use.</p> | |||||
| in srcfiles or as nested source elements should be written to a | in srcfiles or as nested source elements should be written to a | ||||
| temporary file to make the command line shorter. Also applies to | temporary file to make the command line shorter. Also applies to | ||||
| the package names specified via the packagenames attribute or | the package names specified via the packagenames attribute or | ||||
| nested package elements.<em>Since Ant 1.7.0</em>, also applies | |||||
| nested package elements. <em>Since Ant 1.7.0</em>, also applies | |||||
| to all the other command line options. | to all the other command line options. | ||||
| (<code>yes</code> | <code>no</code>). Default is no.</td> | (<code>yes</code> | <code>no</code>). Default is no.</td> | ||||
| <td align="center" valign="top">all</td> | <td align="center" valign="top">all</td> | ||||
| @@ -571,6 +571,9 @@ Same as for <code>package</code>. | |||||
| <p>Same as the <code>doctitle</code> attribute, but you can nest text | <p>Same as the <code>doctitle</code> attribute, but you can nest text | ||||
| inside the element this way.</p> | inside the element this way.</p> | ||||
| <p>If the nested text contains line breaks, you must use the | |||||
| useexternalfile attribute and set it to true.</p> | |||||
| <h4>header</h4> | <h4>header</h4> | ||||
| <p>Similar to <code><doctitle></code>.</p> | <p>Similar to <code><doctitle></code>.</p> | ||||
| @@ -2243,30 +2243,46 @@ public class Javadoc extends Task { | |||||
| return false; | return false; | ||||
| } | } | ||||
| private String quoteString(String str, final char delim) { | |||||
| private String quoteString(final String str, final char delim) { | |||||
| StringBuffer buf = new StringBuffer(str.length() * 2); | StringBuffer buf = new StringBuffer(str.length() * 2); | ||||
| buf.append(delim); | buf.append(delim); | ||||
| if (str.indexOf('\\') != -1) { | |||||
| str = replace(str, '\\', "\\\\"); | |||||
| } | |||||
| if (str.indexOf(delim) != -1) { | |||||
| str = replace(str, delim, "\\" + delim); | |||||
| } | |||||
| buf.append(str); | |||||
| buf.append(delim); | |||||
| return buf.toString(); | |||||
| } | |||||
| private String replace(String str, char fromChar, String toString) { | |||||
| StringBuffer buf = new StringBuffer(str.length() * 2); | |||||
| for (int i = 0; i < str.length(); ++i) { | |||||
| char ch = str.charAt(i); | |||||
| if (ch == fromChar) { | |||||
| buf.append(toString); | |||||
| final int len = str.length(); | |||||
| boolean lastCharWasCR = false; | |||||
| for (int i = 0; i < len; i++) { | |||||
| char c = str.charAt(i); | |||||
| if (c == delim) { // can't put the non-constant delim into a case | |||||
| buf.append('\\').append(c); | |||||
| lastCharWasCR = false; | |||||
| } else { | } else { | ||||
| buf.append(ch); | |||||
| switch (c) { | |||||
| case '\\': | |||||
| buf.append("\\\\"); | |||||
| lastCharWasCR = false; | |||||
| break; | |||||
| case '\r': | |||||
| // insert a line continuation marker | |||||
| buf.append("\\\r"); | |||||
| lastCharWasCR = true; | |||||
| break; | |||||
| case '\n': | |||||
| // insert a line continuation marker unless this | |||||
| // is a \r\n sequence in which case \r already has | |||||
| // created the marker | |||||
| if (!lastCharWasCR) { | |||||
| buf.append("\\\n"); | |||||
| } else { | |||||
| buf.append("\n"); | |||||
| } | |||||
| lastCharWasCR = false; | |||||
| break; | |||||
| default: | |||||
| buf.append(c); | |||||
| lastCharWasCR = false; | |||||
| break; | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| buf.append(delim); | |||||
| return buf.toString(); | return buf.toString(); | ||||
| } | } | ||||
| @@ -0,0 +1,45 @@ | |||||
| <?xml version="1.0"?> | |||||
| <!-- | |||||
| Licensed to the Apache Software Foundation (ASF) under one or more | |||||
| contributor license agreements. See the NOTICE file distributed with | |||||
| this work for additional information regarding copyright ownership. | |||||
| The ASF licenses this file to You under the Apache License, Version 2.0 | |||||
| (the "License"); you may not use this file except in compliance with | |||||
| the License. You may obtain a copy of the License at | |||||
| http://www.apache.org/licenses/LICENSE-2.0 | |||||
| Unless required by applicable law or agreed to in writing, software | |||||
| distributed under the License is distributed on an "AS IS" BASIS, | |||||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||||
| See the License for the specific language governing permissions and | |||||
| limitations under the License. | |||||
| --> | |||||
| <project default="antunit" xmlns:au="antlib:org.apache.ant.antunit"> | |||||
| <import file="../antunit-base.xml" /> | |||||
| <target name="testBottomWithLineBreaksWithFile"> | |||||
| <mkdir dir="${input}/test"/> | |||||
| <echo file="${input}/test/A.java"><![CDATA[ | |||||
| package test; | |||||
| /** | |||||
| * This is a test class. | |||||
| */ | |||||
| public class A { | |||||
| /** | |||||
| * With a test method. | |||||
| */ | |||||
| public void foo(String bar) {} | |||||
| } | |||||
| ]]></echo> | |||||
| <javadoc destdir="${output}" useexternalfile="true"> | |||||
| <fileset dir="${input}"/> | |||||
| <bottom><![CDATA[ | |||||
| <hr/> | |||||
| Hello World | |||||
| ]]></bottom> | |||||
| </javadoc> | |||||
| <au:assertFileExists file="${output}/test/A.html"/> | |||||
| </target> | |||||
| </project> | |||||