Skip to content
Browse files

apply path by Peter Menhart - fixes NullPointerException in Dao

  • Loading branch information...
1 parent b22f23e commit a6ec83847de3684d3c24a2693e70d880f13fc038 @splix committed Aug 31, 2011
View
3 docs/index.txt
@@ -12,6 +12,7 @@ h2. Requirements:
h2. How to install:
{code}
grails install-plugin spring-security-core
+grails s2-quickstart
grails install-plugin spring-security-twitter
grails s2-init-twitter
{code}
@@ -74,7 +75,7 @@ h3. How to use my own DAO
You have to create a class, that implements com.the6hours.grails.springsecurity.twitter.TwitterAuthDao, put it as a bean into spring context (see docs) add following configuration into your Config.groovy:
{code}
-grails.plugins.springsecurity.twitter.beans.dao='myOwnDaoBean'
+grails.plugins.springsecurity.twitter.bean.dao='myOwnDaoBean'
{code}
View
11 src/groovy/com/the6hours/grails/springsecurity/twitter/DefaultConnectedTwitterAuthDao.groovy
@@ -22,11 +22,12 @@ class DefaultConnectedTwitterAuthDao implements TwitterAuthDao {
TwitterUserDomain findUser(String username) {
Class<?> User = grailsApplication.getDomainClass(domainClassName).clazz
- User.withTransaction { status ->
- def user = User.findWhere(screenName: username)
- return user
- }
- return null
+ def user = null
+ User.withTransaction { status ->
+ user = User.findWhere(screenName: username)
+ user?.user // load the User object to memory prevent LazyInitializationException
+ }
+ return user
}
TwitterUserDomain create(TwitterAuthToken token) {

0 comments on commit a6ec838

Please sign in to comment.
Something went wrong with that request. Please try again.