Skip to content

Commit

Permalink
0.0.9
Browse files Browse the repository at this point in the history
  • Loading branch information
fangzhengjin committed Sep 24, 2019
1 parent 0c9cf65 commit 19d27ed
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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;
}
}
}

0 comments on commit 19d27ed

Please sign in to comment.