• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

common-workflow-language / cwljava / #394

31 Oct 2025 04:10PM UTC coverage: 57.972% (-1.6%) from 59.538%
#394

push

github

mr-c
rename package to a namespace that we control

7575 of 12994 new or added lines in 261 files covered. (58.3%)

7752 of 13372 relevant lines covered (57.97%)

0.58 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

87.18
/src/main/java/org/commonwl/cwlsdk/cwl1_2/utils/ValidationException.java
1
package org.commonwl.cwlsdk.cwl1_2.utils;
2

3
import java.util.ArrayList;
4
import java.util.Arrays;
5
import java.util.List;
6

7
public class ValidationException extends RuntimeException {
8
  private final List<ValidationException> children;
9
  private String bullet = "";
1✔
10
  private String currentMessage;
11

12
  public ValidationException(final String message) {
13
    this(message, (List<ValidationException>) null);
1✔
14
  }
1✔
15

16
  public ValidationException(final String message, final ValidationException child) {
17
    this(message, Arrays.asList(child));
1✔
18
  }
1✔
19

20
  public ValidationException(final String message, final List<ValidationException> children_) {
21
    super(message);
1✔
22
    this.currentMessage = message;
1✔
23
    final List<ValidationException> children = new ArrayList<ValidationException>();
1✔
24
    if (children_ != null) {
1✔
25
      for (final ValidationException child : children_) {
1✔
26
        children.addAll(child.simplify());
1✔
27
      }
1✔
28
    }
29
    this.children = children;
1✔
30
  }
1✔
31

32
  public ValidationException withBullet(final String bullet) {
NEW
33
    this.bullet = bullet;
×
NEW
34
    return this;
×
35
  }
36

37
  public List<ValidationException> simplify() {
38
    if (getMessage().length() > 0) {
1✔
39
      return Arrays.asList(this);
1✔
40
    } else {
NEW
41
      return this.children;
×
42
    }
43
  }
44

45
  public String summary(final int level, final boolean withBullet) {
46
    final int indentPerLevel = 2;
1✔
47
    final String spaces = new String(new char[level * indentPerLevel]).replace("\0", " ");
1✔
48
    final String bullet;
49
    if (this.bullet.length() > 0 && withBullet) {
1✔
NEW
50
      bullet = this.bullet;
×
51
    } else {
52
      bullet = "";
1✔
53
    }
54
    return spaces + bullet + this.currentMessage;
1✔
55
  }
56

57
  public String prettyStr(final Integer level_) {
58
    Integer level = level_;
1✔
59
    if (level == null) {
1✔
60
      level = 0;
1✔
61
    }
62
    final List<String> parts = new ArrayList<String>();
1✔
63
    int nextLevel;
64
    if (this.currentMessage != null && this.currentMessage.length() > 0) {
1✔
65
      parts.add(this.summary(level, true));
1✔
66
      nextLevel = level + 1;
1✔
67
    } else {
NEW
68
      nextLevel = level;
×
69
    }
70
    for (final ValidationException child : this.children) {
1✔
71
      parts.add(child.prettyStr(nextLevel));
1✔
72
    }
1✔
73
    final String ret = String.join("\n", parts);
1✔
74
    return ret;
1✔
75
  }
76

77
  public String getMessage() {
78
    return this.prettyStr(null);
1✔
79
  }
80
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc