Skip to content
This repository was archived by the owner on Oct 21, 2025. It is now read-only.

Commit fbb1105

Browse files
authored
Merge pull request #3 from DataFlowAnalysis/bugfix
Fix: Issue for new models with constraints where annotations are empty
2 parents 5c2b855 + 6d52628 commit fbb1105

File tree

1 file changed

+6
-4
lines changed
  • bundles/org.dataflowanalysis.standalone/src/org/dataflowanalysis/standalone/analysis

1 file changed

+6
-4
lines changed

bundles/org.dataflowanalysis.standalone/src/org/dataflowanalysis/standalone/analysis/Converter.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,11 @@ public static String convertToDFDandStringify(WebEditorDfd webEditorDfd, String
148148
}
149149

150150
private static List<AnalysisConstraint> parseConstraints(WebEditorDfd webEditorDfd) {
151-
return webEditorDfd.constraints().stream().map(it -> {
152-
return AnalysisConstraint.fromString(new StringView(it.constraint())).getResult();
153-
}).toList();
151+
return webEditorDfd.constraints().stream()
152+
.filter(it -> it.constraint() != null && !it.constraint().isEmpty())
153+
.map(it -> {
154+
return AnalysisConstraint.fromString(new StringView(it.constraint())).getResult();
155+
}).toList();
154156
}
155157

156158
private static List<DSLResult> runAnalysis(DataFlowDiagramAndDictionary dfd, List<AnalysisConstraint> constraints) {
@@ -193,7 +195,7 @@ private static WebEditorDfd annotateViolations(WebEditorDfd webEditorDfd, List<D
193195
for (Child child : webEditorDfd.model().children()) {
194196
if (nodeToAnnotationMap.containsKey(child)) {
195197
StringBuilder builder = new StringBuilder();
196-
builder.append(child.annotation().message().toString());
198+
if(child.annotation() != null) builder.append(child.annotation().message().toString());
197199
if (builder.toString() != "") builder.append("\n");
198200
builder.append(nodeToAnnotationMap.get(child));
199201

0 commit comments

Comments
 (0)