Issue #415: ArrayIndexOutOfBoundsException with enhanced Entity

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


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

class TestEmbed

and the second one:

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)


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(
at com.objectdb.o.EMT.beforeModifyMember(
at ...


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



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...!??





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:


class Embed_A {}

class Embed_B { private Embed_A embedA; .. }

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!??



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

class EmbedA { private Test test; ... }



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..



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

Thank you for your report.

ObjectDB Support