Remove guava dep from main modules (#1173)
* Remove Guava Dep * Update pom.xml * Update ExponentialBackOff.java * Update ExponentialBackOff.java * Update WebhookUtils.java * Update pom.xml
This commit is contained in:
parent
d1c70210f1
commit
4c36c432f6
7
pom.xml
7
pom.xml
@ -76,6 +76,7 @@
|
|||||||
<jakarta.annotation.version>2.1.1</jakarta.annotation.version>
|
<jakarta.annotation.version>2.1.1</jakarta.annotation.version>
|
||||||
<lombok.version>1.18.24</lombok.version>
|
<lombok.version>1.18.24</lombok.version>
|
||||||
<guava.version>31.1-jre</guava.version>
|
<guava.version>31.1-jre</guava.version>
|
||||||
|
<commons.version>3.12.0</commons.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
@ -134,6 +135,12 @@
|
|||||||
<artifactId>slf4j-api</artifactId>
|
<artifactId>slf4j-api</artifactId>
|
||||||
<version>${slf4j.version}</version>
|
<version>${slf4j.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-lang3</artifactId>
|
||||||
|
<version>${commons.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- Included to enforce common version-->
|
<!-- Included to enforce common version-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>jakarta.annotation</groupId>
|
<groupId>jakarta.annotation</groupId>
|
||||||
|
@ -90,6 +90,10 @@
|
|||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
<artifactId>commons-lang3</artifactId>
|
<artifactId>commons-lang3</artifactId>
|
||||||
<version>${commonslang.version}</version>
|
<version>${commonslang.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.guava</groupId>
|
||||||
|
<artifactId>guava</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mapdb</groupId>
|
<groupId>org.mapdb</groupId>
|
||||||
|
@ -87,15 +87,14 @@
|
|||||||
<artifactId>jackson-annotations</artifactId>
|
<artifactId>jackson-annotations</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.guava</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
<artifactId>guava</artifactId>
|
<artifactId>commons-lang3</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package org.telegram.telegrambots.meta;
|
package org.telegram.telegrambots.meta;
|
||||||
|
|
||||||
import com.google.common.base.Strings;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.telegram.telegrambots.meta.api.methods.updates.SetWebhook;
|
import org.telegram.telegrambots.meta.api.methods.updates.SetWebhook;
|
||||||
import org.telegram.telegrambots.meta.exceptions.TelegramApiException;
|
import org.telegram.telegrambots.meta.exceptions.TelegramApiException;
|
||||||
import org.telegram.telegrambots.meta.generics.BotSession;
|
import org.telegram.telegrambots.meta.generics.BotSession;
|
||||||
@ -106,7 +106,7 @@ public class TelegramBotsApi {
|
|||||||
* @return False if username or token are empty or null, true otherwise
|
* @return False if username or token are empty or null, true otherwise
|
||||||
*/
|
*/
|
||||||
private boolean validateBotUsernameAndToken(TelegramBot telegramBot) {
|
private boolean validateBotUsernameAndToken(TelegramBot telegramBot) {
|
||||||
return !Strings.isNullOrEmpty(telegramBot.getBotToken()) &&
|
return StringUtils.isNotEmpty(telegramBot.getBotToken()) &&
|
||||||
!Strings.isNullOrEmpty(telegramBot.getBotUsername());
|
StringUtils.isNotEmpty(telegramBot.getBotUsername());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package org.telegram.telegrambots.meta.api.methods.groupadministration;
|
package org.telegram.telegrambots.meta.api.methods.groupadministration;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.google.common.base.Strings;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
@ -12,6 +11,7 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import lombok.experimental.Tolerate;
|
import lombok.experimental.Tolerate;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
|
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
|
||||||
import org.telegram.telegrambots.meta.api.objects.ChatInviteLink;
|
import org.telegram.telegrambots.meta.api.objects.ChatInviteLink;
|
||||||
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
|
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
|
||||||
@ -88,10 +88,10 @@ public class EditChatInviteLink extends BotApiMethod<ChatInviteLink> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void validate() throws TelegramApiValidationException {
|
public void validate() throws TelegramApiValidationException {
|
||||||
if (Strings.isNullOrEmpty(chatId)) {
|
if (StringUtils.isEmpty(chatId)) {
|
||||||
throw new TelegramApiValidationException("ChatId can't be empty", this);
|
throw new TelegramApiValidationException("ChatId can't be empty", this);
|
||||||
}
|
}
|
||||||
if (Strings.isNullOrEmpty(inviteLink)) {
|
if (StringUtils.isEmpty(inviteLink)) {
|
||||||
throw new TelegramApiValidationException("InviteLink can't be empty", this);
|
throw new TelegramApiValidationException("InviteLink can't be empty", this);
|
||||||
}
|
}
|
||||||
if (name != null && name.length() > 32) {
|
if (name != null && name.length() > 32) {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package org.telegram.telegrambots.meta.api.methods.groupadministration;
|
package org.telegram.telegrambots.meta.api.methods.groupadministration;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.google.common.base.Strings;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
@ -11,6 +10,7 @@ import lombok.NonNull;
|
|||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import lombok.experimental.Tolerate;
|
import lombok.experimental.Tolerate;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
|
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
|
||||||
import org.telegram.telegrambots.meta.api.objects.ChatInviteLink;
|
import org.telegram.telegrambots.meta.api.objects.ChatInviteLink;
|
||||||
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
|
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
|
||||||
@ -65,10 +65,10 @@ public class RevokeChatInviteLink extends BotApiMethod<ChatInviteLink> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void validate() throws TelegramApiValidationException {
|
public void validate() throws TelegramApiValidationException {
|
||||||
if (Strings.isNullOrEmpty(chatId)) {
|
if (StringUtils.isEmpty(chatId)) {
|
||||||
throw new TelegramApiValidationException("ChatId can't be empty", this);
|
throw new TelegramApiValidationException("ChatId can't be empty", this);
|
||||||
}
|
}
|
||||||
if (Strings.isNullOrEmpty(inviteLink)) {
|
if (StringUtils.isEmpty(inviteLink)) {
|
||||||
throw new TelegramApiValidationException("InviteLink can't be empty", this);
|
throw new TelegramApiValidationException("InviteLink can't be empty", this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package org.telegram.telegrambots.meta.api.methods.invoices;
|
package org.telegram.telegrambots.meta.api.methods.invoices;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.google.common.base.Strings;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
@ -12,6 +11,7 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.Singular;
|
import lombok.Singular;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
|
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
|
||||||
import org.telegram.telegrambots.meta.api.objects.payments.LabeledPrice;
|
import org.telegram.telegrambots.meta.api.objects.payments.LabeledPrice;
|
||||||
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
|
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
|
||||||
@ -134,19 +134,19 @@ public class CreateInvoiceLink extends BotApiMethod<String> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void validate() throws TelegramApiValidationException {
|
public void validate() throws TelegramApiValidationException {
|
||||||
if (Strings.isNullOrEmpty(title) || title.length() > 32) {
|
if (StringUtils.isEmpty(title) || title.length() > 32) {
|
||||||
throw new TelegramApiValidationException("Title parameter can't be empty or longer than 32 chars", this);
|
throw new TelegramApiValidationException("Title parameter can't be empty or longer than 32 chars", this);
|
||||||
}
|
}
|
||||||
if (Strings.isNullOrEmpty(description) || description.length() > 255) {
|
if (StringUtils.isEmpty(description) || description.length() > 255) {
|
||||||
throw new TelegramApiValidationException("Description parameter can't be empty or longer than 255 chars", this);
|
throw new TelegramApiValidationException("Description parameter can't be empty or longer than 255 chars", this);
|
||||||
}
|
}
|
||||||
if (Strings.isNullOrEmpty(payload)) {
|
if (StringUtils.isEmpty(payload)) {
|
||||||
throw new TelegramApiValidationException("Payload parameter can't be empty", this);
|
throw new TelegramApiValidationException("Payload parameter can't be empty", this);
|
||||||
}
|
}
|
||||||
if (Strings.isNullOrEmpty(providerToken)) {
|
if (StringUtils.isEmpty(providerToken)) {
|
||||||
throw new TelegramApiValidationException("ProviderToken parameter can't be empty", this);
|
throw new TelegramApiValidationException("ProviderToken parameter can't be empty", this);
|
||||||
}
|
}
|
||||||
if (Strings.isNullOrEmpty(currency)) {
|
if (StringUtils.isEmpty(currency)) {
|
||||||
throw new TelegramApiValidationException("Currency parameter can't be empty", this);
|
throw new TelegramApiValidationException("Currency parameter can't be empty", this);
|
||||||
}
|
}
|
||||||
if (prices.isEmpty()) {
|
if (prices.isEmpty()) {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package org.telegram.telegrambots.meta.api.methods.invoices;
|
package org.telegram.telegrambots.meta.api.methods.invoices;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.google.common.base.Strings;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
@ -13,6 +12,7 @@ import lombok.Setter;
|
|||||||
import lombok.Singular;
|
import lombok.Singular;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import lombok.experimental.Tolerate;
|
import lombok.experimental.Tolerate;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.telegram.telegrambots.meta.api.methods.botapimethods.BotApiMethodMessage;
|
import org.telegram.telegrambots.meta.api.methods.botapimethods.BotApiMethodMessage;
|
||||||
import org.telegram.telegrambots.meta.api.objects.payments.LabeledPrice;
|
import org.telegram.telegrambots.meta.api.objects.payments.LabeledPrice;
|
||||||
import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup;
|
import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup;
|
||||||
@ -180,22 +180,22 @@ public class SendInvoice extends BotApiMethodMessage {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void validate() throws TelegramApiValidationException {
|
public void validate() throws TelegramApiValidationException {
|
||||||
if (Strings.isNullOrEmpty(chatId)) {
|
if (StringUtils.isEmpty(chatId)) {
|
||||||
throw new TelegramApiValidationException("ChatId parameter can't be empty", this);
|
throw new TelegramApiValidationException("ChatId parameter can't be empty", this);
|
||||||
}
|
}
|
||||||
if (Strings.isNullOrEmpty(title) || title.length() > 32) {
|
if (StringUtils.isEmpty(title) || title.length() > 32) {
|
||||||
throw new TelegramApiValidationException("Title parameter can't be empty or longer than 32 chars", this);
|
throw new TelegramApiValidationException("Title parameter can't be empty or longer than 32 chars", this);
|
||||||
}
|
}
|
||||||
if (Strings.isNullOrEmpty(description) || description.length() > 255) {
|
if (StringUtils.isEmpty(description) || description.length() > 255) {
|
||||||
throw new TelegramApiValidationException("Description parameter can't be empty or longer than 255 chars", this);
|
throw new TelegramApiValidationException("Description parameter can't be empty or longer than 255 chars", this);
|
||||||
}
|
}
|
||||||
if (Strings.isNullOrEmpty(payload)) {
|
if (StringUtils.isEmpty(payload)) {
|
||||||
throw new TelegramApiValidationException("Payload parameter can't be empty", this);
|
throw new TelegramApiValidationException("Payload parameter can't be empty", this);
|
||||||
}
|
}
|
||||||
if (Strings.isNullOrEmpty(providerToken)) {
|
if (StringUtils.isEmpty(providerToken)) {
|
||||||
throw new TelegramApiValidationException("ProviderToken parameter can't be empty", this);
|
throw new TelegramApiValidationException("ProviderToken parameter can't be empty", this);
|
||||||
}
|
}
|
||||||
if (Strings.isNullOrEmpty(currency)) {
|
if (StringUtils.isEmpty(currency)) {
|
||||||
throw new TelegramApiValidationException("Currency parameter can't be empty", this);
|
throw new TelegramApiValidationException("Currency parameter can't be empty", this);
|
||||||
}
|
}
|
||||||
if (prices.isEmpty()) {
|
if (prices.isEmpty()) {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package org.telegram.telegrambots.meta.api.methods.send;
|
package org.telegram.telegrambots.meta.api.methods.send;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.google.common.base.Strings;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
@ -13,6 +12,7 @@ import lombok.Setter;
|
|||||||
import lombok.Singular;
|
import lombok.Singular;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import lombok.experimental.Tolerate;
|
import lombok.experimental.Tolerate;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.telegram.telegrambots.meta.api.methods.botapimethods.BotApiMethodMessage;
|
import org.telegram.telegrambots.meta.api.methods.botapimethods.BotApiMethodMessage;
|
||||||
import org.telegram.telegrambots.meta.api.objects.payments.LabeledPrice;
|
import org.telegram.telegrambots.meta.api.objects.payments.LabeledPrice;
|
||||||
import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup;
|
import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup;
|
||||||
@ -176,22 +176,22 @@ public class SendInvoice extends BotApiMethodMessage {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void validate() throws TelegramApiValidationException {
|
public void validate() throws TelegramApiValidationException {
|
||||||
if (Strings.isNullOrEmpty(chatId)) {
|
if (StringUtils.isEmpty(chatId)) {
|
||||||
throw new TelegramApiValidationException("ChatId parameter can't be empty", this);
|
throw new TelegramApiValidationException("ChatId parameter can't be empty", this);
|
||||||
}
|
}
|
||||||
if (Strings.isNullOrEmpty(title)) {
|
if (StringUtils.isEmpty(title)) {
|
||||||
throw new TelegramApiValidationException("Title parameter can't be empty", this);
|
throw new TelegramApiValidationException("Title parameter can't be empty", this);
|
||||||
}
|
}
|
||||||
if (Strings.isNullOrEmpty(description)) {
|
if (StringUtils.isEmpty(description)) {
|
||||||
throw new TelegramApiValidationException("Description parameter can't be empty", this);
|
throw new TelegramApiValidationException("Description parameter can't be empty", this);
|
||||||
}
|
}
|
||||||
if (Strings.isNullOrEmpty(payload)) {
|
if (StringUtils.isEmpty(payload)) {
|
||||||
throw new TelegramApiValidationException("Payload parameter can't be empty", this);
|
throw new TelegramApiValidationException("Payload parameter can't be empty", this);
|
||||||
}
|
}
|
||||||
if (Strings.isNullOrEmpty(providerToken)) {
|
if (StringUtils.isEmpty(providerToken)) {
|
||||||
throw new TelegramApiValidationException("ProviderToken parameter can't be empty", this);
|
throw new TelegramApiValidationException("ProviderToken parameter can't be empty", this);
|
||||||
}
|
}
|
||||||
if (Strings.isNullOrEmpty(currency)) {
|
if (StringUtils.isEmpty(currency)) {
|
||||||
throw new TelegramApiValidationException("Currency parameter can't be empty", this);
|
throw new TelegramApiValidationException("Currency parameter can't be empty", this);
|
||||||
}
|
}
|
||||||
if (prices.isEmpty()) {
|
if (prices.isEmpty()) {
|
||||||
|
@ -2,7 +2,6 @@ package org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessageconte
|
|||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||||
import com.google.common.base.Strings;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
@ -13,6 +12,7 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.Singular;
|
import lombok.Singular;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.telegram.telegrambots.meta.api.objects.payments.LabeledPrice;
|
import org.telegram.telegrambots.meta.api.objects.payments.LabeledPrice;
|
||||||
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
|
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
|
||||||
|
|
||||||
@ -189,19 +189,19 @@ public class InputInvoiceMessageContent implements InputMessageContent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void validate() throws TelegramApiValidationException {
|
public void validate() throws TelegramApiValidationException {
|
||||||
if (Strings.isNullOrEmpty(title) || title.length() > 32) {
|
if (StringUtils.isEmpty(title) || title.length() > 32) {
|
||||||
throw new TelegramApiValidationException("Title parameter must be between 1 and 32 characters", this);
|
throw new TelegramApiValidationException("Title parameter must be between 1 and 32 characters", this);
|
||||||
}
|
}
|
||||||
if (Strings.isNullOrEmpty(description) || description.length() > 32) {
|
if (StringUtils.isEmpty(description) || description.length() > 32) {
|
||||||
throw new TelegramApiValidationException("Description parameter must be between 1 and 255 characters", this);
|
throw new TelegramApiValidationException("Description parameter must be between 1 and 255 characters", this);
|
||||||
}
|
}
|
||||||
if (Strings.isNullOrEmpty(payload) || payload.length() > 32) {
|
if (StringUtils.isEmpty(payload) || payload.length() > 32) {
|
||||||
throw new TelegramApiValidationException("Payload parameter must be between 1 and 128 characters", this);
|
throw new TelegramApiValidationException("Payload parameter must be between 1 and 128 characters", this);
|
||||||
}
|
}
|
||||||
if (Strings.isNullOrEmpty(providerToken)) {
|
if (StringUtils.isEmpty(providerToken)) {
|
||||||
throw new TelegramApiValidationException("ProviderToken parameter must not be empty", this);
|
throw new TelegramApiValidationException("ProviderToken parameter must not be empty", this);
|
||||||
}
|
}
|
||||||
if (Strings.isNullOrEmpty(currency)) {
|
if (StringUtils.isEmpty(currency)) {
|
||||||
throw new TelegramApiValidationException("Currency parameter must not be empty", this);
|
throw new TelegramApiValidationException("Currency parameter must not be empty", this);
|
||||||
}
|
}
|
||||||
if (prices == null || prices.isEmpty()) {
|
if (prices == null || prices.isEmpty()) {
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.telegram.telegrambots.updatesreceivers;
|
package org.telegram.telegrambots.updatesreceivers;
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
|
||||||
import org.telegram.telegrambots.meta.generics.BackOff;
|
import org.telegram.telegrambots.meta.generics.BackOff;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -153,11 +152,21 @@ public class ExponentialBackOff implements BackOff {
|
|||||||
multiplier = builder.multiplier;
|
multiplier = builder.multiplier;
|
||||||
maxIntervalMillis = builder.maxIntervalMillis;
|
maxIntervalMillis = builder.maxIntervalMillis;
|
||||||
maxElapsedTimeMillis = builder.maxElapsedTimeMillis;
|
maxElapsedTimeMillis = builder.maxElapsedTimeMillis;
|
||||||
Preconditions.checkArgument(initialIntervalMillis > 0);
|
if (initialIntervalMillis <= 0) {
|
||||||
Preconditions.checkArgument(0 <= randomizationFactor && randomizationFactor < 1);
|
throw new IllegalArgumentException("InitialIntervalMillis must not be negative");
|
||||||
Preconditions.checkArgument(multiplier >= 1);
|
}
|
||||||
Preconditions.checkArgument(maxIntervalMillis >= initialIntervalMillis);
|
if (maxElapsedTimeMillis <= 0) {
|
||||||
Preconditions.checkArgument(maxElapsedTimeMillis > 0);
|
throw new IllegalArgumentException("MaxElapsedTimeMillis must not be negative");
|
||||||
|
}
|
||||||
|
if (multiplier < 1) {
|
||||||
|
throw new IllegalArgumentException("Multiplier must be bigger than 0");
|
||||||
|
}
|
||||||
|
if (maxIntervalMillis < initialIntervalMillis) {
|
||||||
|
throw new IllegalArgumentException("InitialIntervalMillis must be smaller or equal maxIntervalMillis");
|
||||||
|
}
|
||||||
|
if (randomizationFactor < 0 || randomizationFactor >= 1) {
|
||||||
|
throw new IllegalArgumentException("RandomizationFactor must be between 0 and 1");
|
||||||
|
}
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ package org.telegram.telegrambots.util;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.google.common.base.Strings;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.http.HttpEntity;
|
import org.apache.http.HttpEntity;
|
||||||
import org.apache.http.client.config.RequestConfig;
|
import org.apache.http.client.config.RequestConfig;
|
||||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||||
@ -124,7 +124,7 @@ public final class WebhookUtils {
|
|||||||
externalUrl += "/";
|
externalUrl += "/";
|
||||||
}
|
}
|
||||||
externalUrl += Constants.WEBHOOK_URL_PATH;
|
externalUrl += Constants.WEBHOOK_URL_PATH;
|
||||||
if (!Strings.isNullOrEmpty(botPath)) {
|
if (StringUtils.isNotEmpty(botPath)) {
|
||||||
if (!botPath.startsWith("/")) {
|
if (!botPath.startsWith("/")) {
|
||||||
externalUrl += "/";
|
externalUrl += "/";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user