mirror of
https://github.com/getrebuild/rebuild.git
synced 2024-09-20 15:35:55 +08:00
better code
This commit is contained in:
parent
6efcd33f49
commit
d4888e1a18
|
@ -1,19 +1,8 @@
|
|||
/*
|
||||
rebuild - Building your business-systems freely.
|
||||
Copyright (C) 2018 devezhao <zhaofang123@gmail.com>
|
||||
Copyright (c) REBUILD <https://getrebuild.com/> and its owners. All rights reserved.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
rebuild is dual-licensed under commercial and open source licenses (GPLv3).
|
||||
See LICENSE and COMMERCIAL in the project root for license information.
|
||||
*/
|
||||
|
||||
package com.rebuild.server.helper;
|
||||
|
|
|
@ -1,19 +1,8 @@
|
|||
/*
|
||||
rebuild - Building your business-systems freely.
|
||||
Copyright (C) 2018-2019 devezhao <zhaofang123@gmail.com>
|
||||
Copyright (c) REBUILD <https://getrebuild.com/> and its owners. All rights reserved.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
rebuild is dual-licensed under commercial and open source licenses (GPLv3).
|
||||
See LICENSE and COMMERCIAL in the project root for license information.
|
||||
*/
|
||||
|
||||
package com.rebuild.server.helper;
|
||||
|
@ -87,7 +76,9 @@ public class KVStorage {
|
|||
* @return
|
||||
*/
|
||||
protected static String getValue(final String key, boolean reload, Object defaultValue) {
|
||||
|
||||
String value = null;
|
||||
|
||||
if (Application.serversReady()) {
|
||||
value = Application.getCommonCache().get(key);
|
||||
if (value != null && !reload) {
|
||||
|
@ -119,6 +110,7 @@ public class KVStorage {
|
|||
Application.getCommonCache().put(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,19 +1,8 @@
|
|||
/*
|
||||
rebuild - Building your business-systems freely.
|
||||
Copyright (C) 2018 devezhao <zhaofang123@gmail.com>
|
||||
Copyright (c) REBUILD <https://getrebuild.com/> and its owners. All rights reserved.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
rebuild is dual-licensed under commercial and open source licenses (GPLv3).
|
||||
See LICENSE and COMMERCIAL in the project root for license information.
|
||||
*/
|
||||
|
||||
package com.rebuild.utils;
|
||||
|
@ -86,7 +75,7 @@ public class AES {
|
|||
try {
|
||||
return decrypt(input);
|
||||
} catch (RebuildException ex) {
|
||||
Application.LOG.warn("Decrypt error : " + input);
|
||||
LOG.warn("Decrypting error (Use blank input) : " + input);
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
}
|
||||
|
@ -110,20 +99,7 @@ public class AES {
|
|||
}
|
||||
return new String(output);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param input
|
||||
* @return
|
||||
*/
|
||||
public static String decryptNothrow(String input) {
|
||||
try {
|
||||
return decrypt(input);
|
||||
} catch (RebuildException ex) {
|
||||
LOG.warn("Decrypting error (Use blank input) : " + input);
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过 `-Drbpass=KEY` 指定 AES 秘钥
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue