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

[Bug] [dinky-common] Fix deserialization exceptions caused by incorrect get methods in enum fields. #4082

Merged
merged 1 commit into from
Dec 24, 2024
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
22 changes: 6 additions & 16 deletions dinky-common/src/main/java/org/dinky/data/enums/GatewayType.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@

import org.dinky.assertion.Asserts;

import lombok.Getter;

/**
* SubmitType
*
* @since 2021/10/29
*/
@Getter
public enum GatewayType {
LOCAL("l", "local"),
STANDALONE("s", "standalone"),
Expand All @@ -44,30 +47,17 @@ public enum GatewayType {
this.longValue = longValue;
}

public String getValue() {
return value;
}

public String getLongValue() {
return longValue;
}

public static GatewayType get(String value) {
for (GatewayType type : GatewayType.values()) {
if (Asserts.isEquals(type.getValue(), value) || Asserts.isEquals(type.getLongValue(), value)) {
if (Asserts.isEquals(type.getValue(), value)
|| Asserts.isEquals(type.getLongValue(), value)
|| Asserts.isEquals(type.toString(), value)) {
return type;
}
}
return GatewayType.LOCAL;
}

public static GatewayType getSessionType(String value) {
if (value.contains("kubernetes")) {
return GatewayType.KUBERNETES_SESSION;
}
return GatewayType.YARN_SESSION;
}

public GatewayType getSessionType() {
if (longValue.contains("kubernetes")) {
return GatewayType.KUBERNETES_SESSION;
Expand Down
Loading