raisedragon / pircbotx

Automatically exported from code.google.com/p/pircbotx
0 stars 0 forks source link

Connecting to Twitch.tv may result in IndexOutOfBoundsException #234

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. made a configuration to connect my bot.
The code is straight forward and doesn't make me suspect there's an issue.

<code>
configuration = new Configuration.Builder<PircBotX>()
    .setName( NAME )
    .setServerHostname( SERVER ) 
    .setServerPassword( OAUTH )
    .setServerPort( PORT )
    .addAutoJoinChannel( CHANNEL )
    .addListener( this ) 
    .buildConfiguration();
mainPircBotX = new PircBotX( configuration );
mainPircBotX.startBot();
</code>

2. ran the bot and connected to Twitch.tv
Though the connection works and the bot receives messages from the Twitch 
chatroom, while connecting it throws an IndexOutOfBoundsException. Here's the 
log form beginning to end:

<log>
[main] INFO org.pircbotx.PircBotX - Connected to server.
[main] INFO org.pircbotx.output.OutputRaw - PASS oauth:xxxxxxxxxxxx
[main] INFO org.pircbotx.output.OutputRaw - NICK mybot
[main] INFO org.pircbotx.output.OutputRaw - USER PircBotX 8 * :PircBotX 2.0.1, 
a fork of PircBot, the Java IRC bot - pircbotx.googlecode.com
[main] INFO org.pircbotx.InputParser - :tmi.twitch.tv 001 mybot :Welcome, GLHF!
[main] INFO org.pircbotx.output.OutputRaw - JOIN #mychannel 
[main] INFO org.pircbotx.InputParser - :tmi.twitch.tv 002 mybot :Your host is 
tmi.twitch.tv
[main] INFO org.pircbotx.InputParser - :tmi.twitch.tv 003 mybot :This server is 
rather new
[main] INFO org.pircbotx.InputParser - :tmi.twitch.tv 004 mybot :-
[main] ERROR org.pircbotx.PircBotX - Exception encountered when parsing line
java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
    at java.util.ArrayList.rangeCheck(Unknown Source)
    at java.util.ArrayList.get(Unknown Source)
    at org.pircbotx.ServerInfo.parse004(ServerInfo.java:113)
    at org.pircbotx.ServerInfo.parse(ServerInfo.java:106)
    at org.pircbotx.InputParser.processServerResponse(InputParser.java:709)
    at org.pircbotx.InputParser.handleLine(InputParser.java:323)
    at org.pircbotx.PircBotX.startLineProcessing(PircBotX.java:275)
    at org.pircbotx.PircBotX.connect(PircBotX.java:236)
    at org.pircbotx.PircBotX.startBot(PircBotX.java:151)
    at bot.miek.main.Bot.connectBot(Bot.java:82)
    at bot.miek.main.Bot.<init>(Bot.java:49)
    at bot.miek.main.Main.<init>(Main.java:14)
    at bot.miek.main.Main.main(Main.java:8)
[main] INFO org.pircbotx.InputParser - :tmi.twitch.tv 375 mybot :-
[main] INFO org.pircbotx.InputParser - :tmi.twitch.tv 372 mybot :You are in a 
maze of twisty passages, all alike.
[main] INFO org.pircbotx.InputParser - :tmi.twitch.tv 376 mybot :>
[main] INFO org.pircbotx.InputParser - :mybot!mybot@mybot.tmi.twitch.tv JOIN 
#mychannel
[main] INFO org.pircbotx.output.OutputRaw - WHO #mychannel
[main] INFO org.pircbotx.output.OutputRaw - MODE #mychannel
[main] INFO org.pircbotx.InputParser - :mybot.tmi.twitch.tv 353 mybot = 
#mychannel :mybot mychannel
[main] INFO org.pircbotx.InputParser - :mybot.tmi.twitch.tv 366 mybot 
#mychannel :End of /NAMES list
[main] INFO org.pircbotx.InputParser - :jtv MODE #mychannel +o mybot
[main] INFO org.pircbotx.InputParser - :jtv MODE #mychannel +o mychannel
[main] INFO org.pircbotx.InputParser - :tmi.twitch.tv 421 mybot WHO :Unknown 
command
[main] INFO org.pircbotx.InputParser - PING :tmi.twitch.tv
[listenerPool0-thread7] INFO org.pircbotx.output.OutputRaw - PONG tmi.twitch.tv
</log>

====What is the expected output? What do you see instead?====
When I run Pircbot 1.5.0 and connect with the same account into Twitch.tv I get 
the following output

<log>
1424604390648 *** Connected to server.
1424604390650 >>>PASS oauth:xxxxxxxxxxxxx
1424604390651 >>>NICK mybot
1424604390651 >>>USER PircBot 8 * :PircBot 1.5.0 Java IRC Bot - www.jibble.org
1424604391090 :tmi.twitch.tv 001 mybot :Welcome, GLHF!
1424604391090 :tmi.twitch.tv 002 mybot :Your host is tmi.twitch.tv
1424604391090 :tmi.twitch.tv 003 mybot :This server is rather new
1424604391090 :tmi.twitch.tv 004 mybot :-
1424604391091 *** Logged onto server.
1424604391091 :tmi.twitch.tv 375 mybot :-
1424604391091 :tmi.twitch.tv 372 mybot :You are in a maze of twisty passages, 
all alike.
1424604391091 :tmi.twitch.tv 376 mybot :>
1424604391092 >>>JOIN #mychannel
1424604391446 :mybot!mybot@mybot.tmi.twitch.tv JOIN #mychannel
1424604391446 :mybot.tmi.twitch.tv 353 mybot = #mychannel :mybot
1424604391446 :mybot.tmi.twitch.tv 366 mybot #mychannel :End of /NAMES list
1424604392775 >>>QUIT :
1424604392940 *** Disconnected.
</log>

Here I suspect pircbotx has an issue when logging into the server which should 
produce: "*** Logged onto server."

====What version of the product are you using? On what operating system?====
I am using pircbotx 2.0.1
Windows 7 ultimate x64
Intel Pentium G620 @ 2.6GHz
8 Gig RAM

IDE : Java Eclipse Luna
Version: Luna Service Release 1a (4.4.1)
Build id: 20150109-0600

====Please provide any additional information below.====
When setting up the bot, I had to modify the slf4j.jar logger to prevent a 
ClassDefNotFound exception. 
The only thing modified is an added "impl" folder with the StaticLogger and all 
that jazz.
Though the error doesn't come from the logger, if its related than I would like 
to know.
In case you want to see it here's a dropbox link:
https://www.dropbox.com/s/90vbctl27n9speb/slf4j-compiled.jar?dl=0

I hope I have provided enough information, GL HF!

Original issue reported on code.google.com by MichielM...@gmail.com on 22 Feb 2015 at 11:48

GoogleCodeExporter commented 9 years ago
This is fixed in the latest snapshot. See 
https://code.google.com/p/pircbotx/wiki/DevVersion

Original comment by Lord.Qua...@gmail.com on 22 Feb 2015 at 9:50

GoogleCodeExporter commented 9 years ago
Thank you very much for you time. 

Original comment by MichielM...@gmail.com on 22 Feb 2015 at 10:51