You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Hector (JIRA)" <ji...@apache.org> on 2009/11/25 18:28:39 UTC

[jira] Created: (NET-301) NullPointerException in method SocketClient.getLocalAddress()

NullPointerException in method SocketClient.getLocalAddress()
-------------------------------------------------------------

                 Key: NET-301
                 URL: https://issues.apache.org/jira/browse/NET-301
             Project: Commons Net
          Issue Type: Bug
    Affects Versions: 2.0
         Environment: Sun SPARC Ultra-5, Solaris 8
java version "1.3.1_10"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_10-b03)
Java HotSpot(TM) Client VM (build 1.3.1_10-b03, mixed mode)
            Reporter: Hector


Hello,

I'm new with Java (well, I have develop some programs, but not so hard....until now) and I'm trying to create an applet which can open an ftp connection from the client side to the server one, and download several files (I don't know if it's the best way to do what I want, but as far as I have read in internet, this is the most common and easy method used by many people).

The problem is about the FTPClient class:
I am able to connect, logon, set transfer mode, change the working directory, list the names of the directory...but when I try to perform a simple call to the  "retrieveFile (remote, local)" method, I'm getting a NullPointerException (the call to that method is done after clicking on a download button):

Exception in thread "AWT-EventQueue-2" java.lang.NullPointerException
	at org.apache.commons.net.SocketClient.getLocalAddress(SocketClient.java:441)
	at org.apache.commons.net.ftp.FTPClient._openDataConnection_(FTPClient.java:447)
	at org.apache.commons.net.ftp.FTPClient.retrieveFile(FTPClient.java:1257)
	at Applet1.jButton1_actionPerformed(Applet1.java:229)
	at Applet1.access$100(Applet1.java:21)
	at Applet1$3.actionPerformed(Applet1.java:95)
	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
	at java.awt.Component.processMouseEvent(Unknown Source)
	at javax.swing.JComponent.processMouseEvent(Unknown Source)
	at java.awt.Component.processEvent(Unknown Source)
	at java.awt.Container.processEvent(Unknown Source)
	at java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)


And the code is very simple:

String reply;    		
boolean success;
String path = new String ("PATH_TO_REMOTE_FILE");
 						
try
{
	fich_local = new File (jTextField1.getText () + "/Local_file.txt");
	local_file = new FileOutputStream (fich_local);
	String remote_file = new String (path + "/Remote_file.txt");
 				
	ftp.connect("SERVER");
	reply = ftp.getReplyString();
	System.out.println(reply);
					
	ftp.login("USER","PASS");
	reply = ftp.getReplyString();
	System.out.println(reply);
					
	ftp.setFileType(FTP.ASCII_FILE_TYPE);
	reply = ftp.getReplyString();
	System.out.println(reply);
					
	ftp.changeWorkingDirectory(path);
	reply = ftp.getReplyString();
	System.out.println(reply);
					
	reply = ftp.printWorkingDirectory();
	System.out.println(reply);
					
	success = ftp.retrieveFile(remote_file,  local_file);
	System.out.println("Status: " + success + " -- Remote File: " + remote_file + " -- Local File: " + fich_local.getAbsolutePath ());
}
catch (FileNotFoundException fnfe)
{
	fnfe.printStackTrace ();
}
catch (IOException ioe) 
{					
       	ioe.printStackTrace ();
}
catch (Exception e)
{
	e.printStackTrace ();
}

The remote server, directory and file whithin is included the "Remote_file.txt" exists, and the print line shows all this info if I catch the "NullPointerException" (also shows a "false" when calling to the success variable).
I have googled a lot (and still googling), but found almost nothing useful and I would appreciate a lot any help (also if you need additional info, please let me know).
Thanks in advance

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (NET-301) NullPointerException in method SocketClient.getLocalAddress()

Posted by "Hector (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/NET-301?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hector updated NET-301:
-----------------------

    Description: 
Hello,

I'm new with Java (well, I have develop some programs, but not so hard....until now) and I'm trying to create an applet which can open an ftp connection from the client side to the server one, and download several files (I don't know if it's the best way to do what I want, but as far as I have read in internet, this is the most common and easy method used by many people).

