Project

General

Profile

« Previous | Next » 

Revision 61687

catching email exceptions

View differences:

modules/uoa-repository-manager-service/branches/springboot/src/main/java/eu/dnetlib/repo/manager/service/RepositoryServiceImpl.java
585 585
                , ResponseEntity.class);
586 586

  
587 587
        if (responseEntity.getStatusCode().equals(HttpStatus.OK)) {
588
            emailUtils.sendUserUpdateRepositoryInfoEmail(repository, authentication);
589
            emailUtils.sendAdminUpdateRepositoryInfoEmail(repository, authentication);
588
            try {
589
                emailUtils.sendUserUpdateRepositoryInfoEmail(repository, authentication);
590
                emailUtils.sendAdminUpdateRepositoryInfoEmail(repository, authentication);
591
            } catch (Exception e) {
592
                LOGGER.error("Error sending emails: " + e);
593
            }
590 594
        } else
591 595
            LOGGER.debug(responseEntity.getBody().toString());
592 596

  
......
610 614
        ResponseEntity responseEntity = restTemplate.exchange(uriComponents.toUri(), HttpMethod.POST, httpEntity, ResponseEntity.class);
611 615

  
612 616
        if (responseEntity.getStatusCode().equals(HttpStatus.OK)) {
613
            emailUtils.sendUserRegistrationEmail(repository, authentication);
614
            emailUtils.sendAdminRegistrationEmail(repository, authentication);
617
            try {
618
                emailUtils.sendUserRegistrationEmail(repository, authentication);
619
                emailUtils.sendAdminRegistrationEmail(repository, authentication);
620
            } catch (Exception e) {
621
                LOGGER.error("Error sending emails: " + e);
622
            }
615 623
        } else {
616 624
            LOGGER.debug(responseEntity.getBody().toString());
617 625
        }
......
646 654

  
647 655
        restTemplate.postForObject(uriComponents.toUri(), httpEntity, String.class);
648 656

  
649
        emailUtils.sendAdminRegisterInterfaceEmail(e, comment, repositoryInterface, SecurityContextHolder.getContext().getAuthentication());
650
        emailUtils.sendUserRegisterInterfaceEmail(e, comment, repositoryInterface, SecurityContextHolder.getContext().getAuthentication());
657
        try {
658
            emailUtils.sendAdminRegisterInterfaceEmail(e, comment, repositoryInterface, SecurityContextHolder.getContext().getAuthentication());
659
            emailUtils.sendUserRegisterInterfaceEmail(e, comment, repositoryInterface, SecurityContextHolder.getContext().getAuthentication());
660
        } catch (Exception e) {
661
            LOGGER.error("Error sending emails: " + e);
662
        }
651 663

  
652 664
        submitInterfaceValidation(e, registeredBy, repositoryInterface, false);
653 665

  
......
665 677

  
666 678
        Repository repository = this.getRepositoryById(repoId);
667 679
        try {
668
            emailUtils.sendAdminUpdateInterfaceEmail(repository, comment, repositoryInterface, SecurityContextHolder.getContext().getAuthentication());
669
            emailUtils.sendUserUpdateInterfaceEmail(repository, comment, repositoryInterface, SecurityContextHolder.getContext().getAuthentication());
680
            try {
681
                emailUtils.sendAdminUpdateInterfaceEmail(repository, comment, repositoryInterface, SecurityContextHolder.getContext().getAuthentication());
682
                emailUtils.sendUserUpdateInterfaceEmail(repository, comment, repositoryInterface, SecurityContextHolder.getContext().getAuthentication());
683
            } catch (Exception e) {
684
                LOGGER.error("Error sending emails: " + e);
685
            }
670 686
        } catch (Exception e) {
671 687
            LOGGER.warn("Could not send emails", e);
672 688
        }

Also available in: Unified diff