Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

javarush internshp #1

Open
DieselLearns opened this issue May 22, 2022 · 2 comments
Open

javarush internshp #1

DieselLearns opened this issue May 22, 2022 · 2 comments

Comments

@DieselLearns
Copy link

Hi!
After creating a new player I can't edit this player (with default players there is no such problem)
I receive such error "Not found GET /rpg_war_exploded/rest/players/43"
If you have time I would be very grateful if you answer me.
Thanks!

@DieselLearns
Copy link
Author

The issue was solved by creating new DB....

@DieselLearns
Copy link
Author

DieselLearns commented Jul 6, 2022

The issue is still present. I found a bug in PlayerValidationService.java
line 101. If id value more then players in DB it throws an Exception. For example i have 38 players in my DB and i can't delete player whos id is 39 or 40 etc.

public void validateId(Long id) {
        if (id <= 0) {
            throw new InvalidIdException();
        } else if (id > playerRepository.count() || !playerRepository.findById(id).isPresent()) {  //here
            throw new NoSuchPlayerException();
        }
    `}`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant