Hi!

Plataform: Win2K, SapDB 7.3.0.24 with JDBC 7.3.0.26a
Version: OJB 0.9.5 build from sources without modifications (build jar-debug).

I have a bean, let's say:

public class MyBean extends Object implements Serializable {
  public MyBean( );

  private int v1;
  private String n1;
  private ArrayList a1;

  public void setV1( int newV1 ) {
    v1 = newV1;
  }

  public int getV1( ) {
    return v1;
  }

  public void setN1( String newN1 ) {
    n1 = newN1;
  }

  public String getN1( ) {
    return n1;
  }

  public void setA1( Collection newA1 ) {
    if( a1 == null )
      a1 = new ArrayList( );
    else
      a1.clear( );
    a1.addAll( newA1 );
  }

  public Collection getA1( ) {
    return a1;
  }
}

Ok, this works fine in a 1:n mapping or a M:N decomposable mapping.
But if I add the following methods, I get NullPointerException:

  public void setA1( int index, MyOtherBean value ) {
    if( a1 == null )
      a1 = new ArrayList( );

    if( index >= a1.size( ) )
      a1.add( value );
    else
      a1.set( index, value );
  }

  public MyOtherBean getA1( int index ) {
    if( a1 == null )
      return null;

    if( index >= a1.size( ) )
      throw new IndexOutOfBoundException( );

    return ( MyOtherBean )a1.get( index );
  }

The error occur at line 929 of PersistentBrokerImpl.java.

Thanks for any tips (or anyone can confirm that this is a bug?)!

Edson Richter

Reply via email to