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

smartsheet / smartsheet-java-sdk / #44

25 Aug 2023 05:39PM UTC coverage: 50.55% (+0.1%) from 50.427%
#44

push

github-actions

web-flow
Fix remaining Checkstyle violations and Enable Checkstyle (#58)

* Fix remaining Checkstyle violations and Enable Checkstyle

We are now down to `20` checkstyle violations in main and `0` violations in test.

The remaining 20 violations are not trivial to fix, so I've set checkstyle to allow those 20 violations to exist, but to fail the build if we ever exceed 20 violations. This should make the build fail if any new violations are added.

For tests, we do not allow _any_ violations. This means adding a single violation will fail the build. Once the 20 violations in main are cleaned up, we can make main and test have the same config.

Note: This MR also changes our PR pipeline to run `./gradlew clean build` instead of `./gradlew clean test`. The reason for this is that build runs all the tests and performs all the other checks (such as checkstyle), whereas `test` didn't run checkstyle and we wouldn't have noticed violations until we tried to deploy.

148 of 148 new or added lines in 24 files covered. (100.0%)

3448 of 6821 relevant lines covered (50.55%)

0.51 hits per line

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

75.0
/src/main/java/com/smartsheet/api/SmartsheetRestException.java
1
package com.smartsheet.api;
2

3
/*
4
 * #[license]
5
 * Smartsheet SDK for Java
6
 * %%
7
 * Copyright (C) 2023 Smartsheet
8
 * %%
9
 * Licensed under the Apache License, Version 2.0 (the "License");
10
 * you may not use this file except in compliance with the License.
11
 * You may obtain a copy of the License at
12
 *
13
 *      http://www.apache.org/licenses/LICENSE-2.0
14
 *
15
 * Unless required by applicable law or agreed to in writing, software
16
 * distributed under the License is distributed on an "AS IS" BASIS,
17
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
 * See the License for the specific language governing permissions and
19
 * limitations under the License.
20
 * %[license]
21
 */
22

23
import com.smartsheet.api.models.Error;
24

25
/**
26
 * <p>This is the exception to indicate errors (Error objects of Smartsheet REST API) returned from Smartsheet REST API.</p>
27
 *
28
 * <p>Thread safety: Exceptions are not thread safe.</p>
29
 */
30
public class SmartsheetRestException extends SmartsheetException {
31

32
    /** The Constant serialVersionUID. */
33
    private static final long serialVersionUID = 1L;
34
    /**
35
     * <p>Represents the error code.</p>
36
     *
37
     * <p>It will be initialized in constructor and will not change afterwards.</p>
38
     */
39
    private final int errorCode;
40

41
    /**
42
     *     <p>Represents the reference ID.</p>
43
     *
44
     *     <p>It will be initialized in the constructor and will not change afterwards.</p>
45
     */
46
    private final String refId;
47

48
    /**
49
     *      <p>Represents any error detail provided by the API</p>
50
     *
51
     *     <p>It will be initialized in the constructor and will not change afterwards.</p>
52
     */
53
    private final Object detail;
54

55
    /**
56
     * <p>Constructor.</p>
57
     *
58
     * @param error the Error object from Smartsheet REST API
59
     */
60
    public SmartsheetRestException(Error error) {
61
        super(error.getMessage());
1✔
62
        errorCode = error.getErrorCode();
1✔
63
        refId = error.getRefId();
1✔
64
        detail = error.getDetail();
1✔
65
    }
1✔
66

67
    /**
68
     * <p>Returns the error code.</p>
69
     *
70
     * @return the error code
71
     */
72
    public int getErrorCode() {
73
        return this.errorCode;
1✔
74
    }
75

76
    /**
77
     * <p>Retruns the refId.</p>
78
     *
79
     * @return the refId
80
     */
81
    public String getRefId() {
82
        return this.refId;
×
83
    }
84

85
    /**
86
     * <p>Returns the error detail</p>
87
     *
88
     * @return the error detail
89
     */
90
    public Object getDetail() {
91
        return this.detail;
×
92
    }
93
}
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