Issue #415: ArrayIndexOutOfBoundsException with enhanced Entity

Type: Bug ReoprtVersion: 2.2.8Priority: NormalStatus: FixedReplies: 7
#1

Hi!

We have an two entities, the first one is something like:

@Embeddable
class TestEmbed
{...}

and the second one:

@Entity
class TestEntity
{
private TestEmbed myEmbed = null;

public TestEmbed getMyEmbed()
{
  if (myEmbed == null)
  {
     myEmbed = new TestEmbed();
  }
  return myEmbed;
}

Now when we load a TestEmbed class from the object database and do access the myEmbed property the first time with getMyEmbed() then we get an ArrayIndexOutOfBoundsException within here:

MMM.J(int) line: 602
ENT.beforeModifyEmbedded(int) line: 1007
EMT.beforeModifyMember(int) line: 90
TestEntity.__odbSet_myEmbed(TestEntity, TestEmbed) line: 1 (out of synch)
TestEntity.getMyEmbed() line: 71 (out of synch)

#2

ok it is getting worse.. I do get a Nullpointer exception in the same class though this time during a simple string-property setter???

 

Caused by: java.lang.NullPointerException
at com.objectdb.o.ENT.beforeModifyEmbedded(ENT.java:1011)
at com.objectdb.o.EMT.beforeModifyMember(EMT.java:90)
at ...

#3

The stack trace has not been produced by the last ObjectDB version.

Which ObjectDB version are you using (probably not 1.0.4 as filled for this issue)?

Could you try the last build?

 

ObjectDB Support
#4

hi,

 

yes, my fault sorry. I've been using 2.2.8 as well as I've tried it with 2.2.8_06 and it has happened with both.

The weird thing is that it doesn't happen always...!??

 

Alex

#5

hi!

ok I did some more testing. I do get a lot of different errors (NullPointerException, Attempting to modify a primary key of a managed object etc etc.). However It seems to happen only with an embeddable entity embedded within another embeddable entity like:

 

@Embeddable
class Embed_A {}

@Embeddable
class Embed_B { private Embed_A embedA; .. }

@Entity
class MyEntity { private Embed_B embedB; ... }

Removing embedA from Embed_B seems to work fine though as soon as adding it again, things go crazy during commit and merging!??

 

#6

Hmm getting closer.. it seems that when I do remove an enum property from Embed_A it works as well so it looks more or less that the enum in Embed_A causes issues though its a pretty basic thing:

enum Test
 { APPLE, PIE }

class EmbedA { private Test test; ... }

#7

hi,

ok, one issue was the enum for which I use and store a string now.

but it seems the second issue is really having an embeddable within an embeddable as I do still get the issues that I wrote in the first posting..

alex

#8

This bug (in managing nested embedded objects) was fixed in version 2.2.9.

Thank you for your report.

ObjectDB Support

Reply