mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix code
This commit is contained in:
@@ -79,7 +79,7 @@ public final class InternalJSONUtil {
|
||||
|| object instanceof Number //
|
||||
|| ObjUtil.isBasicType(object) //
|
||||
) {
|
||||
if (false == ObjUtil.isValidIfNumber(object)) {
|
||||
if (! ObjUtil.isValidIfNumber(object)) {
|
||||
throw new JSONException("JSON does not allow non-finite numbers.");
|
||||
}
|
||||
return object;
|
||||
@@ -252,9 +252,9 @@ public final class InternalJSONUtil {
|
||||
* @since 4.3.1
|
||||
*/
|
||||
static boolean defaultIgnoreNullValue(final Object obj) {
|
||||
return (false == (obj instanceof CharSequence))//
|
||||
&& (false == (obj instanceof JSONTokener))//
|
||||
&& (false == (obj instanceof Map));
|
||||
return (! (obj instanceof CharSequence))//
|
||||
&& (! (obj instanceof JSONTokener))//
|
||||
&& (! (obj instanceof Map));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -456,7 +456,7 @@ public class JSONArray implements JSON, JSONGetter<Integer>, List<Object>, Rando
|
||||
}
|
||||
this.rawList.add(index, InternalJSONUtil.wrap(element, this.config));
|
||||
} else {
|
||||
if (false == config.isIgnoreNullValue()) {
|
||||
if (! config.isIgnoreNullValue()) {
|
||||
while (index != this.size()) {
|
||||
// 非末尾,则填充null
|
||||
this.add(null);
|
||||
|
@@ -114,7 +114,7 @@ public class JSONTokener extends ReaderWrapper {
|
||||
* @return 是否进入结尾
|
||||
*/
|
||||
public boolean end() {
|
||||
return this.eof && false == this.usePrevious;
|
||||
return this.eof && ! this.usePrevious;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -394,7 +394,7 @@ public class JWT implements RegisteredPayload<JWT> {
|
||||
* @since 5.7.4
|
||||
*/
|
||||
public boolean validate(final long leeway) {
|
||||
if (false == verify()) {
|
||||
if (! verify()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -172,13 +172,13 @@ public class JWTValidator {
|
||||
}
|
||||
|
||||
final String algorithmIdInSigner = signer.getAlgorithmId();
|
||||
if (false == StrUtil.equals(algorithmId, algorithmIdInSigner)) {
|
||||
if (! StrUtil.equals(algorithmId, algorithmIdInSigner)) {
|
||||
throw new ValidateException("Algorithm [{}] defined in header doesn't match to [{}]!"
|
||||
, algorithmId, algorithmIdInSigner);
|
||||
}
|
||||
|
||||
// 通过算法验证签名是否正确
|
||||
if (false == jwt.verify(signer)) {
|
||||
if (! jwt.verify(signer)) {
|
||||
throw new ValidateException("Signature verification failed!");
|
||||
}
|
||||
}
|
||||
|
@@ -119,7 +119,7 @@ public class JSONArrayMapper {
|
||||
} else if (source instanceof Iterable<?>) {// Iterable
|
||||
iter = ((Iterable<?>) source).iterator();
|
||||
} else {
|
||||
if(false == jsonArray.config().isIgnoreError()){
|
||||
if(! jsonArray.config().isIgnoreError()){
|
||||
throw new JSONException("JSONArray initial value should be a string or collection or array.");
|
||||
}
|
||||
// 如果用户选择跳过异常,则跳过此值转换
|
||||
|
@@ -129,7 +129,7 @@ public class JSONObjectMapper {
|
||||
// 普通Bean
|
||||
mapFromBean(source, jsonObject);
|
||||
} else {
|
||||
if(false == jsonObject.config().isIgnoreError()){
|
||||
if(! jsonObject.config().isIgnoreError()){
|
||||
// 不支持对象类型转换为JSONObject
|
||||
throw new JSONException("Unsupported type [{}] to JSONObject!", source.getClass());
|
||||
}
|
||||
|
@@ -158,13 +158,13 @@ public class JSONWriter extends Writer {
|
||||
}
|
||||
|
||||
if (null != predicate) {
|
||||
if (false == predicate.test(pair)) {
|
||||
if (! predicate.test(pair)) {
|
||||
// 使用修改后的键值对
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
if (false == arrayMode) {
|
||||
if (! arrayMode) {
|
||||
// JSONObject模式,写出键,否则只输出值
|
||||
writeKey(StrUtil.toString(pair.getKey()));
|
||||
}
|
||||
|
@@ -273,7 +273,7 @@ public class JSONArrayTest {
|
||||
.set("value3")
|
||||
.set(true);
|
||||
|
||||
final String s = json1.toJSONString(0, (pair) -> false == pair.getValue().equals("value2"));
|
||||
final String s = json1.toJSONString(0, (pair) -> ! pair.getValue().equals("value2"));
|
||||
Assertions.assertEquals("[\"value1\",\"value3\",true]", s);
|
||||
}
|
||||
|
||||
|
@@ -669,7 +669,7 @@ public class JSONObjectTest {
|
||||
.set("c", "value3")
|
||||
.set("d", true);
|
||||
|
||||
final String s = json1.toJSONString(0, (pair) -> false == pair.getKey().equals("b"));
|
||||
final String s = json1.toJSONString(0, (pair) -> ! pair.getKey().equals("b"));
|
||||
Assertions.assertEquals("{\"a\":\"value1\",\"c\":\"value3\",\"d\":true}", s);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user