Skip to content

Commit 84a4899

Browse files
committed
refactor
1 parent a8444db commit 84a4899

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/main/java/com/checkmarx/ast/wrapper/Execution.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ static <T> T executeCommand(List<String> arguments,
4343
Logger logger,
4444
Function<String, T> lineParser)
4545
throws IOException, InterruptedException, CxException {
46-
return executeCommand(arguments, logger, lineParser, null);
46+
return executeCommand(arguments, logger, lineParser, Execution::areAllFieldsNotNull);
4747
}
4848

4949
static <T> T executeCommand(List<String> arguments,
@@ -61,11 +61,7 @@ static <T> T executeCommand(List<String> arguments,
6161
output.append(line).append(LINE_SEPARATOR);
6262
T parsedLine = lineParser.apply(line);
6363
if (parsedLine != null) {
64-
if (Objects.isNull(customValidator)) {
65-
executionResult = areAllFieldsNotNull(parsedLine) ? parsedLine : null;
66-
} else {
67-
executionResult = (customValidator.apply(arguments, parsedLine) || areAllFieldsNotNull(parsedLine)) ? parsedLine : null;
68-
}
64+
executionResult = customValidator.apply(arguments, parsedLine) ? parsedLine : null;
6965
}
7066
}
7167
process.waitFor();
@@ -77,7 +73,7 @@ static <T> T executeCommand(List<String> arguments,
7773
}
7874

7975

80-
private static boolean areAllFieldsNotNull(Object obj) {
76+
private static boolean areAllFieldsNotNull(List<String> arguments, Object obj) {
8177
for (Field field : obj.getClass().getDeclaredFields()) {
8278
field.setAccessible(true);
8379
try {

0 commit comments

Comments
 (0)