This commit is contained in:
Looly
2023-04-12 01:22:54 +08:00
parent d2e5155ac5
commit a96a95c988
216 changed files with 480 additions and 480 deletions

View File

@@ -79,7 +79,7 @@ public final class InternalJSONUtil {
|| object instanceof Number //
|| ObjUtil.isBasicType(object) //
) {
if (! 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 (! (obj instanceof CharSequence))//
&& (! (obj instanceof JSONTokener))//
&& (! (obj instanceof Map));
return (!(obj instanceof CharSequence))//
&& (!(obj instanceof JSONTokener))//
&& (!(obj instanceof Map));
}
/**

View File

@@ -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 (! config.isIgnoreNullValue()) {
if (!config.isIgnoreNullValue()) {
while (index != this.size()) {
// 非末尾则填充null
this.add(null);

View File

@@ -114,7 +114,7 @@ public class JSONTokener extends ReaderWrapper {
* @return 是否进入结尾
*/
public boolean end() {
return this.eof && ! this.usePrevious;
return this.eof && !this.usePrevious;
}
/**

View File

@@ -394,7 +394,7 @@ public class JWT implements RegisteredPayload<JWT> {
* @since 5.7.4
*/
public boolean validate(final long leeway) {
if (! verify()) {
if (!verify()) {
return false;
}

View File

@@ -172,13 +172,13 @@ public class JWTValidator {
}
final String algorithmIdInSigner = signer.getAlgorithmId();
if (! StrUtil.equals(algorithmId, algorithmIdInSigner)) {
if (!StrUtil.equals(algorithmId, algorithmIdInSigner)) {
throw new ValidateException("Algorithm [{}] defined in header doesn't match to [{}]!"
, algorithmId, algorithmIdInSigner);
}
// 通过算法验证签名是否正确
if (! jwt.verify(signer)) {
if (!jwt.verify(signer)) {
throw new ValidateException("Signature verification failed!");
}
}

View File

@@ -119,7 +119,7 @@ public class JSONArrayMapper {
} else if (source instanceof Iterable<?>) {// Iterable
iter = ((Iterable<?>) source).iterator();
} else {
if(! jsonArray.config().isIgnoreError()){
if(!jsonArray.config().isIgnoreError()){
throw new JSONException("JSONArray initial value should be a string or collection or array.");
}
// 如果用户选择跳过异常,则跳过此值转换

View File

@@ -129,7 +129,7 @@ public class JSONObjectMapper {
// 普通Bean
mapFromBean(source, jsonObject);
} else {
if(! jsonObject.config().isIgnoreError()){
if(!jsonObject.config().isIgnoreError()){
// 不支持对象类型转换为JSONObject
throw new JSONException("Unsupported type [{}] to JSONObject!", source.getClass());
}

View File

@@ -158,13 +158,13 @@ public class JSONWriter extends Writer {
}
if (null != predicate) {
if (! predicate.test(pair)) {
if (!predicate.test(pair)) {
// 使用修改后的键值对
return this;
}
}
if (! arrayMode) {
if (!arrayMode) {
// JSONObject模式写出键否则只输出值
writeKey(StrUtil.toString(pair.getKey()));
}

View File

@@ -162,7 +162,7 @@ public class XMLTokener extends JSONTokener {
/**
* Returns the next XML meta token. This is used for skipping over &lt;!...&gt; and &lt;?...?&gt; structures.
*
* @return Syntax characters ({@code < > / = ! ?}) are returned as Character, and strings and names are returned as Boolean. We don't care what the values actually are.
* @return Syntax characters ({@code < > / = !?}) are returned as Character, and strings and names are returned as Boolean. We don't care what the values actually are.
* @throws JSONException 字符串中属性未关闭或XML结构错误抛出此异常。If a string is not properly closed or if the XML is badly structured.
*/
public Object nextMeta() throws JSONException {
@@ -223,7 +223,7 @@ public class XMLTokener extends JSONTokener {
/**
* Get the next XML Token. These tokens are found inside of angle brackets. <br>
* It may be one of these characters: {@code / > = ! ?} or it may be a string wrapped in single quotes or double
* It may be one of these characters: {@code / > = !?} or it may be a string wrapped in single quotes or double
* quotes, or it may be a name.
*
* @return a String or a Character.

View File

@@ -273,7 +273,7 @@ public class JSONArrayTest {
.set("value3")
.set(true);
final String s = json1.toJSONString(0, (pair) -> ! pair.getValue().equals("value2"));
final String s = json1.toJSONString(0, (pair) -> !pair.getValue().equals("value2"));
Assertions.assertEquals("[\"value1\",\"value3\",true]", s);
}

View File

@@ -669,7 +669,7 @@ public class JSONObjectTest {
.set("c", "value3")
.set("d", true);
final String s = json1.toJSONString(0, (pair) -> ! pair.getKey().equals("b"));
final String s = json1.toJSONString(0, (pair) -> !pair.getKey().equals("b"));
Assertions.assertEquals("{\"a\":\"value1\",\"c\":\"value3\",\"d\":true}", s);
}