In VetController.java, inside the showVetList method, a Vets object is created and populated but never added to the Spring model. It appears to be dead/unused code.
Affected file
src/main/java/org/springframework/samples/petclinic/vet/VetController.java
Code in question
Vets vets = new Vets();
Page<Vet> paginated = findPaginated(page);
vets.getVetList().addAll(paginated.toList());
return addPaginationModel(page, paginated, model);
The vets object is populated but never passed to addPaginationModel
or added to the model directly. Only paginated is used going forward.
Expected behavior
Either the Vets object should be removed entirely (since pagination
is handled via paginated), or it should be intentionally added to
the model if needed.
Additionally
No test currently catches this unused object
This may be leftover code from a refactor.
Would you like me to fix this?
I'd be happy to submit a PR with a fix if maintainers confirm this is
indeed dead code. Please let me know!
In
VetController.java, inside theshowVetListmethod, aVetsobject is created and populated but never added to the Spring model. It appears to be dead/unused code.Affected file
src/main/java/org/springframework/samples/petclinic/vet/VetController.javaCode in question