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

pkiraly / metadata-qa-api / #677

07 May 2025 08:08PM UTC coverage: 87.245% (+0.01%) from 87.231%
#677

push

pkiraly
Implement SonarCloud quality suggestions #159: fix blockers

17 of 24 new or added lines in 9 files covered. (70.83%)

2 existing lines in 1 file now uncovered.

5520 of 6327 relevant lines covered (87.25%)

0.87 hits per line

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

65.0
/src/main/java/de/gwdg/metadataqa/api/cli/Version.java
1
package de.gwdg.metadataqa.api.cli;
2

3
import java.io.IOException;
4
import java.io.InputStream;
5
import java.util.Properties;
6

7
public class Version {
×
8
  private static final String PATH = "/version.prop";
9
  private static String currentVersion;
10

11
  public static void main(String[] args) {
12
    System.err.println(Version.getVersion());
×
13
  }
×
14

15
  public static String getVersion() {
16
    if (currentVersion == null) {
1✔
17
      initialize();
1✔
18
    }
19
    return currentVersion;
1✔
20
  }
21

22
  private static void initialize() {
23
    String versionCandidate = Version.class.getPackage().getImplementationVersion();
1✔
24
    if (versionCandidate != null)
1✔
NEW
25
      currentVersion = versionCandidate;
×
26
    else {
27
      currentVersion = readVersionFromPropertyFile();
1✔
28
    }
29
  }
1✔
30

31
  public static String readVersionFromPropertyFile() {
32
    InputStream stream = Version.class.getResourceAsStream(PATH);
1✔
33
    if (stream == null)
1✔
34
      return "UNKNOWN";
×
35
    Properties props = new Properties();
1✔
36
    try {
37
      props.load(stream);
1✔
38
      stream.close();
1✔
39
      return (String) props.get("version");
1✔
40
    } catch (IOException e) {
×
41
      return "UNKNOWN";
×
42
    }
43
  }
44
}
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