@@ -307,12 +307,7 @@ public List<Build> getBuilds(final BuildStatus status, final int limit, final St
307
307
httpRequest .queryString (Constants .Filter .BUILD_NAME , buildName );
308
308
}
309
309
310
- final List <BuildNode > buildNodes ;
311
- try {
312
- buildNodes = Arrays .asList (httpRequest .asObject (BuildNode [].class ));
313
- } catch (BrowserStackException e ) {
314
- throw e ;
315
- }
310
+ final List <BuildNode > buildNodes = Arrays .asList (httpRequest .asObject (BuildNode [].class ));
316
311
317
312
final List <Build > builds = new ArrayList <Build >();
318
313
for (BuildNode buildNode : buildNodes ) {
@@ -405,8 +400,6 @@ public Build getBuild(final String buildId) throws BuildNotFound, BrowserStackEx
405
400
return buildNode .getBuild ().setClient (this );
406
401
} catch (BrowserStackObjectNotFound e ) {
407
402
throw new BuildNotFound ("Build not found: " + buildId );
408
- } catch (BrowserStackException e ) {
409
- throw e ;
410
403
}
411
404
}
412
405
@@ -419,15 +412,11 @@ public Build getBuild(final String buildId) throws BuildNotFound, BrowserStackEx
419
412
* @throws BrowserStackException
420
413
*/
421
414
public Build getBuildByName (@ Nonnull final String buildName ) throws BuildNotFound , BrowserStackException {
422
- try {
423
- final List <Build > build = getBuilds (null , 1 , buildName );
424
- if (build .size () == 1 ) {
425
- return build .get (0 );
426
- }
427
- throw new BuildNotFound ("Build not found by name: " + buildName );
428
- } catch (BrowserStackException e ) {
429
- throw e ;
415
+ final List <Build > build = getBuilds (null , 1 , buildName );
416
+ if (build .size () == 1 ) {
417
+ return build .get (0 );
430
418
}
419
+ throw new BuildNotFound ("Build not found by name: " + buildName );
431
420
}
432
421
433
422
/**
@@ -438,15 +427,11 @@ public Build getBuildByName(@Nonnull final String buildName) throws BuildNotFoun
438
427
* @throws BrowserStackException
439
428
*/
440
429
public boolean deleteBuild (final String buildId ) throws BrowserStackException {
441
- try {
442
- ObjectNode result = newRequest (BrowserStackClient .Method .DELETE , "/builds/{buildId}.json" )
443
- .routeParam ("buildId" , buildId ).asJsonObject ();
430
+ ObjectNode result = newRequest (Method .DELETE , "/builds/{buildId}.json" )
431
+ .routeParam ("buildId" , buildId ).asJsonObject ();
444
432
445
- String status = (result != null ) ? result .path ("status" ).asText () : null ;
446
- return (status != null && status .equals ("ok" ));
447
- } catch (BrowserStackException e ) {
448
- throw e ;
449
- }
433
+ String status = (result != null ) ? result .path ("status" ).asText () : null ;
434
+ return (status != null && status .equals ("ok" ));
450
435
}
451
436
452
437
/**
@@ -497,13 +482,8 @@ public List<Session> getSessions(final String buildId, final BuildStatus status,
497
482
}
498
483
499
484
private List <SessionNode > getSessionNodes (String buildId , BuildStatus status , int totalLimit , int offset ) throws BrowserStackException {
500
- BrowserStackRequest httpRequest ;
501
- try {
502
- httpRequest =
503
- newRequest (Method .GET , "/builds/{buildId}/sessions.json" ).routeParam ("buildId" , buildId );
504
- } catch (BrowserStackException e ) {
505
- throw e ;
506
- }
485
+ BrowserStackRequest httpRequest = newRequest (Method .GET , "/builds/{buildId}/sessions.json" ).routeParam (
486
+ "buildId" , buildId );
507
487
508
488
httpRequest .queryString (Constants .Filter .LIMIT , totalLimit );
509
489
httpRequest .queryString (Constants .Filter .OFFSET , offset );
@@ -517,8 +497,6 @@ private List<SessionNode> getSessionNodes(String buildId, BuildStatus status, in
517
497
sessionNodes = Arrays .asList (httpRequest .asObject (SessionNode [].class ));
518
498
} catch (BrowserStackObjectNotFound e ) {
519
499
throw new BuildNotFound ("Build not found: " + buildId );
520
- } catch (BrowserStackException e ) {
521
- throw e ;
522
500
}
523
501
return sessionNodes ;
524
502
}
@@ -583,8 +561,6 @@ public Session getSession(String sessionId) throws SessionNotFound, BrowserStack
583
561
return sessionNode .getSession ().setClient (this );
584
562
} catch (BrowserStackObjectNotFound e ) {
585
563
throw new SessionNotFound ("Session not found: " + sessionId );
586
- } catch (BrowserStackException e ) {
587
- throw e ;
588
564
}
589
565
}
590
566
0 commit comments