The problem is about the FTPClient class:
I am able to connect, logon, set transfer mode, change the working directory, list the names of the directory...but when I try to perform a simple call to the  "retrieveFile (remote, local)" method, I'm getting a NullPointerException (the call to that method is done after clicking on a download button):

Exception in thread "AWT-EventQueue-2" java.lang.NullPointerException
	at org.apache.commons.net.SocketClient.getLocalAddress(SocketClient.java:441)
	at org.apache.commons.net.ftp.FTPClient._openDataConnection_(FTPClient.java:447)
	at org.apache.commons.net.ftp.FTPClient.retrieveFile(FTPClient.java:1257)
	at Applet1.jButton1_actionPerformed(Applet1.java:229)
	at Applet1.access$100(Applet1.java:21)
	at Applet1$3.actionPerformed(Applet1.java:95)
	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
	at java.awt.Component.processMouseEvent(Unknown Source)
	at javax.swing.JComponent.processMouseEvent(Unknown Source)
	at java.awt.Component.processEvent(Unknown Source)
	at java.awt.Container.processEvent(Unknown Source)
	at java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)


And the code is very simple:

String reply;    		
boolean success;
String path = new String ("PATH_TO_REMOTE_FILE");
 						
try
{
fich_local = new File (jTextField1.getText () + "/Local_file.txt");
local_file = new FileOutputStream (fich_local);
String remote_file = new String (path + "/Remote_file.txt");

ftp.connect("SERVER");
reply = ftp.getReplyString();
System.out.println(reply);

ftp.login("USER","PASS");
reply = ftp.getReplyString();
System.out.println(reply);

ftp.setFileType(FTP.ASCII_FILE_TYPE);
reply = ftp.getReplyString();
System.out.println(reply);

ftp.changeWorkingDirectory(path);
reply = ftp.getReplyString();
System.out.println(reply);

reply = ftp.printWorkingDirectory();
System.out.println(reply);

success = ftp.retrieveFile(remote_file,  local_file);
System.out.println("Status: " + success + " -- Remote File: " + remote_file + " -- Local File: " + fich_local.getAbsolutePath ());
}
catch (FileNotFoundException fnfe)
{
	fnfe.printStackTrace ();
}
catch (IOException ioe) 
{					
       	ioe.printStackTrace ();
}
catch (Exception e)
{
	e.printStackTrace ();
}

The remote server, directory and file whithin is included the "Remote_file.txt" exists, and the print line shows all this info if I catch the "NullPointerException" (also shows a "false" when calling to the success variable).
I have googled a lot (and still googling), but found almost nothing useful and I would appreciate a lot any help (also if you need additional info, please let me know).
Thanks in advance

  was:
Hello,

I'm new with Java (well, I have develop some programs, but not so hard....until now) and I'm trying to create an applet which can open an ftp connection from the client side to the server one, and download several files (I don't know if it's the best way to do what I want, but as far as I have read in internet, this is the most common and easy method used by many people).

The problem is about the FTPClient class:
I am able to connect, logon, set transfer mode, change the working directory, list the names of the directory...but when I try to perform a simple call to the  "retrieveFile (remote, local)" method, I'm getting a NullPointerException (the call to that method is done after clicking on a download button):

Exception in thread "AWT-EventQueue-2" java.lang.NullPointerException
	at org.apache.commons.net.SocketClient.getLocalAddress(SocketClient.java:441)
	at org.apache.commons.net.ftp.FTPClient._openDataConnection_(FTPClient.java:447)
	at org.apache.commons.net.ftp.FTPClient.retrieveFile(FTPClient.java:1257)
	at Applet1.jButton1_actionPerformed(Applet1.java:229)
	at Applet1.access$100(Applet1.java:21)
	at Applet1$3.actionPerformed(Applet1.java:95)
	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
	at java.awt.Component.processMouseEvent(Unknown Source)
	at javax.swing.JComponent.processMouseEvent(Unknown Source)
	at java.awt.Component.processEvent(Unknown Source)
	at java.awt.Container.processEvent(Unknown Source)
	at java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)


