File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Sockets and Internet Protocols and the fly likes Null pointer Exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Null pointer Exception" Watch "Null pointer Exception" New topic

Null pointer Exception

Mikael Fox

Joined: Mar 22, 2009
Posts: 23
I am having a null pointer error, don't know where it came out. Can someone check this code for me please:

The error is in the sendBytes methods, I have put a comment over there, actually there are two null errors. Line 57 and 64.



Thanks a lot in advance.

This is the code:

This is the error:

at ignisftpv3.FTPClient.sendBytes(
at ignisftpv3.FTPClientInterface.btnSendActionPerformed(
at ignisftpv3.FTPClientInterface.access$100(
at ignisftpv3.FTPClientInterface$2.actionPerformed(
at javax.swing.AbstractButton.fireActionPerformed(
at javax.swing.AbstractButton$Handler.actionPerformed(
at javax.swing.DefaultButtonModel.fireActionPerformed(
at javax.swing.DefaultButtonModel.setPressed(
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(
at java.awt.Component.processMouseEvent(
at javax.swing.JComponent.processMouseEvent(
at java.awt.Component.processEvent(
at java.awt.Container.processEvent(
at java.awt.Component.dispatchEventImpl(
at java.awt.Container.dispatchEventImpl(
at java.awt.Component.dispatchEvent(
at java.awt.LightweightDispatcher.retargetMouseEvent(
at java.awt.LightweightDispatcher.processMouseEvent(
at java.awt.LightweightDispatcher.dispatchEvent(
at java.awt.Container.dispatchEventImpl(
at java.awt.Window.dispatchEventImpl(
at java.awt.Component.dispatchEvent(
at java.awt.EventQueue.dispatchEvent(
at java.awt.EventDispatchThread.pumpOneEventForFilters(
at java.awt.EventDispatchThread.pumpEventsForFilter(
at java.awt.EventDispatchThread.pumpEventsForHierarchy(
at java.awt.EventDispatchThread.pumpEvents(
at java.awt.EventDispatchThread.pumpEvents(
BUILD SUCCESSFUL (total time: 3 minutes 10 seconds)
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

The pw and out variables are null because you never assign them a value. Sure, you have some code which would assign them values if it were executed, but it wasn't executed. (You can tell that because pw and out are null.)

If you look at your stderr output, you should be able to see why that code wasn't executed.
I agree. Here's the link:
subject: Null pointer Exception
It's not a secret anymore!