Skip to content

Commit d9d4051

Browse files
author
Max Schaefer
committed
JavaScript: Extract auxiliary method.
1 parent 01b43df commit d9d4051

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

javascript/extractor/src/com/semmle/js/extractor/AutoBuild.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -285,9 +285,8 @@ private void setupIncludesAndExcludes() {
285285
excludes.add(toRealPath(folderPath));
286286
} catch (InvalidPathException | URISyntaxException | ResourceError e) {
287287
Exceptions.ignore(e, "Ignore path and print warning message instead");
288-
System.err.println("Ignoring '" + fields[0] + "' classification for " +
288+
warn("Ignoring '" + fields[0] + "' classification for " +
289289
folder + ", which is not a valid path.");
290-
System.err.flush();
291290
}
292291
}
293292
}
@@ -354,8 +353,7 @@ private boolean addPathPattern(Set<Path> patterns, Path base, String pattern) {
354353
patterns.add(realPath);
355354
} catch (ResourceError e) {
356355
Exceptions.ignore(e, "Ignore exception and print warning instead.");
357-
System.err.println("Skipping path " + path + ", which does not exist.");
358-
System.err.flush();
356+
warn("Skipping path " + path + ", which does not exist.");
359357
}
360358
return true;
361359
}
@@ -557,8 +555,7 @@ private SourceType getSourceType() {
557555
protected void extract(FileExtractor extractor, Path file) throws IOException {
558556
File f = file.toFile();
559557
if (!f.exists()) {
560-
System.err.println("Skipping " + file + ", which does not exist.");
561-
System.err.flush();
558+
warn("Skipping " + file + ", which does not exist.");
562559
return;
563560
}
564561

@@ -567,6 +564,11 @@ protected void extract(FileExtractor extractor, Path file) throws IOException {
567564
logEndProcess();
568565
}
569566

567+
private void warn(String msg) {
568+
System.err.println(msg);
569+
System.err.flush();
570+
}
571+
570572
private void logBeginProcess(String message) {
571573
System.out.print(message + "...");
572574
System.out.flush();

0 commit comments

Comments
 (0)