mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-22 07:15:49 +00:00
Fixed local variable class name shadow rule violation
Local variables should not shadow class fields [RSPEC-1117](https://rules.sonarsource.com/java/RSPEC-1117)
This commit is contained in:
parent
ee7c68ff3b
commit
5bc54c8341
1 changed files with 4 additions and 4 deletions
|
@ -30,10 +30,10 @@ import java.util.Map;
|
||||||
@Controller
|
@Controller
|
||||||
class VetController {
|
class VetController {
|
||||||
|
|
||||||
private final VetRepository vets;
|
private final VetRepository vetRepository;
|
||||||
|
|
||||||
public VetController(VetRepository clinicService) {
|
public VetController(VetRepository clinicService) {
|
||||||
this.vets = clinicService;
|
this.vetRepository = clinicService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/vets.html")
|
@GetMapping("/vets.html")
|
||||||
|
@ -41,7 +41,7 @@ class VetController {
|
||||||
// Here we are returning an object of type 'Vets' rather than a collection of Vet
|
// Here we are returning an object of type 'Vets' rather than a collection of Vet
|
||||||
// objects so it is simpler for Object-Xml mapping
|
// objects so it is simpler for Object-Xml mapping
|
||||||
Vets vets = new Vets();
|
Vets vets = new Vets();
|
||||||
vets.getVetList().addAll(this.vets.findAll());
|
vets.getVetList().addAll(this.vetRepository.findAll());
|
||||||
model.put("vets", vets);
|
model.put("vets", vets);
|
||||||
return "vets/vetList";
|
return "vets/vetList";
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ class VetController {
|
||||||
// Here we are returning an object of type 'Vets' rather than a collection of Vet
|
// Here we are returning an object of type 'Vets' rather than a collection of Vet
|
||||||
// objects so it is simpler for JSon/Object mapping
|
// objects so it is simpler for JSon/Object mapping
|
||||||
Vets vets = new Vets();
|
Vets vets = new Vets();
|
||||||
vets.getVetList().addAll(this.vets.findAll());
|
vets.getVetList().addAll(this.vetRepository.findAll());
|
||||||
return vets;
|
return vets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue