Return-Path: Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: (qmail 20068 invoked from network); 19 Dec 2009 02:16:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 19 Dec 2009 02:16:42 -0000 Received: (qmail 46597 invoked by uid 500); 19 Dec 2009 02:16:41 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 46477 invoked by uid 500); 19 Dec 2009 02:16:41 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 46467 invoked by uid 99); 19 Dec 2009 02:16:41 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 19 Dec 2009 02:16:41 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 19 Dec 2009 02:16:39 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 27F28234C052 for ; Fri, 18 Dec 2009 18:16:18 -0800 (PST) Message-ID: <526751469.1261188978162.JavaMail.jira@brutus> Date: Sat, 19 Dec 2009 02:16:18 +0000 (UTC) From: "Adam Scott (JIRA)" To: issues@commons.apache.org Subject: [jira] Commented: (NET-301) NullPointerException in method SocketClient.getLocalAddress() In-Reply-To: <888908165.1259170119616.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on 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.