Closed norrs closed 13 years ago
Nja, jeg la inn den der fordi ellers kræsjer den på nullpointer i bufferlesinga.. Er usikker på om den funker helt 100%, men det er derfra jeg har den erroren iallefall
Hmf, I tracked the NPE to something that has to do with:
public void fireEvent(Event event) {
for(IRCEventListener listener : eventListeners) {
listener.receiveEvent(event);
}
}
which is located in Network.java (model.network package). Race condition where the eventListners isn't ready yet?
no.fictive.irclib.model.network.Connection
Isn't this caused by the readLine being null, reaching a NPE in getBytes() ? If this is the case, then this might be solved by doing this:
public void run() {
while (running) {
try {
String readLine = reader.readLine();
if(readLine == null) continue;
String line = new String(readLine().getBytes(), "UTF-8");
network.gotResponse();
eventHandler.handleEvent(line);
} catch (IOException e) {
logger.error("Connection broken.");
close();
} catch (NullPointerException e) {
logger.error("Pipe empty.");
close();
}
}
close();
}
Any thoughts?
May be a race condition, since the bot starts running before plugins are completely ready.
I refer to a previously mention trait of some of the external plugins; Git, Calendar and possibly MailAnnounce, not sure about the last one. They take a long time to init, so they are pushed down on the list and we run OnlineGuru before running new PluginManager, as far as I know.
The proposed fix for that is to make all gathering of information in these plugins threaded to allow initialization to go "instantly". This has been done for eg. the Middag plugin.
I put the catch on NullPointerException in the trycatch in run because sometimes the race condition to init the plugin would not succeed before the plugin attempted to be used, as far as I can tell. If you didn't have the catch there, the bot would crash alot more.
I propse adding logging to it though.
This isn't related to the library, but the bot. Closing this issue.
2011-10-24 21:21:34,356 - no.ntnu.online.onlineguru.OnlineGuru - INFO - freenode: :Rockj!rockj@rockj.net PRIVMSG onlineguru :git list 2011-10-24 21:21:34,357 - no.fictive.irclib.model.network.Connection - ERROR - Pipe empty.
Is due to maybe "git list" tried to send an empty String and it causes the pipe to be empty and then crashing?