Re: StackOverflowError Errors
Re: StackOverflowError Errors
- Subject: Re: StackOverflowError Errors
- From: Doug Andrews <email@hidden>
- Date: Mon, 28 Feb 2005 14:57:02 -0500
Thanks. Here is my "Complaint" class:
I've noticed that i DO call valueForKey and takeValueForKey, but not in
the accessor methods.
Is this OK?
import com.webobjects.foundation.*;
import com.webobjects.eocontrol.*;
import java.math.*;
public class Complaint extends EOGenericRecord {
public Complaint() {
super();
}
public BigDecimal chargeAmount() {
return (BigDecimal)storedValueForKey("chargeAmount");
}
public void setChargeAmount(BigDecimal value) {
takeStoredValueForKey(value, "chargeAmount");
}
public Number billed() {
return (Number)storedValueForKey("billed");
}
public void setBilled(Number value) {
takeStoredValueForKey(value, "billed");
}
public Number publicationID() {
return (Number)storedValueForKey("publicationID");
}
public void setPublicationID(Number value) {
takeStoredValueForKey(value, "publicationID");
}
public Number processed() {
return (Number)storedValueForKey("processed");
}
public void setProcessed(Number value) {
takeStoredValueForKey(value, "processed");
}
public Number postTopSheet() {
return (Number)storedValueForKey("postTopSheet");
}
public void setPostTopSheet(Number value) {
takeStoredValueForKey(value, "postTopSheet");
}
public NSTimestamp postDate() {
return
CommonCode.stripTime((NSTimestamp)storedValueForKey("postDate"));
}
public void setPostDate(NSTimestamp value) {
takeStoredValueForKey(CommonCode.stripTime(value), "postDate");
}
public String complaintText() {
return (String)storedValueForKey("complaintText");
}
public void setComplaintText(String value) {
takeStoredValueForKey(value, "complaintText");
}
public String resolutionText() {
return (String)storedValueForKey("resolutionText");
}
public void setResolutionText(String value) {
takeStoredValueForKey(value, "resolutionText");
}
public NSTimestamp dateTimeStamp() {
return (NSTimestamp)storedValueForKey("dateTimeStamp");
}
public void setDateTimeStamp(NSTimestamp value) {
takeStoredValueForKey(value, "dateTimeStamp");
}
public NSTimestamp entered() {
return (NSTimestamp)storedValueForKey("entered");
}
public void setEntered(NSTimestamp value) {
takeStoredValueForKey(CommonCode.stripTime(value), "entered");
}
public String author() {
return (String)storedValueForKey("author");
}
public void setAuthor(String value) {
takeStoredValueForKey(value, "author");
}
public Number subscriptionID() {
return (Number)storedValueForKey("subscriptionID");
}
public void setSubscriptionID(Number value) {
takeStoredValueForKey(value, "subscriptionID");
}
public Number distributorID() {
return (Number)storedValueForKey("distributorID");
}
public void setDistributorID(Number value) {
takeStoredValueForKey(value, "distributorID");
}
public Number complaintID() {
return (Number)storedValueForKey("complaintID");
}
public void setComplaintID(Number value) {
takeStoredValueForKey(value, "complaintID");
}
public Number status() {
return (Number)storedValueForKey("status");
}
public void setStatus(Number value) {
takeStoredValueForKey(value, "status");
}
public Number reasonid() {
return (Number)storedValueForKey("reasonid");
}
public void setReasonid(Number value) {
takeStoredValueForKey(value, "reasonid");
}
public Subscription subscription() {
return (Subscription)storedValueForKey("subscription");
}
public void setSubscription(Subscription value) {
takeStoredValueForKey(value, "subscription");
}
public Distribution distribution() {
return (Distribution)storedValueForKey("distribution");
}
public void setDistribution(Distribution value) {
takeStoredValueForKey(value, "distribution");
}
public EOGenericRecord reason() {
return (EOGenericRecord)storedValueForKey("reason");
}
public void setReason(EOGenericRecord value) {
takeStoredValueForKey(value, "reason");
}
public Number action() {
return (Number)storedValueForKey("action");
}
public void setAction(Number value) {
takeStoredValueForKey(value, "action");
}
public String actor() {
if (storedValueForKey("actor") == null) {
return author();
}
return (String)storedValueForKey("actor");
}
public void setActor(String value) {
takeStoredValueForKey(value, "actor");
}
public NSTimestamp actionTime() {
if (storedValueForKey("actionTime") == null) {
return dateTimeStamp();
}
return (NSTimestamp)storedValueForKey("actionTime");
}
public void setActionTime(NSTimestamp value) {
takeStoredValueForKey(value, "actionTime");
}
public String actionTo() {
return (String)storedValueForKey("actionTo");
}
public void setActionTo(String value) {
takeStoredValueForKey(value, "actionTo");
}
// custom code
public String smallComplaintText()
{
if (reason() == null)
{
if (null == complaintText())
return null;
if (complaintText().length() < 30)
return complaintText();
return complaintText().substring(0,30);
}
if (reason().valueForKey("reasonName") ==
NSKeyValueCoding.NullValue || reason().valueForKey("reasonName") ==
null)
return null;
if (((String)reason().valueForKey("reasonName")).length() < 30)
return ((String)reason().valueForKey("reasonName"));
return
((String)reason().valueForKey("reasonName")).substring(0,30);
}
public String statusName()
{
if (null == status())
return "Cleared";
switch (status().intValue())
{
case 1: return "Resolved";
case 2: return "Unresolved";
}
return "Cleared";
}
public String complaintTextString()
{
if (reason() == null) {
if (null == complaintText()) {
return null;
}
return complaintText();
}
if (this.valueForKeyPath("reason.reasonName") == null) {
return null;
}
return ((String)this.valueForKeyPath("reason.reasonName"));
}
public String actionName()
{
if (null == action())
return "Entered";
switch (action().intValue())
{
case 1: return "Dispatched";
case 2: return "Delivered";
}
return "Entered";
}
public String niceEneteredDate()
{
String retStr;
NSTimestampFormatter formatter;
if (entered()==null)
return new String("");
formatter = new NSTimestampFormatter("%m/%d/%y");
retStr = new String();
retStr = formatter.format(entered());
return retStr;
}
}
On Feb 28, 2005, at 2:16 PM, Alan Ward wrote:
more than likely you have a method that's doing a takeValueForKey
instead of takeStoredValueForKey
(or returning a valueForKey instead of storedValueForKey). If you
post the code for the whole class then
it would be easier to spot.
On Feb 28, 2005, at 11:14 AM, Doug Andrews wrote:
Hello list.
I am stuck on this problem, and cannot seem to figure this out.
Any help would be appreciated.
We have several sites that regularly get StackOverflowError errors.
This only seems to happen when they access EO's that have a custom
class.
The EO's are always in a valid EditingContext at the time.
Our custom classes extend EOGenericRecord and use the accessor
methods generated by EOModeler.
example:
public String account() {
return (String)storedValueForKey("account");
}
public void setAccount(String value) {
takeStoredValueForKey(value, "account");
}
Nothing too fancy.
If the EO is not of a custom class, but is of class EOGenericRecord,
we don't seem to have these problems.
We are deploying on WO 5.1.3 on Mac 10.3.x
Has anyone else had this problem?
Here is a sample of the stack trace, which just repeats itself over
and over.
EOEditingContext.java 4724 _sendOrEnqueueNotification
EOEditingContext.java 1963 _globalIDChanged
GeneratedMethodAccessor124.java NA invoke
DelegatingMethodAccessorImpl.java 25 invoke
Method.java 324 invoke
NSSelector.java 120 _safeInvokeMethod
NSNotificationCenter.java 598 invokeMethod
NSNotificationCenter.java 542 postNotification
NSNotificationCenter.java 572 postNotification
EOEditingContext.java 1959 _processGlobalIDChanges
GeneratedMethodAccessor125.java NA invoke
DelegatingMethodAccessorImpl.java 25 invoke
Method.java 324 invoke
NSSelector.java 354 invoke
NSSelector.java 108 _safeInvokeSelector
EOEditingContext.java 4724 _sendOrEnqueueNotification
EOEditingContext.java 1963 _globalIDChanged
GeneratedMethodAccessor124.java NA invoke
DelegatingMethodAccessorImpl.java 25 invoke
Method.java 324 invoke
NSSelector.java 120 _safeInvokeMethod
NSNotificationCenter.java 598 invokeMethod
NSNotificationCenter.java 542 postNotification
NSNotificationCenter.java 572 postNotification
EOEditingContext.java 1959 _processGlobalIDChanges
_______________________________________________
WebObjects-dev mailing list
email@hidden
http://www.omnigroup.com/mailman/listinfo/webobjects-dev
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden