File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
src/main/java/com/checkmarx/ast/wrapper Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change 22
33import org .slf4j .Logger ;
44import java .io .*;
5+ import java .lang .reflect .Field ;
56import java .net .URL ;
67import java .nio .charset .StandardCharsets ;
78import java .nio .file .Files ;
@@ -48,7 +49,9 @@ static <T> T executeCommand(List<String> arguments,
4849 stringBuilder .append (line ).append (LINE_SEPARATOR );
4950 T parsedLine = lineParser .apply (line );
5051 if (parsedLine != null ) {
51- executionResult = parsedLine ;
52+ if (areAllFieldsNotNull (parsedLine )) {
53+ executionResult = parsedLine ;
54+ }
5255 }
5356 }
5457 process .waitFor ();
@@ -59,6 +62,19 @@ static <T> T executeCommand(List<String> arguments,
5962 }
6063 }
6164
65+ private static boolean areAllFieldsNotNull (Object obj ) {
66+ for (Field field : obj .getClass ().getDeclaredFields ()) {
67+ field .setAccessible (true );
68+ try {
69+ if (field .get (obj ) == null ) {
70+ return false ;
71+ }
72+ } catch (IllegalAccessException e ) {
73+ return false ;
74+ }
75+ }
76+ return true ;
77+ }
6278 static String executeCommand (List <String > arguments ,
6379 Logger logger ,
6480 String directory ,
You can’t perform that action at this time.
0 commit comments