Hi, To get the root blip id in your scenario - wave.appendBlip().getDocument().append(wavelet.getRootBlipId());
This would work because it does not require "context" of a grandparent blip. The reason that you are getting exception is because the context associated with an event callback only goes back its immediate parent. So in your case if the triggering event is resulted from a grandchild blip away from root, it will no longer has context to recreate the root blip when you invoked wavelet.getRootBlip() - thus you will get a null reference. Hope it helps, Austin 2009/10/22 Bálint Kriván <[email protected]> > Reply to myself and others: I think this is related to > http://code.google.com/p/google-wave-resources/issues/detail?id=200 . > > 2009/10/22 Bálint Kriván <[email protected]> > > Hi! >> I have this little chunk of code: >> >> public void debug(RobotMessageBundle bundle, String msg) >> >> { >> >> List<String> list = new ArrayList(); >> >> list.add("<myaddress in google wave>"); >> >> Wavelet wave = bundle.createWavelet(list); >> >> wave.appendBlip().getDocument().append(msg); >> >> } >> >> @Override >> >> public void processEvents(RobotMessageBundle robotMessageBundle) { >> >> Wavelet wavelet = robotMessageBundle.getWavelet(); >> >> for (Event event : robotMessageBundle.getEvents()) { >> >> Blip currentBlip = event.getBlip(); >> >> switch (event.getType()) { >> >> case BLIP_SUBMITTED: >> >> debug(robotMessageBundle, >>> String.valueOf(wavelet.getRootBlip().getBlipId())); // line 46! >> >> } >> >> } >> >> } >> >> >> So when I add a blip to the wavelet where the robot is, it should open a >> new wave with me and send the id of the root blip (The top blip in the >> wavelet). >> But if this blip isn't right after the root blip (so the very first Reply >> button) then I've got a NullPointerException: >> >> java.lang.NullPointerException >> >> at com.google.wave.api.impl.BlipImpl.getBlipId(BlipImpl.java:56) >> >> at robot.MainServlet.processEvents(MainServlet.java:46) >> >> at >>> com.google.wave.api.AbstractRobotServlet.doPost(AbstractRobotServlet.java:89) >> >> [...] >> >> >> What is the recommended way to access the very first blip (which is I >> guess the RootBlip)? >> >> Thanks for your help! >> >> -- >> Üdv, >> Kriván Bálint >> > > > > -- > Üdv, > Kriván Bálint > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Wave API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-wave-api?hl=en -~----------~----~----~----~------~----~------~--~---
