You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Silvio Katzan <si...@gmx.net> on 2003/01/17 15:44:46 UTC

StackOverflowError

Hi all,


I upgraded to 0.9.4.1 from 0.9.3.21.
Using 0.9.4.1 I get a StackOverflowException on creating some objects, this
is because there is an infinite loop in ClassMolder.getPriority()
Using 0.9.3.21 I didn't get the error.

Comparing the two classes, the following line is commented out:

line 627:		&& _fhs[i].getEnclosingClassMolder() != this


Here are my example data:

<mapping>
	<class name="UserBean" identity="id" key-generator="MAX">
		<description>user</description>
		<map-to table="person" xml="person"/>
		<field name="id" type="integer">
			<sql name="userId" type="integer"/>
		</field>
		<field name="folderMappings" type="FolderMappingBean"
collection="vector">
			<sql many-key="userId"/>
		</field>
	</class>
	<class name="FolderMappingBean" identity="id" key-generator="MAX">
		<description>Mapping from user to folder with
type</description>
		<map-to table="folderMapping"/>
		<field name="id" type="integer">
			<sql name="folderMappingId" type="integer"/>
		</field>
		<field name="folder" type="FolderBean">
			<sql name="folderId"/>
		</field>
		<field name="user" type="UserBean">
			<sql name="userId"/>
		</field>
		<field name="childFolderMappings" type="FolderMappingBean"
collection="vector">
			<sql many-key="parentFolderMappingId"/>
		</field>
		<field name="parentFolderMapping" type="FolderMappingBean">
			<sql name="parentFolderMappingId"/>
		</field>
	</class>
</mapping>


And here the sequence of creating objects:

- first the user is loaded into the current transaction
- then the constructor of FolderMappingBean is called
- Construtctor of FolderMapping:
	public FolderMappingBean(Database pDatabase, UserBean pUser,
FolderMappingBean pParentFolderMapping)
	{
		mChildFolderMappings = new Vector();
		mParentFolderMapping = null;
		mUser = null;
		
		pDatabase.create(this);
		
		pUser.addFolderMapping(this);
		
		if(pParentFolderMapping != null)
		{
			pParentFolderMapping.addChildFolderMapping(this);
		}
	}

If pDatabase.create(this) is called, I get the StackOverflow Error.


Thanks so far,

Silvio




RE: StackOverflowError

Posted by Berin Loritsch <bl...@citi-us.com>.
Are you sure you didn't mean to send this to
Castor's development list?

>  -----Original Message-----
> From: 	Silvio Katzan [mailto:silvio_katzan@gmx.net] 
> Sent:	Friday, January 17, 2003 9:45 AM
> To:	avalon-dev@jakarta.apache.org
> Subject:	StackOverflowError
> 
> Hi all,
> 
> 
> I upgraded to 0.9.4.1 from 0.9.3.21.
> Using 0.9.4.1 I get a StackOverflowException on creating some 
> objects, this is because there is an infinite loop in 
> ClassMolder.getPriority()
> Using 0.9.3.21 I didn't get the error.
> 
> Comparing the two classes, the following line is commented out:
> 
> line 627:		&& _fhs[i].getEnclosingClassMolder() != this
> 
> 
> Here are my example data:
> 
> <mapping>
> 	<class name="UserBean" identity="id" key-generator="MAX">
> 		<description>user</description>
> 		<map-to table="person" xml="person"/>
> 		<field name="id" type="integer">
> 			<sql name="userId" type="integer"/>
> 		</field>
> 		<field name="folderMappings" 
> type="FolderMappingBean" collection="vector">
> 			<sql many-key="userId"/>
> 		</field>
> 	</class>
> 	<class name="FolderMappingBean" identity="id" 
> key-generator="MAX">
> 		<description>Mapping from user to folder with 
> type</description>
> 		<map-to table="folderMapping"/>
> 		<field name="id" type="integer">
> 			<sql name="folderMappingId" type="integer"/>
> 		</field>
> 		<field name="folder" type="FolderBean">
> 			<sql name="folderId"/>
> 		</field>
> 		<field name="user" type="UserBean">
> 			<sql name="userId"/>
> 		</field>
> 		<field name="childFolderMappings" 
> type="FolderMappingBean" collection="vector">
> 			<sql many-key="parentFolderMappingId"/>
> 		</field>
> 		<field name="parentFolderMapping" 
> type="FolderMappingBean">
> 			<sql name="parentFolderMappingId"/>
> 		</field>
> 	</class>
> </mapping>
> 
> 
> And here the sequence of creating objects:
> 
> - first the user is loaded into the current transaction
> - then the constructor of FolderMappingBean is called
> - Construtctor of FolderMapping:
> 	public FolderMappingBean(Database pDatabase, UserBean 
> pUser, FolderMappingBean pParentFolderMapping)
> 	{
> 		mChildFolderMappings = new Vector();
> 		mParentFolderMapping = null;
> 		mUser = null;
> 		
> 		pDatabase.create(this);
> 		
> 		pUser.addFolderMapping(this);
> 		
> 		if(pParentFolderMapping != null)
> 		{
> 			
> pParentFolderMapping.addChildFolderMapping(this);
> 		}
> 	}
> 
> If pDatabase.create(this) is called, I get the StackOverflow Error.
> 
> 
> Thanks so far,
> 
> Silvio
> 
> 
>  << File: ATT00007.txt >>