-
Notifications
You must be signed in to change notification settings - Fork 14
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
Added functionality to choose checksum algorithm #63 #152
Conversation
@@ -152,8 +152,8 @@ public static void zip(Map<String, ZipEntryInfo> files, OutputStream out, SIP si | |||
} | |||
|
|||
LOGGER.debug("Done zipping file"); | |||
String checksum = checksums.get(IPConstants.CHECKSUM_ALGORITHM); | |||
String checksumType = IPConstants.CHECKSUM_ALGORITHM; | |||
String checksum = checksums.get(sip.getChecksum()); |
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.
Variable 'checksum' should be declared final.
String checksum = checksums.get(IPConstants.CHECKSUM_ALGORITHM); | ||
String checksumType = IPConstants.CHECKSUM_ALGORITHM; | ||
String checksum = checksums.get(sip.getChecksum()); | ||
String checksumType = sip.getChecksum(); |
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.
Variable 'checksumType' should be declared final.
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
import java.util.stream.Stream; | ||
import java.security.MessageDigest; |
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.
Wrong order for 'java.security.MessageDigest' import.
if (checksumAlg != null) { | ||
try { | ||
MessageDigest.getInstance(checksumAlg); | ||
} catch (NoSuchAlgorithmException e) { |
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.
Variable 'e' should be declared final.
@@ -187,11 +196,15 @@ public int start(final String[] args) { | |||
return ExitCodes.EXIT_CODE_CREATE_INVALID_PATHS; | |||
} | |||
|
|||
if(!SipCreatorUtils.validateChecksumAlg(checkSum)){ |
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.
'if' is not followed by whitespace.
@@ -187,11 +196,15 @@ public int start(final String[] args) { | |||
return ExitCodes.EXIT_CODE_CREATE_INVALID_PATHS; | |||
} | |||
|
|||
if(!SipCreatorUtils.validateChecksumAlg(checkSum)){ |
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.
'{' is not preceded with whitespace.
@@ -54,6 +54,8 @@ public abstract class IP implements IPInterface { | |||
|
|||
private ValidationReport validationReport; | |||
|
|||
private String checksumAlgorithm; |
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.
Missing a Javadoc comment.
@@ -65,6 +67,7 @@ public IP() { | |||
this.ancestors = new ArrayList<>(); | |||
|
|||
this.description = ""; | |||
this.checksumAlgorithm="SHA-256"; |
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.
'=' is not followed by whitespace.
@@ -65,6 +67,7 @@ public IP() { | |||
this.ancestors = new ArrayList<>(); | |||
|
|||
this.description = ""; | |||
this.checksumAlgorithm="SHA-256"; |
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.
'=' is not preceded with whitespace.
2562a86
to
d7cb934
Compare
@@ -187,11 +196,16 @@ public int start(final String[] args) { | |||
return ExitCodes.EXIT_CODE_CREATE_INVALID_PATHS; | |||
} | |||
|
|||
if(!SipCreatorUtils.validateChecksumAlg(checkSum)){ | |||
CLIUtils.printErrors(System.out, "Make sure that the checksum algorithm is valid. You can check the " + |
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.
'+' should be on a new line.
CHECKSUM_ALGORITHMS.md
Outdated
@@ -0,0 +1,16 @@ | |||
## Checksum Algorithms |
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.
File does not end with a newline.
CHECKSUM_ALGORITHMS.md
Outdated
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 should be moved to the Wiki instead of being a file in the repository
d7cb934
to
6eaa853
Compare
|
||
try { | ||
final Path eark2SIP = SipCreatorUtils.createEARK2SIP(metadataFile, metadataType, metadataVersion, | ||
representationData, targetOnly, representationType, representationID, sipID, ancestors, documentation, | ||
getClass().getPackage().getImplementationVersion(), path, submitterAgentName, submitterAgentID); | ||
representationData,targetOnly, representationType, representationID, sipID, ancestors, documentation, |
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.
',' is not followed by whitespace.
No description provided.