Skip to content

Commit

Permalink
Merge pull request #7 from alexkramer/bugfix/npe-on-session-interceptor
Browse files Browse the repository at this point in the history
#6 Only enable filters when session exists
  • Loading branch information
alexkramer authored Nov 24, 2017
2 parents ad28533 + 5faaa2b commit 5562f58
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Add dependency in build.gradle:
}

dependencies {
compile "org.grails.plugins:hibernate-filter-plugin:0.5.2"
compile "org.grails.plugins:hibernate-filter-plugin:0.5.3"
}

# Usage
Expand Down
11 changes: 7 additions & 4 deletions hibernate-filter-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,22 @@ buildscript {
repositories {
mavenLocal()
maven { url "https://repo.grails.org/grails/core" }
jcenter()
}
dependencies {
classpath "org.grails:grails-gradle-plugin:$grailsVersion"
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
}
}

version "0.5.2"
version "0.5.3"
group "org.grails.plugins"

apply plugin: 'maven-publish'
apply plugin:"idea"
apply plugin:"org.grails.grails-plugin"
apply plugin:"org.grails.grails-plugin-publish"
apply plugin: "idea"
apply plugin: "org.grails.grails-plugin"
apply plugin: "org.grails.grails-plugin-publish"
apply plugin: 'com.jfrog.bintray'

ext {
grailsVersion = project.grailsVersion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ class HibernateFilterInterceptor {

boolean before() {
def session = sessionFactory.currentSession
DefaultHibernateFiltersHolder.defaultFilters.each {
session.enableFilter it
if (session) {
DefaultHibernateFiltersHolder.defaultFilters.each {
session.enableFilter it
}
}
true
}
Expand Down

0 comments on commit 5562f58

Please sign in to comment.