"throws" declarations should not be superfluous

a RuntimeException, or one of its descendants should not be declared in functions. DataAccessException is also a RuntimeException
[RSPEC-1130](https://rules.sonarsource.com/java/RSPEC-1130)
This commit is contained in:
Abhijay Kumar 2020-08-21 19:40:11 +05:30
parent 5bc54c8341
commit 0fab9fe4d7
2 changed files with 6 additions and 8 deletions

View file

@ -15,13 +15,12 @@
*/ */
package org.springframework.samples.petclinic.vet; package org.springframework.samples.petclinic.vet;
import java.util.Collection;
import org.springframework.cache.annotation.Cacheable; import org.springframework.cache.annotation.Cacheable;
import org.springframework.dao.DataAccessException;
import org.springframework.data.repository.Repository; import org.springframework.data.repository.Repository;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.Collection;
/** /**
* Repository class for <code>Vet</code> domain objects All method names are compliant * Repository class for <code>Vet</code> domain objects All method names are compliant
* with Spring Data naming conventions so this interface can easily be extended for Spring * with Spring Data naming conventions so this interface can easily be extended for Spring
@ -41,6 +40,6 @@ public interface VetRepository extends Repository<Vet, Integer> {
*/ */
@Transactional(readOnly = true) @Transactional(readOnly = true)
@Cacheable("vets") @Cacheable("vets")
Collection<Vet> findAll() throws DataAccessException; Collection<Vet> findAll();
} }

View file

@ -15,12 +15,11 @@
*/ */
package org.springframework.samples.petclinic.visit; package org.springframework.samples.petclinic.visit;
import java.util.List;
import org.springframework.dao.DataAccessException;
import org.springframework.data.repository.Repository; import org.springframework.data.repository.Repository;
import org.springframework.samples.petclinic.model.BaseEntity; import org.springframework.samples.petclinic.model.BaseEntity;
import java.util.List;
/** /**
* Repository class for <code>Visit</code> domain objects All method names are compliant * Repository class for <code>Visit</code> domain objects All method names are compliant
* with Spring Data naming conventions so this interface can easily be extended for Spring * with Spring Data naming conventions so this interface can easily be extended for Spring
@ -39,7 +38,7 @@ public interface VisitRepository extends Repository<Visit, Integer> {
* @param visit the <code>Visit</code> to save * @param visit the <code>Visit</code> to save
* @see BaseEntity#isNew * @see BaseEntity#isNew
*/ */
void save(Visit visit) throws DataAccessException; void save(Visit visit);
List<Visit> findByPetId(Integer petId); List<Visit> findByPetId(Integer petId);