And the code is very simple:

String reply;    		
boolean success;
String path = new String ("PATH_TO_REMOTE_FILE");
 						
try
{
	fich_local = new File (jTextField1.getText () + "/Local_file.txt");
	local_file = new FileOutputStream (fich_local);
	String remote_file = new String (path + "/Remote_file.txt");
 				
	ftp.connect("SERVER");
	reply = ftp.getReplyString();
	System.out.println(reply);
					
	ftp.login("USER","PASS");
	reply = ftp.getReplyString();
	System.out.println(reply);
					
	ftp.setFileType(FTP.ASCII_FILE_TYPE);
	reply = ftp.getReplyString();
	System.out.println(reply);
					
	ftp.changeWorkingDirectory(path);
	reply = ftp.getReplyString();
	System.out.println(reply);
					
	reply = ftp.printWorkingDirectory();
	System.out.println(reply);
					
	success = ftp.retrieveFile(remote_file,  local_file);
	System.out.println("Status: " + success + " -- Remote File: " + remote_file + " -- Local File: " + fich_local.getAbsolutePath ());
}
catch (FileNotFoundException fnfe)
{
	fnfe.printStackTrace ();
}
catch (IOException ioe) 
{					
       	ioe.printStackTrace ();
}
catch (Exception e)
{
	e.printStackTrace ();
}

The remote server, directory and file whithin is included the "Remote_file.txt" exists, and the print line shows all this info if I catch the "NullPointerException" (also shows a "false" when calling to the success variable).
I have googled a lot (and still googling), but found almost nothing useful and I would appreciate a lot any help (also if you need additional info, please let me know).
Thanks in advance


> NullPointerException in method SocketClient.getLocalAddress()
> -------------------------------------------------------------
>
>                 Key: NET-301
>                 URL: https://issues.apache.org/jira/browse/NET-301
>             Project: Commons Net
>          Issue Type: Bug
>    Affects Versions: 2.0
>         Environment: Sun SPARC Ultra-5, Solaris 8
> java version "1.3.1_10"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_10-b03)
> Java HotSpot(TM) Client VM (build 1.3.1_10-b03, mixed mode)
>            Reporter: Hector
>   Original Estimate: 360h
>  Remaining Estimate: 360h
>
> Hello,
> I'm new with Java (well, I have develop some programs, but not so hard....until now) and I'm trying to create an applet which can open an ftp connection from the client side to the server one, and download several files (I don't know if it's the best way to do what I want, but as far as I have read in internet, this is the most common and easy method used by many people).
> The problem is about the FTPClient class:
> I am able to connect, logon, set transfer mode, change the working directory, list the names of the directory...but when I try to perform a simple call to the  "retrieveFile (remote, local)" method, I'm getting a NullPointerException (the call to that method is done after clicking on a download button):
> Exception in thread "AWT-EventQueue-2" java.lang.NullPointerException
> 	at org.apache.commons.net.SocketClient.getLocalAddress(SocketClient.java:441)
> 	at org.apache.commons.net.ftp.FTPClient._openDataConnection_(FTPClient.java:447)
> 	at org.apache.commons.net.ftp.FTPClient.retrieveFile(FTPClient.java:1257)
> 	at Applet1.jButton1_actionPerformed(Applet1.java:229)
> 	at Applet1.access$100(Applet1.java:21)
> 	at Applet1$3.actionPerformed(Applet1.java:95)
> 	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
> 	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
> 	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
> 	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
> 	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
> 	at java.awt.Component.processMouseEvent(Unknown Source)
> 	at javax.swing.JComponent.processMouseEvent(Unknown Source)
> 	at java.awt.Component.processEvent(Unknown Source)
> 	at java.awt.Container.processEvent(Unknown Source)
> 	at java.awt.Component.dispatchEventImpl(Unknown Source)
> 	at java.awt.Container.dispatchEventImpl(Unknown Source)
> 	at java.awt.Component.dispatchEvent(Unknown Source)
> 	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
> 	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
> 	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
> 	at java.awt.Container.dispatchEventImpl(Unknown Source)
> 	at java.awt.Component.dispatchEvent(Unknown Source)
> 	at java.awt.EventQueue.dispatchEvent(Unknown Source)
> 	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
> 	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
> 	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
> 	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> 	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> 	at java.awt.EventDispatchThread.run(Unknown Source)
> And the code is very simple:
> String reply;    		
> boolean success;
> String path = new String ("PATH_TO_REMOTE_FILE");
>  						
> try
> {
> fich_local = new File (jTextField1.getText () + "/Local_file.txt");
> local_file = new FileOutputStream (fich_local);
> String remote_file = new String (path + "/Remote_file.txt");
> ftp.connect("SERVER");
> reply = ftp.getReplyString();
> System.out.println(reply);
> ftp.login("USER","PASS");
> reply = ftp.getReplyString();
> System.out.println(reply);
> ftp.setFileType(FTP.ASCII_FILE_TYPE);
> reply = ftp.getReplyString();
> System.out.println(reply);
> ftp.changeWorkingDirectory(path);
> reply = ftp.getReplyString();
> System.out.println(reply);
> reply = ftp.printWorkingDirectory();
> System.out.println(reply);
> success = ftp.retrieveFile(remote_file,  local_file);
> System.out.println("Status: " + success + " -- Remote File: " + remote_file + " -- Local File: " + fich_local.getAbsolutePath ());
> }
> catch (FileNotFoundException fnfe)
> {
> 	fnfe.printStackTrace ();
> }
> catch (IOException ioe) 
> {					
>        	ioe.printStackTrace ();
> }
> catch (Exception e)
> {
> 	e.printStackTrace ();
> }
> The remote server, directory and file whithin is included the "Remote_file.txt" exists, and the print line shows all this info if I catch the "NullPointerException" (also shows a "false" when calling to the success variable).
> I have googled a lot (and still googling), but found almost nothing useful and I would appreciate a lot any help (also if you need additional info, please let me know).
> Thanks in advance

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (NET-301) NullPointerException in method SocketClient.getLocalAddress()

