raisedragon / pircbotx

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

NullPointerException in createSnapshot. (null key in entry: null=Channel()) #216

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Have user join as XXX OR be in channel as XXX.
2. Change nick to YYY.
3. User part/quit.
4. Join same channel. 
5. Change name to XXX. 
3. Part/quit.

What do you see instead?
http://pastebin.com/wsnFUvSa
(Steps included, IP removed)

What version of the product are you using? On what operating system?
Latest. This works on at least -68 and -70 of the dev snapshot.

Please provide any additional information below.
Happens on UnrealIRCd and on Charybdis.

Original issue reported on code.google.com by Tnade...@gmail.com on 10 Nov 2014 at 4:19

GoogleCodeExporter commented 9 years ago
Note that changing nick back and forth and then parting doesn't trigger this 
error. User have to part between.

Original comment by Tnade...@gmail.com on 10 Nov 2014 at 4:21

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Hmm you're right. This little addition to InputParserTest.java fails with a NPE

    @Test
    public void nickRenameWithQuitTest() throws IOException, IrcException {
        UserHostmask testUser1 = TestUtils.generateTestUserOtherHostmask(bot);
        UserHostmask testUser2 = new UserHostmask(bot, testUser1.getNick() + "2", testUser1.getLogin(), testUser1.getHostname());
        dao.createChannel("#testchannel");

        inputParser.handleLine(":" + testUser1.getHostmask() + " JOIN :#testChannel");
        inputParser.handleLine(":" + testUser1.getHostmask() + " NICK :" + testUser2.getNick());
        inputParser.handleLine(":" + testUser2.getHostmask() + " QUIT :");

        assertFalse(dao.containsUser(testUser1), "Renamed failed, user 1 still exists");
        assertFalse(dao.containsUser(testUser2), "quit failed, user 2 still exists");

        inputParser.handleLine(":" + testUser2.getHostmask() + " JOIN :#testChannel");
        inputParser.handleLine(":" + testUser2.getHostmask() + " NICK :" + testUser1.getNick());
        inputParser.handleLine(":" + testUser1.getHostmask() + " QUIT :");

        assertFalse(dao.containsUser(testUser1), "quit failed, user 1 still exists");
        assertFalse(dao.containsUser(testUser2), "Renamed failed, user 2 still exists");
    }

Original comment by hoerup1...@gmail.com on 10 Nov 2014 at 12:48

GoogleCodeExporter commented 9 years ago
I'm an idiot. Fixed in latest build. Should also fix other random DAO behavior 
as well

Java 101: If an object is being used as a map key, make sure the hashCode NEVER 
changes or else you'll be staring at a log file for a looong time scratching 
your head

Original comment by Lord.Qua...@gmail.com on 10 Nov 2014 at 2:12

GoogleCodeExporter commented 9 years ago
I seem to encounter a new issue (found by me failing to realise I already had a 
version running...)
If your nick is taken when you connect you get a nullpointer trying to parse 
the nickserv response.

[main] ERROR org.pircbotx.PircBotX - Exception encountered when parsing line 
:User1 MODE User1:+i
org.pircbotx.exception.DaoException: UnknownUser: User1
    at org.pircbotx.UserChannelDao.getUser(UserChannelDao.java:91)
    at org.pircbotx.InputParser.processMode(InputParser.java:866)
    at org.pircbotx.InputParser.processCommand(InputParser.java:577)
    at org.pircbotx.InputParser.handleLine(InputParser.java:356)
    at org.pircbotx.PircBotX.startLineProcessing(PircBotX.java:292)
    at org.pircbotx.PircBotX.connect(PircBotX.java:253)
    at org.pircbotx.PircBotX.startBot(PircBotX.java:154)
    at com.tnud.main.BotMain.runBot(BotMain.java:55)
    at com.tnud.main.BotMain.main(BotMain.java:27)

Original comment by Tnade...@gmail.com on 10 Nov 2014 at 3:43

GoogleCodeExporter commented 9 years ago
I cannot reproduce that exception. Next time it happens can you create a new 
issue with a full log?

Original comment by Lord.Qua...@gmail.com on 15 Nov 2014 at 10:14