Skip to content

Commit

Permalink
Add some doc and examples to explain how fix works
Browse files Browse the repository at this point in the history
Signed-off-by: Sicheng Song <[email protected]>
  • Loading branch information
b4sjoo committed Oct 4, 2023
1 parent 79e45f2 commit df8bc47
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -318,15 +318,23 @@ private String getModelIdWithFunctionName(FunctionName functionName) throws IOEx
return modelIdSet.iterator().next().toString();
}

/**
* This method compares our current ML plugin version
* to the older ML plugin version used in the BWC test,
* which is 2.4.0 at this time.
*/
private boolean isNewerVersion(String osVersion) {
Integer olderMajorVersion = 2;
Integer olderMinorVersion = 4;
Pattern pattern = Pattern.compile("\\d+(?=\\.)");
Matcher matcher = pattern.matcher(osVersion);
// e.g. If current OS Version is "2.11.0", the osVersionArrayList will be like [2, 11].
ArrayList<Integer> osVersionArrayList = new ArrayList<>();
while (matcher.find()) {
osVersionArrayList.add(Integer.parseInt(matcher.group()));
}
if (osVersionArrayList.size() >= 2) {
return (osVersionArrayList.get(0) > 2 || osVersionArrayList.get(1) > 4);
return (osVersionArrayList.get(0) > olderMajorVersion || osVersionArrayList.get(1) > olderMinorVersion);
} else {
throw new IllegalArgumentException("osVersion is not valid, osVersion is: " + osVersion);
}
Expand Down

0 comments on commit df8bc47

Please sign in to comment.