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

Ekryd / echo-maven-plugin / 3648

14 Nov 2024 01:38PM CUT coverage: 96.795%. Remained the same
3648

push

circleci

web-flow
Update dependency org.codehaus.mojo:versions-maven-plugin to v2.18.0

302 of 312 relevant lines covered (96.79%)

0.97 hits per line

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

85.71
/echo/src/main/java/echo/util/FindFileInClassPath.java
1
package echo.util;
2

3
import echo.output.PluginLog;
4
import java.io.IOException;
5
import java.io.InputStream;
6

7
/** Try to retrieve content from the java class path. Usually placed under src/main/resources */
8
class FindFileInClassPath {
9

10
  private final PluginLog mavenPluginLog;
11

12
  private InputStream inputStream;
13
  private String absoluteFilePath;
14

15
  /**
16
   * Creates a new instance of the class
17
   *
18
   * @param mavenPluginLog Wrapper for Maven internal plugin logger
19
   */
20
  public FindFileInClassPath(PluginLog mavenPluginLog) {
1✔
21
    this.mavenPluginLog = mavenPluginLog;
1✔
22
  }
1✔
23

24
  /** Try to open a stream to the file location in the class path */
25
  public void openFile(String fileName) {
26
    try {
27
      var resource = this.getClass().getClassLoader().getResource(fileName);
1✔
28
      if (resource != null) {
1✔
29
        this.inputStream = resource.openStream();
1✔
30
        this.absoluteFilePath = resource.getPath();
1✔
31
      }
32
    } catch (IOException iex) {
×
33
      mavenPluginLog.debug(iex);
×
34
    }
1✔
35
  }
1✔
36

37
  /** Return true if stream is opened to file content */
38
  public boolean isFound() {
39
    return inputStream != null;
1✔
40
  }
41

42
  /** Return stream to file content */
43
  public InputStream getInputStream() {
44
    return inputStream;
1✔
45
  }
46

47
  public String getAbsoluteFilePath() {
48
    return absoluteFilePath;
1✔
49
  }
50
}
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

© 2025 Coveralls, Inc