baldimir commented on code in PR #5675:
URL:
https://github.com/apache/incubator-kie-drools/pull/5675#discussion_r1479730168
##########
drools-util/src/main/java/org/drools/util/RemoveCommentsMain.java:
##########
@@ -10,9 +11,15 @@ public class RemoveCommentsMain {
public static void main(String... args) {
for (String fileName : args) {
try {
- Files.write(Path.of(fileName),
removeComments(fileName).getBytes());
+ final String result = removeComments(fileName);
+ if (result != null) {
+ Files.write(Path.of(fileName), result.getBytes());
+ }
} catch (IOException e) {
- throw new RuntimeException(e);
+ // Ignore non-existant files.
+ if (!(e instanceof NoSuchFileException)) {
Review Comment:
Fixed.
##########
drools-util/src/main/java/org/drools/util/RemoveCommentsMain.java:
##########
@@ -21,7 +28,11 @@ static String removeComments(String fileName) {
try (var lines = Files.lines(Path.of(fileName))) {
return lines.filter(line ->
!line.startsWith("#")).collect(Collectors.joining("\n"));
} catch (IOException e) {
- throw new RuntimeException(e);
+ // Ignore non-existant files.
+ if (!(e instanceof NoSuchFileException)) {
Review Comment:
Fixed.
--
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]