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

nulab / zxcvbn4j / #141

pending completion
#141

push

github-actions

web-flow
Merge pull request #135 from manchilop/master

Added feedback messages translated into Spanish

1392 of 1507 relevant lines covered (92.37%)

0.92 hits per line

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

85.71
/src/main/java/com/nulabinc/zxcvbn/matchers/DictionaryLoader.java
1
package com.nulabinc.zxcvbn.matchers;
2

3
import com.nulabinc.zxcvbn.io.Resource;
4

5
import java.io.BufferedReader;
6
import java.io.IOException;
7
import java.io.InputStream;
8
import java.io.InputStreamReader;
9
import java.util.ArrayList;
10
import java.util.List;
11

12
public class DictionaryLoader {
13

14
    private final String name;
15

16
    private final Resource resource;
17

18
    public DictionaryLoader(final String name, final Resource resource) {
1✔
19
        this.name = name;
1✔
20
        this.resource = resource;
1✔
21
    }
1✔
22

23
    public Dictionary load() throws IOException {
24
        List<String> words = new ArrayList<>();
1✔
25
        // Reasons for not using StandardCharsets
26
        // refs: https://github.com/nulab/zxcvbn4j/issues/62
27
        try (final InputStream inputStream = resource.getInputStream();
1✔
28
             final InputStreamReader inputStreamReader = new InputStreamReader(inputStream, "UTF-8");
1✔
29
             final BufferedReader br = new BufferedReader(inputStreamReader)) {
1✔
30
            String line;
31
            while ((line = br.readLine()) != null) {
1✔
32
                words.add(line);
1✔
33
            }
34
        } catch (IOException e) {
×
35
            throw new RuntimeException("Error while reading " + name);
×
36
        }
1✔
37
        return new Dictionary(name, words);
1✔
38
    }
39
}
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