diff --git a/src/main/java/edu/uiowa/cs/clc/kind2/results/Object.java b/src/main/java/edu/uiowa/cs/clc/kind2/results/Object.java index b804975..184f559 100644 --- a/src/main/java/edu/uiowa/cs/clc/kind2/results/Object.java +++ b/src/main/java/edu/uiowa/cs/clc/kind2/results/Object.java @@ -23,7 +23,8 @@ public enum Object postAnalysisEnd("postAnalysisEnd"), modelElementSet("modelElementSet"), progress("progress"), - lsp("lsp"); + lsp("lsp"), + modelSetEnumeration("modelSetEnumeration"); private final String value; @@ -60,6 +61,8 @@ public static Object getKind2Object(String kind2Object) return progress; case "lsp": return lsp; + case "modelSetEnumeration": + return modelSetEnumeration; default: throw new UnsupportedOperationException("Value " + kind2Object + " is not defined"); } diff --git a/src/main/java/edu/uiowa/cs/clc/kind2/results/Result.java b/src/main/java/edu/uiowa/cs/clc/kind2/results/Result.java index ba96447..b064821 100644 --- a/src/main/java/edu/uiowa/cs/clc/kind2/results/Result.java +++ b/src/main/java/edu/uiowa/cs/clc/kind2/results/Result.java @@ -161,7 +161,7 @@ public void initialize(String json) { Analysis kind2Analysis = null; // for post analysis Analysis previousAnalysis = null; - + boolean emptyAnalysis = false; for (JsonElement jsonElement : jsonArray) { String objectType = jsonElement.getAsJsonObject().get(Labels.objectType).getAsString(); Object kind2Object = Object.getKind2Object(objectType); @@ -250,7 +250,8 @@ public void initialize(String json) { PostAnalysis postAnalysis = new PostAnalysis(previousAnalysis, jsonElement); previousAnalysis.setPostAnalysis(postAnalysis); } else { - throw new RuntimeException("Can not parse kind2 json output"); + // This can occur sometimes with no previous analysis when the node had no properties to check. + emptyAnalysis = true; } } @@ -258,6 +259,8 @@ public void initialize(String json) { if (previousAnalysis != null && previousAnalysis.getPostAnalysis() != null) { // finish the post analysis previousAnalysis = null; + } else if (emptyAnalysis){ + //Do nothing, had a no-analysis postAnalysisStart beforehand. } else { throw new RuntimeException("Failed to analyze kind2 json output"); } @@ -269,7 +272,8 @@ public void initialize(String json) { ModelElementSet elementSet = new ModelElementSet(postAnalysis, jsonElement); postAnalysis.addModelElementSet(elementSet); } else { - throw new RuntimeException("Can not parse kind2 json output"); + // This branch gets hit sometimes when we have empty (nonexistent) analyses of nodes with + // no properties to check, causing missing analyses before postAnalyses, as well as this object. } } }