Posted by "Rory Winston (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/NET-301?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rory Winston closed NET-301.
----------------------------

    Resolution: Incomplete

Need more info for this I'm afraid

> NullPointerException in method SocketClient.getLocalAddress()
> -------------------------------------------------------------
>
>                 Key: NET-301
>                 URL: https://issues.apache.org/jira/browse/NET-301
>             Project: Commons Net
>          Issue Type: Bug
>    Affects Versions: 2.0
>         Environment: Sun SPARC Ultra-5, Solaris 8
> java version "1.3.1_10"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_10-b03)
> Java HotSpot(TM) Client VM (build 1.3.1_10-b03, mixed mode)
>            Reporter: Hector
>   Original Estimate: 360h
>  Remaining Estimate: 360h
>
> Hello,
> I'm new with Java (well, I have develop some programs, but not so hard....until now) and I'm trying to create an applet which can open an ftp connection from the client side to the server one, and download several files (I don't know if it's the best way to do what I want, but as far as I have read in internet, this is the most common and easy method used by many people).
> The problem is about the FTPClient class:
> I am able to connect, logon, set transfer mode, change the working directory, list the names of the directory...but when I try to perform a simple call to the  "retrieveFile (remote, local)" method, I'm getting a NullPointerException (the call to that method is done after clicking on a download button):
> Exception in thread "AWT-EventQueue-2" java.lang.NullPointerException
> 	at org.apache.commons.net.SocketClient.getLocalAddress(SocketClient.java:441)
> 	at org.apache.commons.net.ftp.FTPClient._openDataConnection_(FTPClient.java:447)
> 	at org.apache.commons.net.ftp.FTPClient.retrieveFile(FTPClient.java:1257)
> 	at Applet1.jButton1_actionPerformed(Applet1.java:229)
> 	at Applet1.access$100(Applet1.java:21)
> 	at Applet1$3.actionPerformed(Applet1.java:95)
> 	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
> 	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
> 	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
> 	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
> 	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
> 	at java.awt.Component.processMouseEvent(Unknown Source)
> 	at javax.swing.JComponent.processMouseEvent(Unknown Source)
> 	at java.awt.Component.processEvent(Unknown Source)
> 	at java.awt.Container.processEvent(Unknown Source)
> 	at java.awt.Component.dispatchEventImpl(Unknown Source)
> 	at java.awt.Container.dispatchEventImpl(Unknown Source)
> 	at java.awt.Component.dispatchEvent(Unknown Source)
> 	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
> 	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
> 	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
> 	at java.awt.Container.dispatchEventImpl(Unknown Source)
> 	at java.awt.Component.dispatchEvent(Unknown Source)
> 	at java.awt.EventQueue.dispatchEvent(Unknown Source)
> 	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
> 	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
> 	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
> 	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> 	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> 	at java.awt.EventDispatchThread.run(Unknown Source)
> And the code is very simple:
> String reply;    		
> boolean success;
> String path = new String ("PATH_TO_REMOTE_FILE");
>  						
> try
> {
> fich_local = new File (jTextField1.getText () + "/Local_file.txt");
> local_file = new FileOutputStream (fich_local);
> String remote_file = new String (path + "/Remote_file.txt");
> ftp.connect("SERVER");
> reply = ftp.getReplyString();
> System.out.println(reply);
> ftp.login("USER","PASS");
> reply = ftp.getReplyString();
> System.out.println(reply);
> ftp.setFileType(FTP.ASCII_FILE_TYPE);
> reply = ftp.getReplyString();
> System.out.println(reply);
> ftp.changeWorkingDirectory(path);
> reply = ftp.getReplyString();
> System.out.println(reply);
> reply = ftp.printWorkingDirectory();
> System.out.println(reply);
> success = ftp.retrieveFile(remote_file,  local_file);
> System.out.println("Status: " + success + " -- Remote File: " + remote_file + " -- Local File: " + fich_local.getAbsolutePath ());
> }
> catch (FileNotFoundException fnfe)
> {
> 	fnfe.printStackTrace ();
> }
> catch (IOException ioe) 
> {					
>        	ioe.printStackTrace ();
> }
> catch (Exception e)
> {
> 	e.printStackTrace ();
> }
> The remote server, directory and file whithin is included the "Remote_file.txt" exists, and the print line shows all this info if I catch the "NullPointerException" (also shows a "false" when calling to the success variable).
> I have googled a lot (and still googling), but found almost nothing useful and I would appreciate a lot any help (also if you need additional info, please let me know).
> Thanks in advance

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (NET-301) NullPointerException in method SocketClient.getLocalAddress()

