jQuery in Action, 3rd edition
The moose likes Java in General and the fly likes Print table code....  shuts down application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Print table code....  shuts down application" Watch "Print table code....  shuts down application" New topic

Print table code.... shuts down application

David Shepherd
Ranch Hand

Joined: Mar 02, 2001
Posts: 35
Does anyone see a problem with this code. It seems to occasionally cause my program to just quit. I only use it for testing but I can't find anything wrong.

public static void printTableData(Vector v)
{System.out.println(" --- Table Data ----------------------");
{ for(int i =0; i<v.size(); i++)>
{int tempLength =((Vector)v.get(i)).size();
Vector innV =(Vector)v.get(i);
for(int x =0; x<tempLength; x++)>
System.out.print(" "+innV.elementAt(x));
catch(Exception e)
System.out.println("table problem");
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
If it just quits, then it isn't an exception causing the problem. Try catching Error and printing the trace.
Yeah, I know this isn't normally done because there is normally nothing the program can do to recover from the problem, however just to figure out what is causing the problem might be worthwhile.

"JavaRanch, where the deer and the Certified play" - David O'Meara
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
Or catch Throwable, which includes both Error and Exception. When you say it "just quits", do you get any error message? If not, you may find it useful to add a bunch of print statements which tell you what part of the program is executing, so the printout actual as a log of the program's activities. This often offers invaluable clues.

"I'm not back." - Bill Harding, Twister
I agree. Here's the link: http://aspose.com/file-tools
subject: Print table code.... shuts down application
It's not a secret anymore!