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

devonfw / IDEasy / 12125578396

02 Dec 2024 06:25PM UTC coverage: 67.265% (+0.3%) from 67.008%
12125578396

push

github

web-flow
#824: fix git url with branch (#828)

2509 of 4080 branches covered (61.5%)

Branch coverage included in aggregate %.

6565 of 9410 relevant lines covered (69.77%)

3.08 hits per line

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

37.5
cli/src/main/java/com/devonfw/tools/ide/cli/CliOfflineException.java
1
package com.devonfw.tools.ide.cli;
2

3
import java.nio.file.Path;
4

5
import com.devonfw.tools.ide.process.ProcessResult;
6
import com.devonfw.tools.ide.version.VersionIdentifier;
7

8
/**
9
 * {@link CliException} that is thrown if further processing requires network but the user if offline.
10
 */
11
public final class CliOfflineException extends CliException {
12

13
  /**
14
   * The constructor.
15
   */
16
  public CliOfflineException() {
17

18
    super("You are offline but network connection is required to perform the operation.", ProcessResult.OFFLINE);
×
19
  }
×
20

21
  /**
22
   * The constructor.
23
   *
24
   * @param message the {@link #getMessage() message}.
25
   */
26
  private CliOfflineException(String message) {
27
    super(message, ProcessResult.OFFLINE);
4✔
28
  }
1✔
29

30
  /**
31
   * Factory method, which is called, when trying to download via a URL
32
   *
33
   * @param url the url, which the software should be downloaded from.
34
   * @return A {@link CliOfflineException} with an informative message.
35
   */
36
  public static CliOfflineException ofDownloadViaUrl(String url) {
37
    return new CliOfflineException("You are offline and cannot download from URL " + url);
×
38
  }
39

40
  /**
41
   * Factory method, which is called, when trying to download via tool name, edition and version
42
   *
43
   * @param tool the name of the tool, we want to download.
44
   * @param edition the edition of the tool, we want to download.
45
   * @param version the {@link VersionIdentifier} of the tool, we want to download.
46
   * @return A {@link CliOfflineException} with an informative message.
47
   */
48
  public static CliOfflineException ofDownloadOfTool(String tool, String edition, VersionIdentifier version) {
49
    return new CliOfflineException("Not able to download tool " + tool + " in edition " + edition + " with version " + version + " because we are offline");
×
50
  }
51

52
  /**
53
   * Factory method, which is called, when just a purpose is given.
54
   *
55
   * @param purpose the purpose, which the internet connection serves.
56
   * @return A {@link CliOfflineException} with an informative message.
57
   */
58
  public static CliOfflineException ofPurpose(String purpose) {
59
    return new CliOfflineException("You are offline but Internet access is required for " + purpose);
6✔
60
  }
61

62
  /**
63
   * Factory method, which is called, when a clone is performed in offline mode
64
   *
65
   * @param url the url, in which the clone should be executed.
66
   * @param repository the path, where the repository should be cloned to.
67
   * @return A {@link CliOfflineException} with an informative message.
68
   */
69
  public static CliOfflineException ofClone(String url, Path repository) {
70
    return new CliOfflineException("Could not clone " + url + " to " + repository + " because you are offline.");
×
71
  }
72

73
}
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