@@ -161,7 +161,7 @@ public void initialize(String json) {
161161 Analysis kind2Analysis = null ;
162162 // for post analysis
163163 Analysis previousAnalysis = null ;
164-
164+ boolean emptyAnalysis = false ;
165165 for (JsonElement jsonElement : jsonArray ) {
166166 String objectType = jsonElement .getAsJsonObject ().get (Labels .objectType ).getAsString ();
167167 Object kind2Object = Object .getKind2Object (objectType );
@@ -250,14 +250,17 @@ public void initialize(String json) {
250250 PostAnalysis postAnalysis = new PostAnalysis (previousAnalysis , jsonElement );
251251 previousAnalysis .setPostAnalysis (postAnalysis );
252252 } else {
253- throw new RuntimeException ("Can not parse kind2 json output" );
253+ // This can occur sometimes with no previous analysis when the node had no properties to check.
254+ emptyAnalysis = true ;
254255 }
255256 }
256257
257258 if (kind2Object == Object .postAnalysisEnd ) {
258259 if (previousAnalysis != null && previousAnalysis .getPostAnalysis () != null ) {
259260 // finish the post analysis
260261 previousAnalysis = null ;
262+ } else if (emptyAnalysis ){
263+ //Do nothing, had a no-analysis postAnalysisStart beforehand.
261264 } else {
262265 throw new RuntimeException ("Failed to analyze kind2 json output" );
263266 }
@@ -269,7 +272,8 @@ public void initialize(String json) {
269272 ModelElementSet elementSet = new ModelElementSet (postAnalysis , jsonElement );
270273 postAnalysis .addModelElementSet (elementSet );
271274 } else {
272- throw new RuntimeException ("Can not parse kind2 json output" );
275+ // This branch gets hit sometimes when we have empty (nonexistent) analyses of nodes with
276+ // no properties to check, causing missing analyses before postAnalyses, as well as this object.
273277 }
274278 }
275279 }
0 commit comments