Skip to content

Commit 0fd9665

Browse files
authored
Reverted to original MR code.
The improvements make no gains and complicate the logic more than any code quality improvement foreseen.
1 parent 270d5c4 commit 0fd9665

File tree

1 file changed

+3
-5
lines changed
  • detectable/src/main/java/com/blackduck/integration/detectable/detectables/yarn

1 file changed

+3
-5
lines changed

detectable/src/main/java/com/blackduck/integration/detectable/detectables/yarn/Version.java

+3-5
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,9 @@ public Version(int major, int minor, int patch) {
1515
this.patch = patch;
1616
}
1717
public Version(String[] parts) {
18-
this(getPartOfVersion(parts, 0), getPartOfVersion(parts, 1), getPartOfVersion(parts, 2));
19-
}
20-
21-
private int getPartOfVersion(String[] parts, int index) {
22-
return parts.length > index && parts[index] != null && !parts[index].trim().isEmpty()? Integer.parseInt(parts[index]) : 0;
18+
this(parts.length > 0 && parts[0] != null && !parts[0].trim().isEmpty()? Integer.parseInt(parts[0]) : 0,
19+
parts.length > 1 && parts[1] != null && !parts[1].trim().isEmpty()? Integer.parseInt(parts[1]) : 0,
20+
parts.length > 2 && parts[2] != null && !parts[2].trim().isEmpty()? Integer.parseInt(parts[2]) : 0);
2321
}
2422

2523
@Override

0 commit comments

Comments
 (0)