Posted by "Adam Scott (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/NET-301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12792758#action_12792758 ] 

Adam Scott commented on NET-301:
--------------------------------

IS THIS gonna be resolved?? what is the status?

> NullPointerException in method SocketClient.getLocalAddress()
> -------------------------------------------------------------
>
>                 Key: NET-301
>                 URL: https://issues.apache.org/jira/browse/NET-301
>             Project: Commons Net
>          Issue Type: Bug
>    Affects Versions: 2.0
>         Environment: Sun SPARC Ultra-5, Solaris 8
> java version "1.3.1_10"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_10-b03)
> Java HotSpot(TM) Client VM (build 1.3.1_10-b03, mixed mode)
>            Reporter: Hector
>   Original Estimate: 360h
>  Remaining Estimate: 360h
>
> Hello,
> I'm new with Java (well, I have develop some programs, but not so hard....until now) and I'm trying to create an applet which can open an ftp connection from the client side to the server one, and download several files (I don't know if it's the best way to do what I want, but as far as I have read in internet, this is the most common and easy method used by many people).
> The problem is about the FTPClient class:
> I am able to connect, logon, set transfer mode, change the working directory, list the names of the directory...but when I try to perform a simple call to the  "retrieveFile (remote, local)" method, I'm getting a NullPointerException (the call to that method is done after clicking on a download button):
> Exception in thread "AWT-EventQueue-2" java.lang.NullPointerException
> 	at org.apache.commons.net.SocketClient.getLocalAddress(SocketClient.java:441)
> 	at org.apache.commons.net.ftp.FTPClient._openDataConnection_(FTPClient.java:447)
> 	at org.apache.commons.net.ftp.FTPClient.retrieveFile(FTPClient.java:1257)
> 	at Applet1.jButton1_actionPerformed(Applet1.java:229)
> 	at Applet1.access$100(Applet1.java:21)
> 	at Applet1$3.actionPerformed(Applet1.java:95)
> 	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
> 	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
> 	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
> 	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
> 	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
> 	at java.awt.Component.processMouseEvent(Unknown Source)
> 	at javax.swing.JComponent.processMouseEvent(Unknown Source)
> 	at java.awt.Component.processEvent(Unknown Source)
> 	at java.awt.Container.processEvent(Unknown Source)
> 	at java.awt.Component.dispatchEventImpl(Unknown Source)
> 	at java.awt.Container.dispatchEventImpl(Unknown Source)
> 	at java.awt.Component.dispatchEvent(Unknown Source)
> 	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
> 	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
> 	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
> 	at java.awt.Container.dispatchEventImpl(Unknown Source)
> 	at java.awt.Component.dispatchEvent(Unknown Source)
> 	at java.awt.EventQueue.dispatchEvent(Unknown Source)
> 	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
> 	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
> 	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
> 	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> 	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> 	at java.awt.EventDispatchThread.run(Unknown Source)
> And the code is very simple:
> String reply;    		
> boolean success;
> String path = new String ("PATH_TO_REMOTE_FILE");
>  						
> try
> {
> fich_local = new File (jTextField1.getText () + "/Local_file.txt");
> local_file = new FileOutputStream (fich_local);
> String remote_file = new String (path + "/Remote_file.txt");
> ftp.connect("SERVER");
> reply = ftp.getReplyString();
> System.out.println(reply);
> ftp.login("USER","PASS");
> reply = ftp.getReplyString();
> System.out.println(reply);
> ftp.setFileType(FTP.ASCII_FILE_TYPE);
> reply = ftp.getReplyString();
> System.out.println(reply);
> ftp.changeWorkingDirectory(path);
> reply = ftp.getReplyString();
> System.out.println(reply);
> reply = ftp.printWorkingDirectory();
> System.out.println(reply);
> success = ftp.retrieveFile(remote_file,  local_file);
> System.out.println("Status: " + success + " -- Remote File: " + remote_file + " -- Local File: " + fich_local.getAbsolutePath ());
> }
> catch (FileNotFoundException fnfe)
> {
> 	fnfe.printStackTrace ();
> }
> catch (IOException ioe) 
> {					
>        	ioe.printStackTrace ();
> }
> catch (Exception e)
> {
> 	e.printStackTrace ();
> }
> The remote server, directory and file whithin is included the "Remote_file.txt" exists, and the print line shows all this info if I catch the "NullPointerException" (also shows a "false" when calling to the success variable).
> I have googled a lot (and still googling), but found almost nothing useful and I would appreciate a lot any help (also if you need additional info, please let me know).
> Thanks in advance

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (NET-301) NullPointerException in method SocketClient.getLocalAddress()

