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

Serialization and resource leak warnings #6

Open
boughtonp opened this issue May 11, 2020 · 1 comment
Open

Serialization and resource leak warnings #6

boughtonp opened this issue May 11, 2020 · 1 comment

Comments

@boughtonp
Copy link

Eclipse is reporting a bunch of serialization and resource leak warnings.

There are 7 instances of "The serializable class [classname] does not declare a static final serialVersionUID field of type long" across various classes.

There are also 38 instances of "Resource leak: [something] is never closed" (all in ByteArrayImplTest.java)

Should these be resolved, or ignored with @SuppressWarnings("serial") and @SuppressWarnings("resource") ?

@xplatform-dev
Copy link

None of the classes implement Serializable. None of these classes should have their objects written to the disk. If you were to write a HasherImpl object to the disk, you would defeat the purpose of hashing the algorithm and may as well just store the password in plain text. Configure your IDE to ignore this - most real world applications don't use serialization anyways, they'll use databases.

The streams that are not being closed are because they are being passed as arguments. If you close that stream, you will have a hard time reinstating it. Example below.

Scanner kb = new Scanner(System.in);
foo(kb);
System.out.println(kb.nextLine());
...
void foo(Scanner s) { s.close(); }

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

2 participants