Skip to content

[BUG] Vets object created but never added to model in VetController#showVetList #2333

@Fran-narang

Description

@Fran-narang

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions