From 19d27edb730bf77c3b6987bb49b4488c0961b98e Mon Sep 17 00:00:00 2001 From: fangzhengjin Date: Tue, 24 Sep 2019 18:43:32 +0800 Subject: [PATCH] 0.0.9 --- README.md | 2 +- README_CN.md | 2 +- gradle.properties | 2 +- .../properties/CasbinProperties.java | 16 ++++++++++++---- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 4e8809e..4981eec 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![Bintray](https://img.shields.io/bintray/v/casbin/maven/casbin-spring-boot-starter.svg?style=flat-square&color=blue)](https://bintray.com/casbin/maven/casbin-spring-boot-starter/_latestVersion) [![License](https://img.shields.io/github/license/jcasbin/casbin-spring-boot-starter.svg?style=flat-square&color=blue)](http://www.apache.org/licenses/LICENSE-2.0.txt) [![SpringBootVersion](https://img.shields.io/badge/SpringBoot-2.1.4-heightgreen.svg?style=flat-square)](https://spring.io/projects/spring-boot) -[![JCasbinVersion](https://img.shields.io/badge/JCasbinVersion-1.3.0-heightgreen.svg?style=flat-square)](https://casbin.org) +[![JCasbinVersion](https://img.shields.io/badge/JCasbinVersion-1.4.0-heightgreen.svg?style=flat-square)](https://casbin.org) [![](https://raw.githubusercontent.com/casbin/jcasbin/master/casbin-logo.png)](https://casbin.org) diff --git a/README_CN.md b/README_CN.md index 9ad1b43..f81ae8a 100644 --- a/README_CN.md +++ b/README_CN.md @@ -6,7 +6,7 @@ [![Bintray](https://img.shields.io/bintray/v/casbin/maven/casbin-spring-boot-starter.svg?style=flat-square&color=blue)](https://bintray.com/casbin/maven/casbin-spring-boot-starter/_latestVersion) [![License](https://img.shields.io/github/license/jcasbin/casbin-spring-boot-starter.svg?style=flat-square&color=blue)](http://www.apache.org/licenses/LICENSE-2.0.txt) [![SpringBootVersion](https://img.shields.io/badge/SpringBoot-2.1.4-heightgreen.svg?style=flat-square)](https://spring.io/projects/spring-boot) -[![JCasbinVersion](https://img.shields.io/badge/JCasbinVersion-1.3.0-heightgreen.svg?style=flat-square)](https://casbin.org) +[![JCasbinVersion](https://img.shields.io/badge/JCasbinVersion-1.4.0-heightgreen.svg?style=flat-square)](https://casbin.org) [![](https://raw.githubusercontent.com/casbin/jcasbin/master/casbin-logo.png)](https://casbin.org) diff --git a/gradle.properties b/gradle.properties index 2ca351e..353f1db 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ BINTRAY_SUBJECT=casbin #GAV坐标 GROUP=org.casbin ARTIFACT_ID=casbin-spring-boot-starter -VERSION_CODE=0.0.8 +VERSION_CODE=0.0.9 #项目地址相关 GITHUB_REPO=jcasbin/casbin-spring-boot-starter POM_URL=https://github.com/jcasbin/casbin-spring-boot-starter diff --git a/src/main/java/org/casbin/spring/boot/autoconfigure/properties/CasbinProperties.java b/src/main/java/org/casbin/spring/boot/autoconfigure/properties/CasbinProperties.java index 8a2ef5d..d8bf6cb 100644 --- a/src/main/java/org/casbin/spring/boot/autoconfigure/properties/CasbinProperties.java +++ b/src/main/java/org/casbin/spring/boot/autoconfigure/properties/CasbinProperties.java @@ -5,9 +5,7 @@ import org.casbin.exception.CasbinPolicyConfigNotFoundException; import org.casbin.utils.FileUtils; import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.util.ResourceUtils; -import java.io.FileNotFoundException; import java.io.InputStream; /** @@ -65,11 +63,21 @@ public class CasbinProperties { private boolean useDefaultModelIfModelNotSetting = true; public String getModelContext() { - return FileUtils.getFileAsText(model); + String text = FileUtils.getFileAsText(model); + if (text == null) { + throw new CasbinModelConfigNotFoundException(); + } else { + return text; + } } public InputStream getPolicyInputStream() { - return FileUtils.getFileAsInputStream(policy); + InputStream stream = FileUtils.getFileAsInputStream(policy); + if (stream == null) { + throw new CasbinPolicyConfigNotFoundException(); + } else { + return stream; + } } }