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

Checksum for boxes #8

Merged
merged 11 commits into from
Jul 7, 2017
Merged

Checksum for boxes #8

merged 11 commits into from
Jul 7, 2017

Conversation

vtelensky
Copy link
Collaborator

No description provided.

@vtelensky vtelensky requested a review from sparkoo July 3, 2017 15:24

import java.io.File;

public class BlankHashService implements HashService{
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename to NoopHashService


@Override
public boolean equals(Object obj) {
return true;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not correct


public interface HashService {
String getHashType();
String getChecksum(File file);
Copy link
Owner

@sparkoo sparkoo Jul 3, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Argument should not be File. For example when we save hashes to database and get them from there.
So maybe make parameter as generic type and implementation DigestHashService should type it as File and should be renamed to DigestFileHashService? Or something that would ensure better extensibility than this.


public class HashServiceFactory {

public HashService createHashService(String algorithm) throws NoSuchAlgorithmException {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To simplify, this can be static method in DigestHashService

@vtelensky
Copy link
Collaborator Author

All comments should be fixed.

bytes = getByteArrayFromFile(file);
} catch (IOException e) {
LOG.error("Error during processing file [{}], message: [{}]", file, e.getMessage());
return "";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably should be null

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or maybe throw exception

@sparkoo
Copy link
Owner

sparkoo commented Jul 7, 2017

ok, thanks!

@sparkoo sparkoo merged commit 01dd809 into sparkoo:devel Jul 7, 2017
@sparkoo sparkoo mentioned this pull request Jul 7, 2017
This pull request was closed.
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 this pull request may close these issues.

2 participants