Marko
Marko

Reputation: 1337

Blank message dialog after exception is thrown

I'm learning Java, and I tried to make a simple client-server application. My server has GUI, and a button to start server. After it's clicked another thread is started. I call it main server thread because it deals with connections and handels clients. I also have button to shutdown server but not whole application. I close ServerSocket to interrupt this thread so I can stop server. I wanted message dialog to pop-up inf finally block to notify me that server stopped running. Here is little bit simplified and modified code of server's run method:

public void run(){
    try{
      JOptionPane.showMessageDialog(null,"begining");      
      ss = new ServerSocket(TCP_PORT);

    while(cont){

       Socket sock = ss.accept();
       exec.execute(new ServerThread(sock));

    }catch(SocketException soex){
      //JOptionPane.showMessageDialog(null,"SocketException");
    }finally{
      JOptionPane.showMessageDialog(null,"finally");
    }
    //JOptionPane.showMessageDialog(null,"after finally");
  }

First message dialog is shown correctly, but when some of other 3 dialogs pop-up due to exception I only get grey message dialog with title and window borders, but no message or any button. I cannot close it, I cannot close my application. It stucks there.

I'm using Ubuntu, and it compiled with open-jdk javac version "1.7.0_25", and run it using same version of java. I also tried version 1.6, and also Oracle 1.7.0_25 (both java and javac). Every time I get same result.

What is the problem here, and how can I solve it?

Upvotes: 0

Views: 982

Answers (1)

mKorbel
mKorbel

Reputation: 109823

Upvotes: 3

Related Questions