1313import okhttp3 .*;
1414
1515import java .io .IOException ;
16- import java .io .PrintStream ;
1716import java .util .Arrays ;
1817import java .util .HashMap ;
1918import java .util .Map ;
2019
21- import static com .browserstack .automate .ci .common .logger .PluginLogger .log ;
22- import static com .browserstack .automate .ci .common .logger .PluginLogger .logError ;
23-
2420public class BrowserStackTestReportAction implements Action {
2521
2622 private static final String DEFAULT_REPORT_TIMEOUT = "120" ;
@@ -31,8 +27,6 @@ public class BrowserStackTestReportAction implements Action {
3127 private static final String RATE_LIMIT = "RATE_LIMIT" ;
3228 private static final String TEST_AVAILABLE = "TEST_AVAILABLE" ;
3329 private static final int MAX_ATTEMPTS = 3 ;
34-
35- private final transient PrintStream logger ;
3630 private final RequestsUtil requestsUtil ;
3731 private final BrowserStackCredentials credentials ;
3832 private final String buildName ;
@@ -44,12 +38,11 @@ public class BrowserStackTestReportAction implements Action {
4438 private String reportStatus ;
4539 private int maxRetryReportAttempt ;
4640
47- public BrowserStackTestReportAction (Run <?, ?> run , BrowserStackCredentials credentials , String buildName , String buildCreatedAt , final PrintStream logger ) {
41+ public BrowserStackTestReportAction (Run <?, ?> run , BrowserStackCredentials credentials , String buildName , String buildCreatedAt ) {
4842 this .run = run ;
4943 this .credentials = credentials ;
5044 this .buildName = buildName ;
5145 this .buildCreatedAt = buildCreatedAt ;
52- this .logger = logger ;
5346 this .requestsUtil = new RequestsUtil ();
5447 this .reportHtml = null ;
5548 this .reportStyle = "" ;
@@ -82,7 +75,6 @@ private void fetchReport() {
8275 String reportUrl = Constants .CAD_BASE_URL + Constants .BROWSERSTACK_CONFIG_DETAILS_ENDPOINT ;
8376
8477 try {
85- log (logger , "Fetching BrowserStack report..." );
8678 Response response = requestsUtil .makeRequest (reportUrl , credentials , createRequestBody (params ));
8779 handleResponse (response );
8880 } catch (Exception e ) {
@@ -119,7 +111,6 @@ private void handleResponse(Response response) throws Exception {
119111 reportStatus = RATE_LIMIT ;
120112 } else {
121113 reportStatus = REPORT_FAILED ;
122- logError (logger , "Non-success response while fetching report: " + response .code ());
123114 }
124115 }
125116 }
@@ -163,7 +154,7 @@ private void setReportSuccess(JSONObject report) {
163154 ArtifactArchiver artifactArchiver = getArtifactArchiver (workspace , fullHtml );
164155 artifactArchiver .perform (run , workspace , new EnvVars (), null , TaskListener .NULL );
165156 } catch (Exception e ) {
166- logError ( logger , "Failed to save or archive report artifact: " + e . getMessage ());
157+ //do nothing, as we don't want to fail the build if archiving fails
167158 }
168159 }
169160
@@ -188,7 +179,6 @@ private void handleFetchException(Exception e) {
188179 if (maxRetryReportAttempt < 0 ) {
189180 reportStatus = REPORT_FAILED ;
190181 }
191- logError (logger , "Exception while fetching the report: " + Arrays .toString (e .getStackTrace ()));
192182 }
193183
194184 public boolean isReportInProgress () {
0 commit comments