Skip to content

Commit

Permalink
Solve "StackOverflowException" on TransactionPartnerTypeAdapter when …
Browse files Browse the repository at this point in the history
…the object is of an incompatible type
  • Loading branch information
mircoianese committed Aug 19, 2024
1 parent 735c5fe commit fdba222
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.pengrad.telegrambot.model.stars.partner;

import com.pengrad.telegrambot.model.stars.withdrawal.RevenueWithdrawalState;

import java.util.Objects;

public class TransactionPartnerUnknown extends TransactionPartner {

public final static String TYPE = "unknown";

public TransactionPartnerUnknown() {
super(TYPE);
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
return true;
}

@Override
public String toString() {
return "TransactionPartnerUnknown{" +
"type='" + type() + "\'" +
'}';
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ public TransactionPartner deserialize(JsonElement element, Type type, JsonDeseri
return context.deserialize(object, TransactionPartnerOther.class);
}

return context.deserialize(object, TransactionPartner.class);
return new TransactionPartnerUnknown();
}
}

0 comments on commit fdba222

Please sign in to comment.