Swaraj
Posts: 24
Nickname: swaraj
Registered: Mar, 2002
|
|
urgent help needed please
|
Posted: Mar 10, 2002 11:18 PM
|
|
Hi I am using javax.comm api's serial port events in my application, i am using these events only. CD,CTS, and DSR. so whenever i fire an event i had to call a method from my base class. my problem is that whenever i call the method i am getting a nullpointer exception, the exception goes like this.
java.lang.NullPointerException
at myComport.serialEvent(TypicalPlayerApplet.java:1951)
at com.sun.comm.Win32SerialPort.sendCTSeventWin32SerialPort.java:559)
at com.sun.comm.NotificationThread.run Win32SerialPort.java:843)
Where TypicalPlayerApplet is my application and myComport is my method which implements serialporteventlistener.
I did not find much information on the web, about this. So i am posting this topic in this forum. Can anybody help me with this. My serialEvent code is like this..
public void serialEvent(SerialPortEvent ev) { if(this.port==null) { System.out.println(port.getName()+ "got serial event on a closed port"); return; } if(port.isCD()) // Carrier Detect { System.out.println("Carrier detect called-need to invoke the forward method"); owner.forward(); } else if(port.isCTS()) // Clear To Send { System.out.println("Clear To Send called-need to invoke the reverse method"); owner.reverse(); } else if(port.isDSR()) // Data Set Ready { System.out.println("Data Set Ready called-need to invoke the play method"); owner.play(); } }
in the above code port is my SerialPort object and owner is the application base class. the methods forward reverse and play are the methods written in side the base class. These work on a java media player.
Please help...
Thanks Swaraj
|
|