From b07bf5531b4a8ae9269669896e83bf5f16342368 Mon Sep 17 00:00:00 2001 From: Rubenlagus Date: Fri, 27 May 2016 04:43:13 +0200 Subject: [PATCH] Clean up, update pom file --- .travis.yml | 2 +- pom.xml | 146 ++++++++---------- .../telegram/telegrambots/bots/AbsSender.java | 44 +++--- 3 files changed, 86 insertions(+), 106 deletions(-) diff --git a/.travis.yml b/.travis.yml index bad9326c..56e8ff9e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: java jdk: - oraclejdk8 -script: mvn versions:display-dependency-updates clean compile assembly:single +script: mvn clean compile package verify notifications: webhooks: secure: "jC7dK/x67ONWQoeLZg4HfW0mHhcjDerJjsLLkrbcpltiqAbw2p7XfY8Pk4zHoD72a+5o6WKu5WvYvZ4OdldnjP8Y6ZUbliQ5RG3olg3gFDoe0+sc3geeb4HRYVcdI20O0z4Bup/qO0ZihxPBc0D5IpHmFxlaqlZG0WeST4CicU8PNnBh6aX9/VMrwXhkMb2vfzmjmIhMbx/uK5+93bnk/vR5Uwu00/Yd2cTAAWMaqK1MRdtR0WLbxlUNsprEfCjYiH3n9XZnlKXs6cLC8EOU436Wx7aepiAszW0wWFMe/7nVqOqztrQiKNvL0qXYwlQf0BLechJdt458EopL9QCu687TNDFYvg1yERAmCRiaayYZcX3PbUSMr6H5Q+Odntjs3XKyzfgSqqlkgf/SAND5jny1/1uteVoplZmFXuZFIiK4H8Rl2ezy1/8pnbp+JD3YEfiA2NuRjlou1BZXyMhiqqVXbrJqk/tXF6yZSkDlYJfNsWzRCGfra4B6JjEvUP927chIFm1ii3dgNstXDo1evV46+OQQO4HKvMPdtU2FPvWpPlkTxnmpZRZjB+bjmybluJdWT3E+e1C3wm7YbRe3vporhpfNPlnod6M0G10y9CKzl9Fbcku6X1FtM+IoPO/aqZ8S4/CBZoYEuR/Nk6bcvsYouxtyIl6PSuF9E8YjpJE=" diff --git a/pom.xml b/pom.xml index 5a65bc3a..fa4f0398 100644 --- a/pom.xml +++ b/pom.xml @@ -26,6 +26,7 @@ 1.19.1 4.5.2 20160212 + 2.7.4 @@ -44,6 +45,7 @@ org.glassfish.jersey.containers jersey-container-grizzly2-http + ${jersey.version} org.glassfish.jersey.media @@ -83,91 +85,69 @@ ${project.artifactId}-${project.version} ${project.build.directory}/test-classes ${project.basedir}/src/main/java + + + maven-clean-plugin + 3.0.0 + + + clean-project + clean + + clean + + + + + + maven-assembly-plugin + 2.6 + + + jar-with-dependencies + + + + + make-assembly + package + + single + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.0.0 + + + attach-sources + verify + + jar-no-fork + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.10.3 + + + attach-javadocs + site + + javadoc-no-fork + + + + + - - org.apache.maven.plugins - maven-source-plugin - - - attach-sources - - jar - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - - - attach-javadocs - - jar - - - - - - org.apache.maven.plugins - maven-jar-plugin - 2.4 - - - - true - lib/ - org.telegram.Main - - - - - - maven-assembly-plugin - - - - org.telegram.Main - - - - jar-with-dependencies - - - - - make-assembly - package - - single - - - - - - org.apache.maven.plugins - maven-dependency-plugin - 2.9 - - - copy-dependencies - package - - copy-dependencies - - - ${project.build.directory}/lib - false - false - true - - - - - - maven-clean-plugin - org.apache.maven.plugins maven-compiler-plugin diff --git a/src/main/java/org/telegram/telegrambots/bots/AbsSender.java b/src/main/java/org/telegram/telegrambots/bots/AbsSender.java index 703bc816..ebefba8c 100644 --- a/src/main/java/org/telegram/telegrambots/bots/AbsSender.java +++ b/src/main/java/org/telegram/telegrambots/bots/AbsSender.java @@ -104,7 +104,7 @@ public abstract class AbsSender { throw new TelegramApiException("Parameter sendMessage can not be null"); } - return (Message) sendApiMethod(sendMessage); + return sendApiMethod(sendMessage); } public Boolean answerInlineQuery(AnswerInlineQuery answerInlineQuery) throws TelegramApiException { @@ -112,7 +112,7 @@ public abstract class AbsSender { throw new TelegramApiException("Parameter answerInlineQuery can not be null"); } - return (Boolean) sendApiMethod(answerInlineQuery); + return sendApiMethod(answerInlineQuery); } public Boolean sendChatAction(SendChatAction sendChatAction) throws TelegramApiException { @@ -120,7 +120,7 @@ public abstract class AbsSender { throw new TelegramApiException("Parameter sendChatAction can not be null"); } - return (Boolean) sendApiMethod(sendChatAction); + return sendApiMethod(sendChatAction); } public Message forwardMessage(ForwardMessage forwardMessage) throws TelegramApiException { @@ -128,7 +128,7 @@ public abstract class AbsSender { throw new TelegramApiException("Parameter forwardMessage can not be null"); } - return (Message) sendApiMethod(forwardMessage); + return sendApiMethod(forwardMessage); } public Message sendLocation(SendLocation sendLocation) throws TelegramApiException { @@ -136,7 +136,7 @@ public abstract class AbsSender { throw new TelegramApiException("Parameter sendLocation can not be null"); } - return (Message) sendApiMethod(sendLocation); + return sendApiMethod(sendLocation); } public Message sendVenue(SendVenue sendVenue) throws TelegramApiException { @@ -144,7 +144,7 @@ public abstract class AbsSender { throw new TelegramApiException("Parameter sendVenue can not be null"); } - return (Message) sendApiMethod(sendVenue); + return sendApiMethod(sendVenue); } public Message sendContact(SendContact sendContact) throws TelegramApiException { @@ -152,84 +152,84 @@ public abstract class AbsSender { throw new TelegramApiException("Parameter sendContact can not be null"); } - return (Message) sendApiMethod(sendContact); + return sendApiMethod(sendContact); } public Boolean kickMember(KickChatMember kickChatMember) throws TelegramApiException { if (kickChatMember == null) { throw new TelegramApiException("Parameter kickChatMember can not be null"); } - return (Boolean) sendApiMethod(kickChatMember); + return sendApiMethod(kickChatMember); } public Boolean unbanMember(UnbanChatMember unbanChatMember) throws TelegramApiException { if (unbanChatMember == null) { throw new TelegramApiException("Parameter unbanChatMember can not be null"); } - return (Boolean) sendApiMethod(unbanChatMember); + return sendApiMethod(unbanChatMember); } public Boolean leaveChat(LeaveChat leaveChat) throws TelegramApiException { if (leaveChat == null) { throw new TelegramApiException("Parameter leaveChat can not be null"); } - return (Boolean) sendApiMethod(leaveChat); + return sendApiMethod(leaveChat); } public Chat getChat(GetChat getChat) throws TelegramApiException { if (getChat == null) { throw new TelegramApiException("Parameter getChat can not be null"); } - return (Chat) sendApiMethod(getChat); + return sendApiMethod(getChat); } public List getChatAdministrators(GetChatAdministrators getChatAdministrators) throws TelegramApiException { if (getChatAdministrators == null) { throw new TelegramApiException("Parameter getChatAdministrators can not be null"); } - return (ArrayList) sendApiMethod(getChatAdministrators); + return sendApiMethod(getChatAdministrators); } public ChatMember getChatMember(GetChatMember getChatMember) throws TelegramApiException { if (getChatMember == null) { throw new TelegramApiException("Parameter getChatMember can not be null"); } - return (ChatMember) sendApiMethod(getChatMember); + return sendApiMethod(getChatMember); } public Integer getChatMemberCount(GetChatMemberCount getChatMemberCount) throws TelegramApiException { if (getChatMemberCount == null) { throw new TelegramApiException("Parameter getChatMemberCount can not be null"); } - return (Integer) sendApiMethod(getChatMemberCount); + return sendApiMethod(getChatMemberCount); } public Message editMessageText(EditMessageText editMessageText) throws TelegramApiException { if (editMessageText == null) { throw new TelegramApiException("Parameter editMessageText can not be null"); } - return (Message) sendApiMethod(editMessageText); + return sendApiMethod(editMessageText); } public Message editMessageCaption(EditMessageCaption editMessageCaption) throws TelegramApiException { if (editMessageCaption == null) { throw new TelegramApiException("Parameter editMessageCaption can not be null"); } - return (Message) sendApiMethod(editMessageCaption); + return sendApiMethod(editMessageCaption); } public Message editMessageReplyMarkup(EditMessageReplyMarkup editMessageReplyMarkup) throws TelegramApiException { if (editMessageReplyMarkup == null) { throw new TelegramApiException("Parameter editMessageReplyMarkup can not be null"); } - return (Message) sendApiMethod(editMessageReplyMarkup); + return sendApiMethod(editMessageReplyMarkup); } public Boolean answerCallbackQuery(AnswerCallbackQuery answerCallbackQuery) throws TelegramApiException { if (answerCallbackQuery == null) { throw new TelegramApiException("Parameter answerCallbackQuery can not be null"); } - return (Boolean) sendApiMethod(answerCallbackQuery); + return sendApiMethod(answerCallbackQuery); } public UserProfilePhotos getUserProfilePhotos(GetUserProfilePhotos getUserProfilePhotos) throws TelegramApiException { @@ -237,7 +237,7 @@ public abstract class AbsSender { throw new TelegramApiException("Parameter getUserProfilePhotos can not be null"); } - return (UserProfilePhotos) sendApiMethod(getUserProfilePhotos); + return sendApiMethod(getUserProfilePhotos); } public File getFile(GetFile getFile) throws TelegramApiException{ @@ -247,13 +247,13 @@ public abstract class AbsSender { else if(getFile.getFileId() == null){ throw new TelegramApiException("Attribute file_id in parameter getFile can not be null"); } - return (File) sendApiMethod(getFile); + return sendApiMethod(getFile); } public User getMe() throws TelegramApiException { GetMe getMe = new GetMe(); - return (User) sendApiMethod(getMe); + return sendApiMethod(getMe); } // Send Requests Async @@ -928,7 +928,7 @@ public abstract class AbsSender { }); } - private Serializable sendApiMethod(BotApiMethod method) throws TelegramApiException { + private T sendApiMethod(BotApiMethod method) throws TelegramApiException { String responseContent; try { String url = getBaseUrl() + method.getPath();