Uploaded image for project: 'OpenOLAT'
  1. OpenOLAT
  2. OO-1442

NPE in self registration

    XMLWordPrintable

    Details

      Description

      When finishing with self registration you get a NPE because in RegistrationManager on line 186

      Identity identity = securityManager.createAndPersistIdentityAndUserWithDefaultProviderAndUserGroup(login, null, pwd, myUser);
      

      the securityManager is null.

      This is because getInstance() of RegistratinManager returns a new instance of RegistrationManager.

      I'm a little unsure with it but this patch fixes that:

      diff -r c5b8db0c6b82 src/main/java/org/olat/registration/RegistrationManager.java
      --- a/src/main/java/org/olat/registration/RegistrationManager.java	Mon Feb 16 16:03:35 2015 +0100
      +++ b/src/main/java/org/olat/registration/RegistrationManager.java	Wed Feb 18 09:15:20 2015 +0100
      @@ -73,8 +73,10 @@
       	private RegistrationModule registrationModule;
       	private MailManager mailManager;
       	private BaseSecurity securityManager;
      +	private static RegistrationManager INSTANCE;
       
       	private RegistrationManager() {
      +		INSTANCE = this;
       		// singleton
       	}
       
      @@ -82,7 +84,7 @@
       	 * @return Manager instance.
       	 */
       	public static RegistrationManager getInstance() {
      -		return new RegistrationManager();
      +		return INSTANCE;
       	}
       	
       	/**
      

      I tested it and it works

        Attachments

          Activity

            People

            Assignee:
            srosse Stéphane Rossé
            Reporter:
            stephan Stephan Clemenz
            Tester:
            Florian Gnägi
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours, 10 minutes
                2h 10m