From 39f21f6f0f5a2428bac546e70abe391a68d73afa Mon Sep 17 00:00:00 2001 From: gdjs2 Date: Sun, 25 Apr 2021 04:12:46 +0000 Subject: [PATCH] Format the code; Use valueOf(String) instead of the deprecated Long(String) --- .../src/main/java/apijson/JSONResponse.java | 18 +++++++----------- .../java/apijson/orm/AbstractVerifier.java | 2 +- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/APIJSONORM/src/main/java/apijson/JSONResponse.java b/APIJSONORM/src/main/java/apijson/JSONResponse.java index ae60fd24..d979c732 100755 --- a/APIJSONORM/src/main/java/apijson/JSONResponse.java +++ b/APIJSONORM/src/main/java/apijson/JSONResponse.java @@ -505,16 +505,12 @@ public class JSONResponse extends apijson.JSONObject { public static String formatHyphen(@NotNull String key, boolean firstCase) { String name = ""; - StringTokenizer parts = new StringTokenizer(key, "-"); - name += parts.nextToken(); - while(parts.hasMoreTokens()) - { - String part = parts.nextToken(); - name += firstCase ? StringUtil.firstCase(part, true) : part; - } - - return name; + StringTokenizer parts = new StringTokenizer(key, "-"); + name += parts.nextToken(); + while(parts.hasMoreTokens()) { + String part = parts.nextToken(); + name += firstCase ? StringUtil.firstCase(part, true) : part; + } + return name; } - - } diff --git a/APIJSONORM/src/main/java/apijson/orm/AbstractVerifier.java b/APIJSONORM/src/main/java/apijson/orm/AbstractVerifier.java index 633b5d64..926a037f 100755 --- a/APIJSONORM/src/main/java/apijson/orm/AbstractVerifier.java +++ b/APIJSONORM/src/main/java/apijson/orm/AbstractVerifier.java @@ -277,7 +277,7 @@ public abstract class AbstractVerifier implements Verifier, IdCallback { if (id instanceof Number == false) {//不能准确地判断Long,可能是Integer throw new UnsupportedDataTypeException(table + ".id类型错误,id类型必须是Long!"); } - if (list.contains(new Long("" + id)) == false) {//Integer等转为Long才能正确判断。强转崩溃 + if (list.contains(Long.valueOf("" + id)) == false) {//Integer等转为Long才能正确判断。强转崩溃 throw new IllegalAccessException(visitorIdkey + " = " + id + " 的 " + table + " 不允许 " + role.name() + " 用户的 " + method.name() + " 请求!"); }