diff --git a/src/main/java/neatlogic/framework/constvalue/SystemProperty.java b/src/main/java/neatlogic/framework/constvalue/SystemProperty.java new file mode 100644 index 0000000000000000000000000000000000000000..77cfc1fb66da3de8a3b2108e18b371f1ac6ccde4 --- /dev/null +++ b/src/main/java/neatlogic/framework/constvalue/SystemProperty.java @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2025 深圳极向量科技有限公司 All Rights Reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package neatlogic.framework.constvalue; + +public class SystemProperty { + public final static String LOG4J_HOME = "log4j.home"; +} diff --git a/src/main/java/neatlogic/framework/exception/SystemPropertyNotFoundException.java b/src/main/java/neatlogic/framework/exception/SystemPropertyNotFoundException.java new file mode 100644 index 0000000000000000000000000000000000000000..1042b82fa13352010d552969bd6ba64ed41f613d --- /dev/null +++ b/src/main/java/neatlogic/framework/exception/SystemPropertyNotFoundException.java @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2025 深圳极向量科技有限公司 All Rights Reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package neatlogic.framework.exception; + +import neatlogic.framework.exception.core.ApiRuntimeException; + +public class SystemPropertyNotFoundException extends ApiRuntimeException { + + public SystemPropertyNotFoundException(String name) { + super("nfe.systempropertynotfoundexception.systempropertynotfoundexception", name); + } +} diff --git a/src/main/java/neatlogic/framework/exception/file/FileNotFoundException.java b/src/main/java/neatlogic/framework/exception/file/FileNotFoundException.java index ea3f9d88ad16b1e6f0f75e717d65c2bd9e53d19d..8b17a4289aff34ae6fe7ba9916d93d8d86336d76 100644 --- a/src/main/java/neatlogic/framework/exception/file/FileNotFoundException.java +++ b/src/main/java/neatlogic/framework/exception/file/FileNotFoundException.java @@ -1,10 +1,31 @@ package neatlogic.framework.exception.file; import neatlogic.framework.exception.core.ApiRuntimeException; +import neatlogic.framework.util.$; +import org.apache.commons.lang3.StringUtils; public class FileNotFoundException extends ApiRuntimeException { + + public enum Type { + NONEXISTENT, + DIRECTORY, + ; + } + public FileNotFoundException(Long id) { - super("附件“{0}”不存在", id); + super("nfef.filenotfoundexception.filenotfoundexception", id); } + public FileNotFoundException(Type type, String path) { + super(getMessage(type, path)); + } + + private static String getMessage(Type type, String path) { + if (type == Type.NONEXISTENT) { + return $.t("nfef.filenotfoundexception.getmessage.nonexistent", path); + } else if (type == Type.DIRECTORY) { + return $.t("nfef.filenotfoundexception.getmessage.directory", path); + } + return StringUtils.EMPTY; + } }