• 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

68.63
/src/main/java/org/commonwl/cwlsdk/cwl1_1/utils/SecondaryFilesDslLoader.java
1
package org.commonwl.cwlsdk.cwl1_1.utils;
2

3
import java.util.ArrayList;
4
import java.util.HashMap;
5
import java.util.List;
6
import java.util.Map;
7

8
public class SecondaryFilesDslLoader<T> implements Loader<T> {
9
  private final Loader<T> innerLoader;
10

11
  public SecondaryFilesDslLoader(final Loader<T> innerLoader) {
1✔
12
    this.innerLoader = innerLoader;
1✔
13
  }
1✔
14

15

16
  public T load(
17
      final Object doc_,
18
      final String baseUri,
19
      final LoadingOptions loadingOptions,
20
      final String docRoot) {
21
    Object doc = doc_;
1✔
22
    List<Map<String, Object>> r = new ArrayList<Map<String, Object>>();
1✔
23
    if (doc instanceof List) {
1✔
24
      final List<Object> docList = (List<Object>) doc;
1✔
25
      for (final Object d : docList) {
1✔
26
        Map<String, Object> entry = new HashMap<String, Object>();
1✔
27
        if (d instanceof String) {
1✔
28
          String dString = (String) d;
1✔
29
          if (dString.endsWith("?")) {
1✔
30
            entry.put("pattern", dString.substring(0, dString.length()-1));
1✔
31
            entry.put("required", false);
1✔
32
          } else {
33
            entry.put("pattern", dString);
1✔
34
          }
35
          r.add(entry);
1✔
36
        } else if (d instanceof Map) {
1✔
37
          @SuppressWarnings("unchecked")
38
          Map<String, Object> dMap = new HashMap<String, Object>((Map<String, Object>) d);
1✔
39
          if (dMap.containsKey("pattern")) {
1✔
40
            entry.put("pattern", dMap.remove("pattern"));
1✔
41
          } else {
NEW
42
            throw new ValidationException("Missing 'pattern' in secondaryFiles specification entry.");
×
43
          }
44
          if (dMap.containsKey("required")) {
1✔
45
            entry.put("required", dMap.remove("required"));
1✔
46
          }
47
          if (dMap.size() > 0) {
1✔
NEW
48
            throw new ValidationException("Unallowed values in secondaryFiles specification entry.");
×
49
          }
50
          r.add(entry);
1✔
51
        } else {
1✔
NEW
52
          throw new ValidationException("Expected a string or sequence of (strings or mappings).");
×
53
        }
54
      }
1✔
55
    } else if (doc instanceof Map) {
1✔
NEW
56
      Map<String, Object> entry = new HashMap<String, Object>();
×
57
      @SuppressWarnings("unchecked")
NEW
58
      Map<String, Object> dMap = new HashMap<String, Object>((Map<String, Object>) doc);
×
NEW
59
      if (dMap.containsKey("pattern")) {
×
NEW
60
        entry.put("pattern", dMap.remove("pattern"));
×
61
      } else {
NEW
62
        throw new ValidationException("Missing 'pattern' in secondaryFiles specification entry.");
×
63
      }
NEW
64
      if (dMap.containsKey("required")) {
×
NEW
65
        entry.put("required", dMap.remove("required"));
×
66
      }
NEW
67
      if (dMap.size() > 0) {
×
NEW
68
        throw new ValidationException("Unallowed values in secondaryFiles specification entry.");
×
69
      }
NEW
70
      r.add(entry);
×
71
    } else if (doc instanceof String) {
1✔
72
          String dString = (String) doc;
1✔
73
          Map<String, Object> entry = new HashMap<String, Object>();
1✔
74
          if (dString.endsWith("?")) {
1✔
NEW
75
        entry.put("pattern", dString.substring(0, dString.length()-1));
×
NEW
76
            entry.put("required", false);
×
77
          } else {
78
        entry.put("pattern", dString);
1✔
79
          }
80
          r.add(entry);
1✔
81
    } else {
1✔
NEW
82
        throw new ValidationException("Expected a string or sequence of (strings or mappings).");
×
83
    }
84
    return this.innerLoader.load(r, baseUri, loadingOptions, docRoot);
1✔
85
  }
86
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc