File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes java.lang.StackOverflowError - Why? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "java.lang.StackOverflowError - Why?" Watch "java.lang.StackOverflowError - Why?" New topic
Author

java.lang.StackOverflowError - Why?

DC Dalton
Ranch Hand

Joined: May 28, 2001
Posts: 287
Ive built a quick object to hold log in data & extended hashtable so I can quick grab whatever info I need but for some silly reason Im getting a StackOverflowError on the overridden get Method...Ive done this several times before & never had this problem....or (as very well may be) Im having another on eof those "DUH" days! Here's the code:
public class LogInObject extends java.util.Hashtable{
public LogInObject(){

}
public LogInObject(String compName, String privledges, String realName, String lastAccess, String cage){
this.put("compName", compName);
this.put("privledges", privledges);
this.put("realName", realName);
this.put("lastAccess", lastAccess);
this.put("cageCode", cage);
}
public String get(String info){
return (String)this.get(info);
}
};
If I remove my get Method all is fine but then I have to cast the incoming data...too much of a pain......Any clue? Thanks folks
[ May 23, 2003: Message edited by: DC Dalton ]
Joel McNary
Bartender

Joined: Aug 20, 2001
Posts: 1824


or (as very well may be) Im having another on eof those "DUH" days!

Don't worry, we all have those....
Try:

the "this" was calling the "get" method which was calling "this.get" which was calling "this.get" ...
[ May 23, 2003: Message edited by: Joel McNary ]

Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
...Im having another on eof those "DUH" days!
Try changing this.get(info) to super.get(info).


Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Damn Joel, We're gonna have to change our terminology around here from "Yingst" to "McNaryed".
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: java.lang.StackOverflowError - Why?