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

devonfw / IDEasy / 11892982640

18 Nov 2024 01:01PM UTC coverage: 67.276% (-0.006%) from 67.282%
11892982640

Pull #702

github

web-flow
Merge 5b12a1574 into 2966a61ee
Pull Request #702: #81: Implement ToolCommandlet for Kubernetes

2461 of 3999 branches covered (61.54%)

Branch coverage included in aggregate %.

6406 of 9181 relevant lines covered (69.77%)

3.08 hits per line

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

0.0
cli/src/main/java/com/devonfw/tools/ide/io/HttpErrorResponse.java
1
package com.devonfw.tools.ide.io;
2

3
import java.net.URI;
4
import java.net.http.HttpClient.Version;
5
import java.net.http.HttpHeaders;
6
import java.net.http.HttpRequest;
7
import java.net.http.HttpResponse;
8
import java.util.Collections;
9
import java.util.Optional;
10
import javax.net.ssl.SSLSession;
11

12
/**
13
 * Implementation of {@link HttpResponse} in case of an {@link Throwable error} to prevent sub-sequent {@link NullPointerException}s.
14
 */
15
public class HttpErrorResponse implements HttpResponse<Throwable> {
16

17
  private final Throwable error;
18

19
  private final HttpRequest request;
20

21
  private final URI uri;
22
  private static final HttpHeaders NO_HEADERS = HttpHeaders.of(Collections.emptyMap(), (x, y) -> true);
×
23

24
  /**
25
   * @param error the {@link Throwable} that was preventing the HTTP request for {@link #body()}.
26
   * @param request the {@link HttpRequest} for {@link #request()}.
27
   * @param uri the {@link URI} for {@link #uri()}.
28
   */
29
  public HttpErrorResponse(Throwable error, HttpRequest request, URI uri) {
30
    super();
×
31
    this.error = error;
×
32
    this.request = request;
×
33
    this.uri = uri;
×
34
  }
×
35

36
  @Override
37
  public int statusCode() {
38
    return -1;
×
39
  }
40

41
  @Override
42
  public HttpRequest request() {
43
    return this.request;
×
44
  }
45

46
  @Override
47
  public Optional<HttpResponse<Throwable>> previousResponse() {
48
    return Optional.empty();
×
49
  }
50

51
  @Override
52
  public HttpHeaders headers() {
53
    return NO_HEADERS;
×
54
  }
55

56
  @Override
57
  public Throwable body() {
58
    return this.error;
×
59
  }
60

61
  @Override
62
  public Optional<SSLSession> sslSession() {
63
    return Optional.empty();
×
64
  }
65

66
  @Override
67
  public URI uri() {
68
    return this.uri;
×
69
  }
70

71
  @Override
72
  public Version version() {
73
    return Version.HTTP_2;
×
74
  }
75
}
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