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

NPE for IBAN with country code #767

Open
manosbatsis opened this issue Oct 26, 2023 · 2 comments · May be fixed by #768
Open

NPE for IBAN with country code #767

manosbatsis opened this issue Oct 26, 2023 · 2 comments · May be fixed by #768

Comments

@manosbatsis
Copy link

Trying to get an IBAN using a country code provided by Faker itself results to a null pointer, e.g.

faker.finance().iban(faker.country().countryCode2())

Gives:

java.lang.NullPointerException: Cannot invoke "String.length()" because "str" is null
        at java.base/java.lang.AbstractStringBuilder.<init>(AbstractStringBuilder.java:105) ~[na:na]
        at java.base/java.lang.StringBuilder.<init>(StringBuilder.java:131) ~[na:na]
        at com.mifmif.common.regex.Generex.requote(Generex.java:417) ~[generex-1.0.2.jar:1.0.2]
        at com.mifmif.common.regex.Generex.<init>(Generex.java:84) ~[generex-1.0.2.jar:1.0.2]
        at com.mifmif.common.regex.Generex.<init>(Generex.java:76) ~[generex-1.0.2.jar:1.0.2]
        at com.github.javafaker.service.FakeValuesService.regexify(FakeValuesService.java:252) ~[javafaker-1.0.2.jar:na]
        at com.github.javafaker.Faker.regexify(Faker.java:310) ~[javafaker-1.0.2.jar:na]
        at com.github.javafaker.Finance.iban(Finance.java:64) ~[javafaker-1.0.2.jar:na]

Versions:

  • JDK Runtime Environment (build 17.0.8.1+1-Ubuntu-0ubuntu122.04)
  • Faker Version 1.0.2
@manosbatsis
Copy link
Author

manosbatsis commented Oct 27, 2023

My suggestion would be to make Finance.countryCodeToBasicBankAccountNumberPattern public or add a method to access it's keys so they can be used for random selection of a country scope.

manosbatsis added a commit to manosbatsis/java-faker that referenced this issue Oct 27, 2023
@manosbatsis manosbatsis linked a pull request Oct 27, 2023 that will close this issue
@bodiam
Copy link

bodiam commented Oct 27, 2023

@manosbatsis this issue has been fixed in Datafaker, an active fork of Javafaker: https://github.com/datafaker-net/datafaker

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

Successfully merging a pull request may close this issue.

2 participants