This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 140481 - jButton functionality in "Java Desktop Application" is having problem
Summary: jButton functionality in "Java Desktop Application" is having problem
Status: RESOLVED WONTFIX
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: All Windows XP
: P3 blocker (vote)
Assignee: issues@guibuilder
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-17 11:00 UTC by mail2max1982
Modified: 2008-07-29 13:15 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Program for reproducing the scenario (407.83 KB, text/plain)
2008-07-21 15:55 UTC, mail2max1982
Details
Netbeans Project (1.01 MB, text/plain)
2008-07-22 09:58 UTC, mail2max1982
Details
Netbeans Project (216.94 KB, text/plain)
2008-07-22 09:58 UTC, mail2max1982
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mail2max1982 2008-07-17 11:00:32 UTC
Hi,

i created a basic Java Desktop Application and created a button, jButton1 and in the Action Performed
function i wrote the below code...

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

                Test t = new Test();
                System.out.println("Starting FTP...");
                t.main(null);
                System.out.println("FTP Completed...");
       
    }

But on clicking the button it hangs at the following location :-
                        ftp.connect( server ); in Utilities class.


But if i compile and Run Test.java , it works perfectly fine.
i don't know why the same code hangs in jButton1ActionPerformed() function.


please help...


package ftpclient;

public class Test
{
    public static void main(String args[])
    {
        Utilities utilities = new Utilities();
        String server = "snv";
        String username = "xlc";
        String password = "pass";
        String remoteFolder = "testftp";
        utilities.targetFileWithFolder = "C:\\1\\Test\\xyz.zip";
        String localZipFileWithPath = utilities.targetFileWithFolder;
        utilities.putFilesToServer(server, username, password, remoteFolder, localZipFileWithPath);
       
    }

}





package ftpclient;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import org.apache.commons.net.ftp.FTP;
import org.apache.commons.net.ftp.FTPClient;

public class Utilities
{

        public String sourceFolder = "";
        public String targetFileWithFolder = "";
        public long  size          = 0;
        public int   numOfFiles    = 0;
       

   
        public void putFilesToServer( String server,
                        String username,
                        String password,
                        String remoteFolder,
                        String localZipFileWithPath)
        {
                try
                {
                        // Connect and logon to FTP Server
                        FTPClient ftp = new FTPClient();
                        System.out.println("222");
                        ftp.connect( server );
// this SOP doesnt got displayed . it hangs on previous line i.e. at connect(server)...
                        System.out.println("333");
                        ftp.login( username, password );
                        System.out.println("Connected to " + server + ".");
                        System.out.print(ftp.getReplyString());
                        ftp.changeWorkingDirectory( remoteFolder );
                       
                        ftp.setFileType(FTP.BINARY_FILE_TYPE);
                        ftp.enterLocalPassiveMode();
                        ftp.setRemoteVerificationEnabled(false);
                        ftp.setDataTimeout(100000000);
                        ftp.storeFile("rpl.zip", new FileInputStream(localZipFileWithPath));
                               
                        System.out.println("FTP Done...");
                        // Logout from the FTP Server and disconnect
                        ftp.logout();
                        ftp.disconnect();

                }
                catch( Exception e )
                {
                        e.printStackTrace();
                }
               
        }
   
}
Comment 1 Jan Stola 2008-07-18 17:08:26 UTC
I am sorry, I don't understand how to reproduce your issue.

> But on clicking the button it hangs at the following location :-
> ftp.connect( server ); in Utilities class.

Could you, please, provide some context? Where/when do you click the button? The assigned event handlers are not 
invoked during design time (e.g. inside the IDE) and you wrote that it works in run time (outside the IDE).
Comment 2 mail2max1982 2008-07-21 15:55:38 UTC
Created attachment 65146 [details]
Program for reproducing the scenario
Comment 3 mail2max1982 2008-07-21 15:58:23 UTC
i have attached the files which will reproduce the scenario
in the Test.java just change the values of the below String variables .
server, username, password, remoteFolder 
Comment 4 Jan Stola 2008-07-21 16:35:35 UTC
Could you, please, provide _exact_ description of the steps to reproduce. I still don't understand what is this issue 
about. Could you, please, read and answer questions from my previous comment?
Comment 5 mail2max1982 2008-07-22 09:58:00 UTC
Created attachment 65201 [details]
Netbeans Project
Comment 6 mail2max1982 2008-07-22 09:58:11 UTC
Created attachment 65202 [details]
Netbeans Project
Comment 7 mail2max1982 2008-07-22 10:42:45 UTC
please import the entire FTPclient project which i have attached now (the latest one) and then build it and run it . 
there is ONLY one button, click it .
BUT before running it,,, change the varaible names... 
server, username, password, remoteFolder . it should be remote machine where you need to do FTP.

please revert back to me in case of any confusion
Comment 8 Jan Stola 2008-07-22 12:53:25 UTC
I am sorry, I don't know why the execution hangs on your machine. It works correctly on my machine.

On the other hand, this issue has nothing to do with GUI builder or NetBeans => closing as invalid.
Comment 9 mail2max1982 2008-07-26 16:36:38 UTC
Hi,
can u plz suggest, as to which topic this problem related to.
bcoz i m getting this problem.
by the way , did u tried with FTP on to remote unix machine.
Comment 10 Jan Stola 2008-07-28 14:25:42 UTC
Finally, I was able to reproduce this issue. It is related to system proxy settings and to their usage in Java Desktop 
Application. See my last comment (Jul 28 13:10:10) in issue 134745 for explanation and workarounds.
Comment 11 mail2max1982 2008-07-28 15:18:23 UTC
o wow!!! it worked.
thank you so much :-)
Comment 12 Jan Stola 2008-07-29 13:15:31 UTC
Closing this issue as "will not fix" because it is caused by suspicious feature of Swing Application Framework.