lbownik commented on code in PR #4969:
URL: https://github.com/apache/netbeans/pull/4969#discussion_r1023983158
##########
nbbuild/antsrc/org/netbeans/nbbuild/CheckLinks.java:
##########
@@ -633,8 +645,33 @@ final Boolean isOk (URI u) throws BuildException {
throw new BuildException ("Each filter must have pattern
attribute");
}
- if (pattern.matcher (u.toString ()).matches ()) {
- log ("Matched " + u + " accepted: " + accept,
org.apache.tools.ant.Project.MSG_VERBOSE);
+ if (pattern.matcher(u.toString()).matches()) {
+ log("Matched " + u + " accepted: " + accept,
org.apache.tools.ant.Project.MSG_VERBOSE);
+ if (externallinksdump != null) {
+ try {
+ String dummyName;
+ if (accept) {
+ dummyName = "acceptednetbeans.txt";
+ } else {
+ dummyName = "rejectednetbeans.txt";
+ }
+ Path dumppath =
externallinksdump.toPath().resolve(dummyName);
+ if (Files.notExists(dumppath)) {
+ Files.createDirectories(dumppath.getParent());
+ Files.createFile(dumppath);
+ }
+ List<String> existingEntries =
Files.readAllLines(externallinksdump.toPath().resolve(dummyName));
+ Set<String> sortedEntries = new
TreeSet<>(existingEntries);
+ sortedEntries.add(u.toString());
+ StringBuilder sb = new StringBuilder();
+ for (String sortedEntry : sortedEntries) {
+
sb.append(sortedEntry).append(System.lineSeparator());
+ }
+ Files.write(dumppath, sb.toString().getBytes(),
StandardOpenOption.WRITE, StandardOpenOption.TRUNCATE_EXISTING);
Review Comment:
Wouldn't
Files.write(dumbpath, sortedEntries, StandardOpenOption.WRITE,
StandardOpenOption.TRUNCATE_EXISTING);
be more efficient?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists