-
Notifications
You must be signed in to change notification settings - Fork 4
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
Conversation
…ication, FileSystemBoxRepository modification and test modification.
|
||
import java.io.File; | ||
|
||
public class BlankHashService implements HashService{ |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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
… static, not including of null properties of BoxProvider to JSON
All comments should be fixed. |
bytes = getByteArrayFromFile(file); | ||
} catch (IOException e) { | ||
LOG.error("Error during processing file [{}], message: [{}]", file, e.getMessage()); | ||
return ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably should be null
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or maybe throw exception
…ethod when IOException is encountered
ok, thanks! |
No description provided.