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

[CIN-1411] Fix IllegalStateException #814

Merged
merged 3 commits into from
Jan 22, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public class ContainerSupport
{
public static final String HXI_PREDICTION_BATCHES_ENDPOINT = "/prediction-batches";
public static final String REPOSITORY_PREDICTION_ENDPOINT = "/api/-default-/private/hxi/versions/1/nodes/%s/predictions";
public static final String USER_AGENT_REGEX = "ACS HXI Connector\\/" + DockerTags.getHxiConnectorTag() + " ACS\\/" + DockerTags.getRepositoryTag() + " .*";
public static final String USER_AGENT_REGEX = "ACS HXI Connector/" + DockerTags.getHxiConnectorTag() + " ACS/" + DockerTags.getRepositoryTag().split("-")[0] + " .*";
public static final String DISCOVERY_ENDPOINT = "/api/discovery";
private static ContainerSupport instance;
private final Session session;
Expand Down Expand Up @@ -267,15 +267,22 @@ public void prepareRepositoryToReturnDiscovery()

public static List<String> extractVersionDetails(String version)
{
String regex = "(\\d+)\\.(\\d+)\\.(\\d+)(?:-([A-Za-z]+)\\.(\\d+))?";
String regex = "(\\d+)\\.(\\d+)\\.(\\d+)(?:-([A-Za-z]+)\\.?(\\d+))?";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(version);

String major = matcher.group(1);
String minor = matcher.group(2);
String hotfix = matcher.group(3);
if (matcher.find())
{
String major = matcher.group(1);
String minor = matcher.group(2);
String hotfix = matcher.group(3);

return List.of(major, minor, hotfix);
return List.of(major, minor, hotfix);
}
else
{
throw new IllegalStateException("No match found for version details in input: " + version);
}
}

public void prepareRepositoryToFailAtDiscovery()
Expand Down
Loading