Posted by "Hector (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/NET-301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12793104#action_12793104 ] 

Hector commented on NET-301:
----------------------------

No, it is not resolved yet, but due to I was in a hurry I had to change the way to do it, forgetting java applets.

So if you consider it is appropiate to close this issue, I don't mind. Don't worry.

> NullPointerException in method SocketClient.getLocalAddress()
> -------------------------------------------------------------
>
>                 Key: NET-301
>                 URL: https://issues.apache.org/jira/browse/NET-301
>             Project: Commons Net
>          Issue Type: Bug
>    Affects Versions: 2.0
>         Environment: Sun SPARC Ultra-5, Solaris 8
> java version "1.3.1_10"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_10-b03)
> Java HotSpot(TM) Client VM (build 1.3.1_10-b03, mixed mode)
>            Reporter: Hector
>   Original Estimate: 360h
>  Remaining Estimate: 360h
>
> Hello,
> I'm new with Java (well, I have develop some programs, but not so hard....until now) and I'm trying to create an applet which can open an ftp connection from the client side to the server one, and download several files (I don't know if it's the best way to do what I want, but as far as I have read in internet, this is the most common and easy method used by many people).
> The problem is about the FTPClient class:
> I am able to connect, logon, set transfer mode, change the working directory, list the names of the directory...but when I try to perform a simple call to the  "retrieveFile (remote, local)" method, I'm getting a NullPointerException (the call to that method is done after clicking on a download button):
> Exception in thread "AWT-EventQueue-2" java.lang.NullPointerException
> 	at org.apache.commons.net.SocketClient.getLocalAddress(SocketClient.java:441)
> 	at org.apache.commons.net.ftp.FTPClient._openDataConnection_(FTPClient.java:447)
> 	at org.apache.commons.net.ftp.FTPClient.retrieveFile(FTPClient.java:1257)
> 	at Applet1.jButton1_actionPerformed(Applet1.java:229)
> 	at Applet1.access$100(Applet1.java:21)
> 	at Applet1$3.actionPerformed(Applet1.java:95)
> 	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
> 	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
> 	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
> 	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
> 	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
> 	at java.awt.Component.processMouseEvent(Unknown Source)
> 	at javax.swing.JComponent.processMouseEvent(Unknown Source)
> 	at java.awt.Component.processEvent(Unknown Source)
> 	at java.awt.Container.processEvent(Unknown Source)
> 	at java.awt.Component.dispatchEventImpl(Unknown Source)
> 	at java.awt.Container.dispatchEventImpl(Unknown Source)
> 	at java.awt.Component.dispatchEvent(Unknown Source)
> 	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
> 	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
> 	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
> 	at java.awt.Container.dispatchEventImpl(Unknown Source)
> 	at java.awt.Component.dispatchEvent(Unknown Source)
> 	at java.awt.EventQueue.dispatchEvent(Unknown Source)
> 	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
> 	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
> 	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
> 	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> 	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> 	at java.awt.EventDispatchThread.run(Unknown Source)
> And the code is very simple:
> String reply;    		
> boolean success;
> String path = new String ("PATH_TO_REMOTE_FILE");
>  						
> try
> {
> fich_local = new File (jTextField1.getText () + "/Local_file.txt");
> local_file = new FileOutputStream (fich_local);
> String remote_file = new String (path + "/Remote_file.txt");
> ftp.connect("SERVER");
> reply = ftp.getReplyString();
> System.out.println(reply);
> ftp.login("USER","PASS");
> reply = ftp.getReplyString();
> System.out.println(reply);
> ftp.setFileType(FTP.ASCII_FILE_TYPE);
> reply = ftp.getReplyString();
> System.out.println(reply);
> ftp.changeWorkingDirectory(path);
> reply = ftp.getReplyString();
> System.out.println(reply);
> reply = ftp.printWorkingDirectory();
> System.out.println(reply);
> success = ftp.retrieveFile(remote_file,  local_file);
> System.out.println("Status: " + success + " -- Remote File: " + remote_file + " -- Local File: " + fich_local.getAbsolutePath ());
> }
> catch (FileNotFoundException fnfe)
> {
> 	fnfe.printStackTrace ();
> }
> catch (IOException ioe) 
> {					
>        	ioe.printStackTrace ();
> }
> catch (Exception e)
> {
> 	e.printStackTrace ();
> }
> The remote server, directory and file whithin is included the "Remote_file.txt" exists, and the print line shows all this info if I catch the "NullPointerException" (also shows a "false" when calling to the success variable).
> I have googled a lot (and still googling), but found almost nothing useful and I would appreciate a lot any help (also if you need additional info, please let me know).
> Thanks in advance

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.