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

SDK-342 - SDK fails if distro.properties supplies type or group for c… #302

Merged
merged 2 commits into from
Nov 8, 2024

Conversation

mseaton
Copy link
Member

@mseaton mseaton commented Nov 8, 2024

@mseaton mseaton requested review from dkayiwa and ibacher November 8, 2024 00:28
@@ -154,9 +154,14 @@ public List<Artifact> getContentArtifacts() {
List<Artifact> artifacts = new ArrayList<>();
Copy link
Member

Choose a reason for hiding this comment

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

@mseaton wouldn't it be better to consolidate duplicated code for extracting different artifact types into a single reusable method?

Suggested change
List<Artifact> artifacts = new ArrayList<>();
public List<Artifact> getWarArtifacts(){
return getArtifacts(TYPE_WAR);
}
public List<Artifact> getConfigArtifacts() {
return getArtifacts(TYPE_CONFIG);
}
public List<Artifact> getContentArtifacts() {
return getArtifacts(TYPE_CONTENT);
}
private List<Artifact> getArtifacts(String typeContent) {
List<Artifact> artifacts = new ArrayList<>();
for (Object keyObject : getAllKeys()) {
String key = keyObject.toString();
String artifactType = getArtifactType(key);
if (artifactType.equals(typeContent)) {
artifacts.add(new Artifact(
checkIfOverwritten(key, ARTIFACT_ID),
getParam(key),
checkIfOverwritten(key, GROUP_ID),
checkIfOverwritten(key, TYPE)
));
}
}
return artifacts;

Copy link
Member Author

Choose a reason for hiding this comment

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

Indeed @wikumChamith there are many, many opportunities to work on tech debt in the SDK. This initial PR is attempting to just fix the underlying issue. More than happy to make broader refactoring improvements in other commits / tickets.

@mseaton mseaton merged commit 0d54196 into master Nov 8, 2024
2 checks passed
@mseaton mseaton deleted the SDK-342 branch November 8, 2024 17:51
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