Uploaded image for project: 'Directory ApacheDS'
  1. Directory ApacheDS
  2. DIRSERVER-1909

Integer cannot be cast to java.lang.Long in JdbmTable prevents service start

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0-M15
    • Fix Version/s: 2.0.0-M16
    • Component/s: core
    • Labels:
      None

      Description

      During server start objects are being de-serialized and a cast statement is resulting in exception prevent the server to start.

      org.apache.directory.server.UberjarMain] - Failed to start the service.
      org.apache.directory.api.ldap.model.exception.LdapOtherException: java.lang.Integer cannot be cast to java.lang.Long

      at org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmTable.<init>(JdbmTable.java:166)

      The first constructor in JdbmTable has following

      count = ( Long ) recMan.fetch( recId );

      The second constructor handles this issue, hence similar logic should be applied in first constructor.

      Object value = recMan.fetch( recId );

      if ( value instanceof Integer )

      { count = ( ( Integer ) value ).longValue(); }

      else

      { count = ( Long ) value; }

      Tested in M16 snapshot build and it resolved the cast exception.

        Activity

        Hide
        elecharny Emmanuel Lecharny added a comment -

        Good catch !

        This is a modification I did back in july, but which has not been applied correctly to all the class. Thanks for the proposed patch, I'll apply it immediately.

        Show
        elecharny Emmanuel Lecharny added a comment - Good catch ! This is a modification I did back in july, but which has not been applied correctly to all the class. Thanks for the proposed patch, I'll apply it immediately.
        Hide
        elecharny Emmanuel Lecharny added a comment -
        Show
        elecharny Emmanuel Lecharny added a comment - Fixed with http://svn.apache.org/r1538011

          People

          • Assignee:
            Unassigned
            Reporter:
            mdebusschere Mark DeBusschere
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development