8231122: @index tag with newline causes tag search to fail

Reviewed-by: jjg
This commit is contained in:
Hannes Wallnöfer 2019-09-24 11:49:48 +02:00
parent a63b541842
commit 8743f0b6d1
5 changed files with 19 additions and 11 deletions

View File

@ -110,7 +110,8 @@ public class TagletWriterImpl extends TagletWriter {
String tagText = ch.getText(itt.getSearchTerm());
if (tagText.charAt(0) == '"' && tagText.charAt(tagText.length() - 1) == '"') {
tagText = tagText.substring(1, tagText.length() - 1);
tagText = tagText.substring(1, tagText.length() - 1)
.replaceAll("\\s+", " ");
}
String desc = ch.getText(itt.getDescription());

View File

@ -312,7 +312,7 @@ public class Links {
* @return a valid HTML name
*/
public String getName(String name) {
return name.replaceAll(" +", "");
return name.replaceAll("\\s+", "");
}
}

View File

@ -149,11 +149,12 @@ public class TestSearchScript extends JavadocTester {
checkSearch(inv, "operty", List.of());
// search tag
checkSearch(inv, "search tag", List.of("search tag"));
checkSearch(inv, "search tag", List.of("search tag"));
checkSearch(inv, "search ", List.of("search tag"));
checkSearch(inv, "tag", List.of("search tag"));
checkSearch(inv, "sea", List.of("search tag"));
checkSearch(inv, "search tag", List.of("multiline search tag", "search tag"));
checkSearch(inv, "search tag", List.of("multiline search tag", "search tag"));
checkSearch(inv, "search ", List.of("multiline search tag", "search tag"));
checkSearch(inv, "tag", List.of("multiline search tag", "search tag"));
checkSearch(inv, "sea", List.of("multiline search tag", "search tag"));
checkSearch(inv, "multi", List.of("multiline search tag"));
checkSearch(inv, "ear", List.of());
}
@ -244,7 +245,7 @@ public class TestSearchScript extends JavadocTester {
List.of("listpkg.List.of(E, E, E, E)", "listpkg.List.of(E, E, E, E, E)"));
checkSearch(inv, "l . o (e,e,e,",
List.of("listpkg.List.of(E, E, E, E)", "listpkg.List.of(E, E, E, E, E)"));
checkSearch(inv, "search \tt", List.of("search tag"));
checkSearch(inv, "search \tt", List.of("other search tag"));
checkSearch(inv, "sear ch", List.of());
checkSearch(inv, "( e ..", List.of("listpkg.List.of(E...)"));
checkSearch(inv, "( i [ ]", List.of("listpkg.Nolist.withArrayArg(int[])"));

View File

@ -27,9 +27,8 @@ import java.util.Collection;
import java.util.Map;
/**
* Example class containing "list" but not matching at any word boundary.
*
* {@index "search tag"}.
* Example class containing "list" but not matching at any word boundary. {@index "other
* search tag"}.
*/
public class Nolist {

View File

@ -25,6 +25,13 @@ package mappkg;
import java.util.Iterator;
/**
* Map interface.
*
* {@index "multiline
* search
* tag"}
*/
public interface Map {
public void put(Object key, Object value);
public boolean contains(Object key);