mirror of
https://github.com/valitydev/file-storage.git
synced 2024-11-06 00:35:22 +00:00
BJ-314: fix checker
This commit is contained in:
parent
18aebc6460
commit
024bafd0fe
2
pom.xml
2
pom.xml
@ -23,6 +23,7 @@
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
|
||||
<dockerfile.base.service.tag>22c57470c4fc47161894f036b7cf9d70f42b75f5</dockerfile.base.service.tag>
|
||||
<shared.resources.version>0.2.1</shared.resources.version>
|
||||
<woody.thrift.version>1.1.15</woody.thrift.version>
|
||||
<file.storage.proto.version>1.8-c23437f</file.storage.proto.version>
|
||||
@ -128,7 +129,6 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.rbkmoney.file.storage.util;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import org.apache.thrift.TException;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
@ -10,22 +9,22 @@ public class CheckerUtil {
|
||||
|
||||
private static final Pattern FILE_NAME_PATTERN = Pattern.compile("^[a-zA-Z0-9 ,-_.]*$");
|
||||
|
||||
public static void checkString(String string, String exMessage) throws TException {
|
||||
public static void checkString(String string, String exMessage) throws RuntimeException {
|
||||
if (Strings.isNullOrEmpty(string)) {
|
||||
throw new TException(exMessage);
|
||||
throw new RuntimeException(exMessage);
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkFileName(String string, String exMessage) throws TException {
|
||||
public static void checkFileName(String string, String exMessage) throws RuntimeException {
|
||||
if (!FILE_NAME_PATTERN.matcher(string).matches()) {
|
||||
throw new TException(exMessage);
|
||||
throw new RuntimeException(exMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void checkFile(MultipartFile file, String exMessage) throws TException {
|
||||
public static void checkFile(MultipartFile file, String exMessage) throws RuntimeException {
|
||||
if (file.isEmpty()) {
|
||||
throw new TException(exMessage);
|
||||
throw new RuntimeException(exMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user