Write here the components/parts/sections of the software your suggestion is about.
This submission is on SteemJ - the Steem API Wrapper for Java
We have been using SteemJ for quite some time, to run a bot. Everything was running fine, and suddenly it started failing to work a day before giving this error in the logs : Could not find method login
I was summoned to find out the probable cause and fix it. I tried to connect to @dez1337 who is the one man army behind this project mostly, but did not hear back from him. Looking at his profile it appears he is not active here since few days, so I started analyzing the issue.
Upon investigating the logs more, the source of the error was focused at :
at eu.bittrade.libs.steemj.SteemJ.login(SteemJ.java:1493) ~[steemj-core-0.4.2-jar-with-dependencies.jar:0.4.2]
at eu.bittrade.libs.steemj.SteemJ.(SteemJ.java:136) ~[steemj-core-0.4.2-jar-with-dependencies.jar:0.4.2]
And it was the public constructor of SteemJ. I had no clue why it would fail suddenly, and I tried to debug to no avail. Then I suspected some change to the API and started looking for clues. Searching on steemit, I stumbled upon this post which indicated that the login api might have been removed. So I started thinking to find out a fix.
Analyzing the SteemJ constructor, I found out that, it tries to log in the constructor to find out the API details, however, they are not very relevant to the vote method which is used to upvote the posts. The same is true about the createComment method which is used to add a comment. So these methods would still work without the login methods being called. However, since the login method was being called in constructor, it needs change in the API.
So as part of this suggestion, I propose the SteemJ API change to remove the call to login method to cater to the new changes in Steem API so that it will work without any issue. Also do the necessary changes to find out the API names based on changes to Steem API.
The story does not end here :) I have an interim fix for you till this comes in the API.
I know we would not get the fix so soon in the API, so I had to find out a fix. Looking at the constructor, the only possibility is to not use the SteemJ class, because the constructor will be called anytime you use the object. So I created a cloned class of SteemJ, named it SteemJClone, defined its own constructor without using the call to the login method.
If you analyze the SteemJ constructor to figure out why it uses a login call, then you will see all it does is to find out the API names supported by the API. It looks like login is needed prior to finding the API details.
However, for our upvote or comment , these are not essential. So we can use our cloned class without any problem to resume our operation. So if you are using SteemJ, for time being, you can just create this cloned class, name it as SteemJClone, copy everything from SteemJ class ( You need to attach source to see the source code) , change the constructor to just initialize the communicationHandler object. And then use this new object in all your operations.
Mockups / Examples
So this is how your new class constructor would look like. And also similar changes would be needed in the API.
SteemJ API will be usable as is , after this change is implemented. Right now, if someone is using this project, they need to follow the interim fix that I described, till the fix in the API comes.
Posted on Utopian.io - Rewarding Open Source Contributors