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

box / box-java-sdk / #5027

03 Oct 2025 09:45AM UTC coverage: 13.656% (-0.008%) from 13.664%
#5027

Pull #1478

github

web-flow
Merge 7e3e09ba8 into ac7d3d5fe
Pull Request #1478: fix: Make `role` parameter of update collaboration optional (box/box-openapi#557)

0 of 4 new or added lines in 2 files covered. (0.0%)

15 existing lines in 9 files now uncovered.

8368 of 61275 relevant lines covered (13.66%)

0.14 hits per line

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

0.0
/src/main/java/com/box/sdkgen/box/errors/ResponseInfo.java
1
package com.box.sdkgen.box.errors;
2

3
import com.box.sdkgen.internal.logging.DataSanitizer;
4
import com.box.sdkgen.networking.fetchresponse.FetchResponse;
5
import com.fasterxml.jackson.databind.JsonNode;
6
import java.util.Map;
7

8
public class ResponseInfo {
9

10
  public final int statusCode;
11

12
  public final Map<String, String> headers;
13

14
  public JsonNode body;
15

16
  public String rawBody;
17

18
  public String code;
19

20
  public JsonNode contextInfo;
21

22
  public String requestId;
23

24
  public String helpUrl;
25

26
  public ResponseInfo(int statusCode, Map<String, String> headers) {
×
27
    this.statusCode = statusCode;
×
28
    this.headers = headers;
×
29
  }
×
30

31
  protected ResponseInfo(Builder builder) {
×
32
    this.statusCode = builder.statusCode;
×
33
    this.headers = builder.headers;
×
34
    this.body = builder.body;
×
35
    this.rawBody = builder.rawBody;
×
36
    this.code = builder.code;
×
37
    this.contextInfo = builder.contextInfo;
×
38
    this.requestId = builder.requestId;
×
39
    this.helpUrl = builder.helpUrl;
×
40
  }
×
41

42
  public int getStatusCode() {
43
    return statusCode;
×
44
  }
45

46
  public Map<String, String> getHeaders() {
47
    return headers;
×
48
  }
49

50
  public JsonNode getBody() {
51
    return body;
×
52
  }
53

54
  public String getRawBody() {
55
    return rawBody;
×
56
  }
57

58
  public String getCode() {
59
    return code;
×
60
  }
61

62
  public JsonNode getContextInfo() {
63
    return contextInfo;
×
64
  }
65

66
  public String getRequestId() {
67
    return requestId;
×
68
  }
69

70
  public String getHelpUrl() {
71
    return helpUrl;
×
72
  }
73

74
  public static class Builder {
75

76
    protected final int statusCode;
77

78
    protected final Map<String, String> headers;
79

80
    protected JsonNode body;
81

82
    protected String rawBody;
83

84
    protected String code;
85

86
    protected JsonNode contextInfo;
87

88
    protected String requestId;
89

90
    protected String helpUrl;
91

92
    public Builder(int statusCode, Map<String, String> headers) {
×
93
      this.statusCode = statusCode;
×
94
      this.headers = headers;
×
95
    }
×
96

97
    public Builder body(JsonNode body) {
98
      this.body = body;
×
99
      return this;
×
100
    }
101

102
    public Builder rawBody(String rawBody) {
103
      this.rawBody = rawBody;
×
104
      return this;
×
105
    }
106

107
    public Builder code(String code) {
108
      this.code = code;
×
109
      return this;
×
110
    }
111

112
    public Builder contextInfo(JsonNode contextInfo) {
113
      this.contextInfo = contextInfo;
×
114
      return this;
×
115
    }
116

117
    public Builder requestId(String requestId) {
118
      this.requestId = requestId;
×
119
      return this;
×
120
    }
121

122
    public Builder helpUrl(String helpUrl) {
123
      this.helpUrl = helpUrl;
×
124
      return this;
×
125
    }
126

127
    public ResponseInfo build() {
128
      return new ResponseInfo(this);
×
129
    }
130
  }
131

132
  public static ResponseInfo fromResponse(FetchResponse fetchResponse, String rawResponseBody) {
133
    Builder builder = new Builder(fetchResponse.getStatus(), fetchResponse.getHeaders());
×
134
    JsonNode body = fetchResponse.getData();
×
135
    if (body == null) {
×
136
      builder.rawBody(rawResponseBody);
×
137
    } else {
138
      builder
×
139
          .body(body)
×
140
          .rawBody(body.toString())
×
141
          .code(body.get("code") != null ? body.get("code").asText("") : null)
×
142
          .contextInfo(body.get("context_info") != null ? body.get("context_info") : null)
×
143
          .requestId(body.get("request_id") != null ? body.get("request_id").asText() : null)
×
144
          .helpUrl(body.get("help_url") != null ? body.get("help_url").asText() : null);
×
145
    }
146

147
    return builder.build();
×
148
  }
149

150
  String print(DataSanitizer dataSanitizer) {
UNCOV
151
    Map<String, String> sanitizedHeaders =
×
152
        dataSanitizer == null ? headers : dataSanitizer.sanitizeHeaders(headers);
×
153
    JsonNode sanitizedBody = dataSanitizer == null ? body : dataSanitizer.sanitizeBody(body);
×
154
    return "ResponseInfo{"
×
155
        + "\n\tstatusCode="
156
        + statusCode
157
        + ", \n\theaders="
158
        + sanitizedHeaders
159
        + ", \n\tbody="
160
        + sanitizedBody
161
        + ", \n\tcode='"
162
        + code
163
        + '\''
164
        + ", \n\tcontextInfo="
165
        + contextInfo
166
        + ", \n\trequestId='"
167
        + requestId
168
        + '\''
169
        + ", \n\thelpUrl='"
170
        + helpUrl
171
        + '\''
172
        + '}';
173
  }
174
}
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