null pointer exception
951645Jul 28 2012 — edited Aug 27 2012hi everybody
i want to make a durable subscriber jms aplication and i have make a test program to see if all is fine
but when i publish the event i get a nullpointerexception i don' t understand why ?
public class TestAgendaDurable extends junit.framework.TestCase{
private SynchronousQueue<RendezVous> queue1,queue2,queue3;
public void test_souscripteur_durable(){
Souscription s1=null,s2=null,s3=null;
PriseDeRDV priseDeRDV=null;
queue1 = new SynchronousQueue<RendezVous>();
try{
priseDeRDV = new PriseDeRDV("agenda_tests");
RendezVous r1 = new RendezVous(new Date(40000L),"test");
if (priseDeRDV != null && r1 != null)
{
priseDeRDV.publier(r1); <========================= here i get a nullpointerexception
}
// System.out.println("envoi !!!" + r1);
// s1 = new SouscriptionDurable("agenda_tests","durable3"){
// public void onMessage(Message message){
// try{
// RendezVous rdv = (RendezVous)((ObjectMessage)message).getObject();
// System.out.println("recu !!!" + rdv);
// queue1.put(rdv);
// }catch(Exception e) {
// }
// }
// };
// RendezVous r = queue1.poll(2L, TimeUnit.SECONDS);
// assertNotNull(" le rendezVous n'est pas reçu, en moins de 2 sec ?",r);
// System.out.println("recu !!!" + r);
// assertTrue(" le rendezVous n'est pas le bon ?",r.equals(r1));
}catch(Exception e){
fail("exception inattendue : " + e.getClass().getName()); <=========== the line which provoke the exception i can' t remove
}finally{
try{s1.close();}catch(Exception e){}
try{priseDeRDV.close();}catch(Exception e){}
Edited by: migacti on 28 juil. 2012 08:22