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

Added functionality to choose checksum algorithm #63 #152

Merged
merged 1 commit into from
Aug 4, 2023

Conversation

carlosjepard
Copy link
Contributor

No description provided.

@@ -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());

Choose a reason for hiding this comment

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

⚠️ [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
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();

Choose a reason for hiding this comment

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

⚠️ [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
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;

Choose a reason for hiding this comment

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

⚠️ [checkstyle] <com.puppycrawl.tools.checkstyle.checks.imports.ImportOrderCheck> reported by reviewdog 🐶
Wrong order for 'java.security.MessageDigest' import.

if (checksumAlg != null) {
try {
MessageDigest.getInstance(checksumAlg);
} catch (NoSuchAlgorithmException e) {

Choose a reason for hiding this comment

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

⚠️ [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
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)){

Choose a reason for hiding this comment

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

⚠️ [checkstyle] <com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAfterCheck> reported by reviewdog 🐶
'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)){

Choose a reason for hiding this comment

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

⚠️ [checkstyle] <com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAroundCheck> reported by reviewdog 🐶
'{' is not preceded with whitespace.

@@ -54,6 +54,8 @@ public abstract class IP implements IPInterface {

private ValidationReport validationReport;

private String checksumAlgorithm;

Choose a reason for hiding this comment

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

⚠️ [checkstyle] <com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck> reported by reviewdog 🐶
Missing a Javadoc comment.

@@ -65,6 +67,7 @@ public IP() {
this.ancestors = new ArrayList<>();

this.description = "";
this.checksumAlgorithm="SHA-256";

Choose a reason for hiding this comment

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

⚠️ [checkstyle] <com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAroundCheck> reported by reviewdog 🐶
'=' is not followed by whitespace.

@@ -65,6 +67,7 @@ public IP() {
this.ancestors = new ArrayList<>();

this.description = "";
this.checksumAlgorithm="SHA-256";

Choose a reason for hiding this comment

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

⚠️ [checkstyle] <com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAroundCheck> reported by reviewdog 🐶
'=' is not preceded with whitespace.

@@ -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 " +

Choose a reason for hiding this comment

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

⚠️ [checkstyle] <com.puppycrawl.tools.checkstyle.checks.whitespace.OperatorWrapCheck> reported by reviewdog 🐶
'+' should be on a new line.

@@ -0,0 +1,16 @@
## Checksum Algorithms

Choose a reason for hiding this comment

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

⚠️ [checkstyle] <com.puppycrawl.tools.checkstyle.checks.NewlineAtEndOfFileCheck> reported by reviewdog 🐶
File does not end with a newline.

Copy link
Member

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


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,
Copy link

Choose a reason for hiding this comment

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

⚠️ [checkstyle] <com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAfterCheck> reported by reviewdog 🐶
',' is not followed by whitespace.

@hmiguim hmiguim merged commit df9b2d3 into master Aug 4, 2023
1 check passed
@hmiguim hmiguim deleted the cafonso-dev63 branch August 4, 2023 08:58
@hmiguim hmiguim added this to the 2.4.0 milestone Oct 3, 2023
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