Details

      Description

      When trying to import users from LDAP I get a Null Pointer Exception which is followed bey the following errors:

      Caused by: com.liferay.portal.kernel.dao.orm.ORMException: org.hibernate.exception.DataException: could not insert: [com.liferay.portal.model.impl.ContactImpl]
      at com.liferay.portal.dao.orm.hibernate.ExceptionTranslator.translate(ExceptionTranslator.java:30)
      at com.liferay.portal.dao.orm.hibernate.SessionImpl.flush(SessionImpl.java:122)
      at com.liferay.portal.kernel.dao.orm.ClassLoaderSession.flush(ClassLoaderSession.java:218)
      at com.liferay.portal.service.persistence.BatchSessionImpl.update(BatchSessionImpl.java:95)
      at com.liferay.portal.service.persistence.BatchSessionUtil.update(BatchSessionUtil.java:49)
      at com.liferay.portal.service.persistence.ContactPersistenceImpl.updateImpl(ContactPersistenceImpl.java:292)
      ... 148 more
      Caused by: org.hibernate.exception.DataException: could not insert: [com.liferay.portal.model.impl.ContactImpl]
      at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:102)
      at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
      at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2454)
      at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2874)
      at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:79)
      at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:273)
      at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:265)
      at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:184)
      at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
      at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51)
      at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1216)
      at com.liferay.portal.dao.orm.hibernate.SessionImpl.flush(SessionImpl.java:119)
      ... 152 more
      Caused by: java.sql.SQLException: Only dates between January 1, 1753 and December 31, 9999 are accepted.
      at net.sourceforge.jtds.jdbc.DateTime.packDate(DateTime.java:318)
      at net.sourceforge.jtds.jdbc.DateTime.<init>(DateTime.java:126)
      at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.setParameter(JtdsPreparedStatement.java:444)
      at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.setTimestamp(JtdsPreparedStatement.java:840)
      at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.setTimestamp(DelegatingPreparedStatement.java:147)
      at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.setTimestamp(DelegatingPreparedStatement.java:147)
      at org.hibernate.type.descriptor.sql.TimestampTypeDescriptor$1.doBind(TimestampTypeDescriptor.java:53)
      at org.hibernate.type.descriptor.sql.BasicBinder.bind(BasicBinder.java:91)
      at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:282)
      at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:277)
      at org.hibernate.type.AbstractSingleColumnStandardBasicType.nullSafeSet(AbstractSingleColumnStandardBasicType.java:89)
      at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:2184)
      at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2430)
      ... 161 more

      The problem is related to the code redesign in the following method: BaseLDAPToPortalConverter.importLDAPUser(....)
      The initial birthdayCalendar is incorrect:
      Contact contact = new ContactImpl();
      Calendar birthdayCalendar =
      CalendarFactoryUtil.getCalendar(Calendar.JANUARY, 1, 1970);
      To fix this problem you should just change the arguments month and year according to javadoc getCalendar(int year, int month, int date):

      CalendarFactoryUtil.getCalendar(197, 1, Calendar.JANUARY);

      Thanks,

      Alireza

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  7 years, 46 weeks ago

                  Packages

                  Version Package
                  6.1.0 CE RC1
                  --Sprint 11/12
                  6.2.0 CE M2