stackroute / ibm-wave3-ontrack-hackathon

Other
0 stars 0 forks source link

improper usage of methods and exceptions #71

Open cprakashb opened 5 years ago

cprakashb commented 5 years ago

@Override public Products saveProduct(Products products) throws ProductAlreadyExistsException {

     if(productRepository.existsById(products.getProductId())){
         throw new ProductAlreadyExistsException("Products already exists");
     }
    Products savedProducts = productRepository.save(products);
     if(savedProducts ==null){
         throw new ProductAlreadyExistsException("Products already exist");
     }
    return savedProducts;
}