• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

SimplyVanilla / SimplyPerms / #18

11 Mar 2024 09:36PM UTC coverage: 26.178% (-2.1%) from 28.261%
#18

push

github

web-flow
Fix velocity crash #3 (#10)

* Fixed [Velocity crash](https://gist.github.com/Netherwhal/5e37bd8a1656dbb9ac8cc88530144a65) happening when users in list are null

* Added forced stack trace to individuate error on Velocity restart

* Removed internal static list and reworked constructor

* Created UsersManager to keep track of loaded users

* Added usersManager field

* Added addUser method

* Updated some methods to use users manager

* Updated to use users manager to retrieve users

* Updated SimplePermProvider

1 of 24 new or added lines in 4 files covered. (4.17%)

1 existing line in 1 file now uncovered.

50 of 191 relevant lines covered (26.18%)

0.26 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/java/net/simplyvanilla/simplyperms/users/UsersManager.java
1
package net.simplyvanilla.simplyperms.users;
2

3
import java.util.LinkedList;
4
import java.util.List;
5
import java.util.Objects;
6
import java.util.UUID;
7

8
public class UsersManager {
9
    private final List<User> users;
10

NEW
11
    public UsersManager() {
×
NEW
12
        this.users = new LinkedList<>();
×
NEW
13
    }
×
14

15
    public void addUser(User user) {
NEW
16
        this.users.add(user);
×
NEW
17
    }
×
18

19
    public User getUser(final UUID uniqueId) {
NEW
20
        return uniqueId == null ? null : getUsers().stream()
×
NEW
21
            .filter(g -> g.getUniqueId().equals(uniqueId))
×
NEW
22
            .findFirst().orElseGet(() -> new User(uniqueId.toString()));
×
23
    }
24

25
    public List<User> getUsers() {
NEW
26
        this.users.removeIf(Objects::isNull);
×
NEW
27
        return new LinkedList<>(this.users);
×
28
    }
29

30
    public void clearUsers() {
NEW
31
        this.users.clear();
×
NEW
32
    }
×
33
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc