Skip to content

Commit

Permalink
Use String#join where possible (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
basil authored Aug 4, 2022
1 parent 4f201b3 commit 17a4ff6
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions src/main/java/org/kohsuke/stapler/TaglibDocMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -195,16 +195,16 @@ private void scanTagLibs(File dir, String uri, Tags tags) throws IOException {
private void parseTagLib(File dir, String uri, Library lib) throws IOException {
getLog().info("Processing "+dir);

List markerFile = FileUtils.readLines(new File(dir, "taglib"));
List<String> markerFile = FileUtils.readLines(new File(dir, "taglib"));
if (markerFile.size() == 0) {
markerFile.add(uri);
}

// write the attributes
lib.name(markerFile.get(0).toString());
lib.name(markerFile.get(0));
lib.prefix(uri.substring(uri.lastIndexOf('/')+1)).uri(uri);
// doc
lib.doc()._pcdata(join(markerFile));
lib.doc()._pcdata(String.join("\n", markerFile));

File[] tagFiles = dir.listFiles(f -> f.getName().endsWith(".jelly"));
if (tagFiles == null) {
Expand Down Expand Up @@ -252,17 +252,6 @@ private void parseTagFile(File tagFile, Tag tag) throws IOException {
}
}

private String join(List list) {
StringBuilder buf = new StringBuilder();
for (Object item : list) {
if (buf.length() > 0) {
buf.append('\n');
}
buf.append(item);
}
return buf.toString();
}

//
// MavenReport implementation
//
Expand Down

0 comments on commit 17a4ff6

Please sign in to comment.