Results 1 to 6 of 6
- 02-11-2012, 11:14 PM #1
Weird error(connecting to a ServerSocket)
Line 12 is connecting to a ServerSocket. If am trying to connect to a server that don't exist, I get weird error.
If the server do not exist, ConnectException is thrown, however the catch block is not picking it up. And the program is frozen. How is that possible?
Java Code:getnewFiles.addActionListener(new ActionListener () { @Override public void actionPerformed(ActionEvent e) { disableAll (); int updates; try { updates = client.checkNews (); } catch (ClassNotFoundException | IOException e1) { processFailed (e1); enableAll (); return; } ... enableAll (); } });
- 02-11-2012, 11:32 PM #2
Re: Weird error(connecting to a ServerSocket)
Change the catch to be for Exception and see what happens.
Also add a call to printStackTrace in the catch block to get more details.
Does the posted code compile? I've never seen a catch like on line 14
Are you using an IDE that ignores compiler errors?Last edited by Norm; 02-11-2012 at 11:35 PM.
- 02-12-2012, 01:50 AM #3
Re: Weird error(connecting to a ServerSocket)
Changing the catch to Exception solved the problem. Its a bit odd, because the API never mention this.
Line 14 is valid btw.
- 02-12-2012, 01:56 AM #4
Re: Weird error(connecting to a ServerSocket)
What version of the javac compiler are you using?
- 02-12-2012, 03:00 AM #5
Re: Weird error(connecting to a ServerSocket)
JDK 1.7.
javac.exe version 7.0.20.13
- 02-12-2012, 03:18 AM #6
Similar Threads
-
BlueJ help! weird error text meesed up
By linux1man in forum Other IDEsReplies: 6Last Post: 02-07-2013, 03:54 PM -
Weird Error With Methods
By skaterboy987 in forum New To JavaReplies: 15Last Post: 10-17-2011, 03:45 AM -
error while connecting
By jyothi_tallapaneni in forum NetworkingReplies: 0Last Post: 04-15-2010, 08:01 AM -
[SOLVED] Simple Calculator Applet Weird Error
By sari in forum New To JavaReplies: 5Last Post: 01-28-2009, 04:57 AM -
Weird Error?
By sciguy77 in forum New To JavaReplies: 4Last Post: 01-20-2009, 02:32 AM


1Likes
LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks