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

What to do if null? #36

Open
HelgeStenstrom opened this issue Sep 8, 2019 · 1 comment
Open

What to do if null? #36

HelgeStenstrom opened this issue Sep 8, 2019 · 1 comment
Labels
improvement Refactorings and internal structure improvements question

Comments

@HelgeStenstrom
Copy link
Collaborator

Why is this test for nullity there?

If sourceDataLine is null, the whole method openLine() does nothing, silently. Isn't that an error condition? Isn't it better to let a NullPointerException happen, and fix the bug so that it doesn't happen again?

I think it would be a good idea to make a wrapper class on SourceDataLine, where you are guaranteed that the sourceDataLine is not null. Then you don't need this kind of tests.

@HelgeStenstrom HelgeStenstrom added question improvement Refactorings and internal structure improvements labels Sep 8, 2019
@goxr3plus
Copy link
Owner

You are so right, i haven't thought about it, actually it can throw a LIneUnavailable exception which now it doesn't, please proceed showing me your idea i think you are very right!!! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Refactorings and internal structure improvements question
Projects
None yet
Development

No branches or pull requests

2 participants