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

jreleaser / jreleaser / #374

26 Apr 2024 03:38PM UTC coverage: 7.953% (-41.9%) from 49.841%
#374

push

github

aalmiray
build: Update JDK settings

3806 of 47855 relevant lines covered (7.95%)

0.08 hits per line

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

0.0
/sdks/jreleaser-nexus2-java-sdk/src/main/java/org/jreleaser/sdk/nexus2/api/NexusAPIException.java
1
/*
2
 * SPDX-License-Identifier: Apache-2.0
3
 *
4
 * Copyright 2020-2024 The JReleaser authors.
5
 *
6
 * Licensed under the Apache License, Version 2.0 (the "License");
7
 * you may not use this file except in compliance with the License.
8
 * You may obtain a copy of the License at
9
 *
10
 *     https://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 * Unless required by applicable law or agreed to in writing, software
13
 * distributed under the License is distributed on an "AS IS" BASIS,
14
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
 * See the License for the specific language governing permissions and
16
 * limitations under the License.
17
 */
18
package org.jreleaser.sdk.nexus2.api;
19

20
import java.util.Collection;
21
import java.util.Collections;
22
import java.util.Map;
23

24
/**
25
 * @author Andres Almiray
26
 * @since 1.3.0
27
 */
28
public class NexusAPIException extends RuntimeException {
29
    private static final long serialVersionUID = -6684289853549902181L;
30

31
    private final int status;
32
    private final String reason;
33
    private final Map<String, Collection<String>> headers;
34

35
    public NexusAPIException(int status, String reason) {
36
        this(status, reason, Collections.emptyMap());
×
37
    }
×
38

39
    public NexusAPIException(int status, String reason, Map<String, Collection<String>> headers) {
40
        super(status + ": " + reason);
×
41
        this.status = status;
×
42
        this.reason = reason;
×
43
        this.headers = headers;
×
44
    }
×
45

46
    public int getStatus() {
47
        return status;
×
48
    }
49

50
    public String getReason() {
51
        return reason;
×
52
    }
53

54
    public Map<String, Collection<String>> getHeaders() {
55
        return headers;
×
56
    }
57

58
    public boolean isNotFound() {
59
        return 404 == status;
×
60
    }
61

62
    public boolean isForbidden() {
63
        return 403 == status;
×
64
    }
65

66
    public boolean isUnauthorized() {
67
        return 401 == status;
×
68
    }
69
}
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