Java Telegram Bot: Numeric value out of range of int - java

A few years ago, I created two bots, using telegrambots-3.6.1-jar-with-dependencies.
My bots extend the class TelegramLongPollingBot.
Both of them, now, suffer the very same problem.
Every time that a user with user_ID>2147483647 joins the group, the bots stop working for several days, reporting continuously the following error:
Caused by: com.fasterxml.jackson.databind.JsonMappingException: Numeric value (5042963863) out of range of int
at [Source: {"ok":true,"result":[{"update_id":412942830,
"message":{"message_id":306587,"from":{"id":5042963863,"is_bot"
I've tried to use a newer version of libraries (telegrambots-5.1.1-jar-with-dependencies), but in this case, I get many compilation errors, because of missing types (many imports don't work anymore).
I've also tried to use Webhook, but I can't find a complete example that explains how to use the Webhook variable after having set it.
This wouldn't solve the 'out of range error', but at least the bot would still remain active (while now with PollingBot, the bot remains in error-state for many days: even after having shut it down and turned it on again, the bot doesn't work).

I also faced that issued. But I'm not sure you're using rubenlagus telegram bot library or not. If you use may it's old version of telegram bot. Just update to latest telegram bot.
https://github.com/rubenlagus/TelegramBots/issues/1017#issuecomment-1143168283
There are some change on version from lower version. Read more on https://github.com/rubenlagus/TelegramBots/wiki/How-To-Update

Related

How to reset sequence numbers using Java QuickFIX

Currently I am working on Java Project where trying to use QuickFIX engine.
But every time getting below message:
MsgSeqNum too low, expecting 3 but received 2
For some security reason, can't share the whole Java file and config, but code portion can be shared in customized way.
What I want from here is, if there is any Java sample using QuickFIX where above error point has been fixed.
NB:
Apologies if the same question is there.
Please help me to find that one also.
You can manually set the sequence numbers using APIs:
Session.lookupSession(session_).setNextSenderMsgSeqNum();
Session.lookupSession(session_).setNextTargetMsgSeqNum();
You can also refer: How to set sequence numbers manually in QuickFixJ?

Is the Google Drive web host link feature in danger of being phased out?

I am working on an Android app that stores log on a client's Google Drive. We push static HTML/Javascript files to said Drive in order for the user to be able to read their logs in an user friendly way via their browser. This feature worked relatively well until now (notwithstanding some glitches due to server updates in the last few months).
2 weeks ago (.e. from the beginning of October 2014) we saw that the newer user interface of Google Drive has dropped the web host link capability altogether. For legacy accounts this feature is still there, but not for newer created accounts from the aforementioned date.
Does that mean that Google is planning to ultimately drop this feature, or is it going to be available for the foreseeable future, even if only accessible programmatically via SDK?
Note that we tested to see if programmatic access is affected, and it seems to work fine. We used java SDK function getWebViewLink() (class File) in order to get the link programmatically, and it still works no 1 for now. But the change in UI from Google does worry us that this feature will be dropped, like Dropbox dropped theirs recently. Is that the case? If so, what is the expected timeline of feature deprecation and eventual disappearance?
It looks like they moved/changed it but didn't remove it altogether. The instructions from Google on how to host webpages with Drive worked for me using an account I created after the UI change (after you posted this question).
Since their latest blog post on deprecating APIs does not say anything about getting rid of the web host feature, you are probably fine.
If so, what is the expected timeline of feature deprecation and eventual disappearance?
If the APIs they're deprecating are anything to go by, even if they do get rid of web hosting it will be a couple of years between the time they announce it and it actually being unavailable. It's not a perfect comparison since those are entire APIs and this is just a feature but it doesn't seem like they make a habit of making something unavailable at the drop of a hat.

Truncation of web socket chunk while uploading a file

I have tried searching for this strange issue I am facing but could not find anything on web.
Following is what I am trying to do.
Upload File from User browser to Play server running on some different environment
Following is the issue I am facing.
The chunk is getting truncated before reaching to Play server
Observations:
Chunk is created at client side properly from java script and websocket.send() is passing proper chunk to Play.
On Play server, the chunk is coming as a String event object which is truncated.
Very strange thing about this problem is This is happening only from some machines/networks, for all others it is working fine
When tried with different chunk size, it has been observed that for smaller chunks many of initial chunks gets received properly and later one fails
We have tried bypassing Firewalls and Proxies as well on some network to check what happens if there are no such restrictions, but it is still failing
Please give your inputs which can help me debug this and fix this. Any additional things you want I can provide, not pasting code as it is working on majority of machines and networks but failing on a few, so it does not seem to be a code issue
PS. This question can have many answers based on people's views, to all SO users, I just need help on what could be the thing which can go wrong, so please do not flag this as inappropriate
I have figured it out, the issue was with latest update of google chrome. I downloaded the chrome from here (Version 37) and it started working fine.
I came to know after a period of time that this issue was because of the implementation changes in chrome V38 for multiple frames for single message, initially it was getting transferred in a single frame so ultimately the implementation from your server side also need to be changed in order to handling the same.
I was using older version of Play framework which wasn't having this multiple frame handling implementation so it was breaking.
After updating Play to 2.2.3 it started working properly as they have implemented multiframe handling in that version. Some useful links below
Issue With Latest Chrome
Play Changelog
Changes for Continuation frame handling for WebSockets in Play 2.2.3

GWT- SDK upgrade issue

I recently came across a bug with an unresolved issue in SDK 2.2 and, as its fixed in 2.5, decided to explore a switch.
Now I am new to GWT and I have no idea of the effects of doing such a switch, but figured it couldn't hurt to mess around locally. I went ahead and successfully updated to 2.5 locally to test and can run with no errors. However many of the text boxes have changed appearance and my navigation bar disappeared, etc...
Is this type of behavior normal after an update? If so I cant imagine why anyone would be in a hurry to do so, as spending enormous amounts of time to modify all pages is pretty unrealistic. Is there maybe some type of quick fix or an error i may have made to cause this?
If you want to put a lot of resources into a GWT project it is always a good idea to check regularly how the project is going on. On the release-note page you can check what's new and what has been deprecated. This way you can make an informed and rational decision whenever you want to update. This is very important since going from an old version (say 1.0) to a new one (i.e 2.5.1) might give some headaches to the programmers. Spendind half-an-hour checking what's going on every month will make your life easier.
GWT has an issue tracker where you can see the open issues and what has been resolved. Many issues have never been fixed, but I read the GWT team intend to solve the 100 most important issues for the next release. GWT is now open-source and you can contribute to its development whenever you know of to fix one of those issues.
Last but not least: many people say a lot of things, which are not always correct (including on Stack Overflow). Always dubble check before making important decisions.
Giving this advice is all I can do for you so far...
Yet, if you give me some info about that bug you expected to be fixed and the exact name of that "navigation bar" widget you might find out information on the sites above to check their status. But I can't search that for you if I don't know what the bug was and the name of the widget that is broken. Also, when you say "many of the textboxes" I understand it's not every textbox that's broken but some variant your are using in some particular places. More information would also be needed...

Stop Chrome from trying to always update Java and Silverlight when running applets/plugins?

We have recently added a Silverlight based plugin (Plupload) that works great except for one issue:
If you try to use it in Chrome your browser will popup with the message "Silverlight was blocked because it is out of date".
I appreciate Google trying to force users to update (which they otherwise never ever do) but this has single handedly tripled our customer support load. Does anybody know of a way to force it to run in Chrome via Javascript/Html code?
We have seen the same issue with many sites using Java applets. As Oracle constantly has minor updates it seems near impossible to stay "up to date" so effectively you asked to upgrade 9/10 times.

Categories