This commit is contained in:
Sola
2016-05-13 11:11:13 +08:00
parent e834fdfb7b
commit b5ccd18a59
17 changed files with 129 additions and 120 deletions

View File

@@ -32,7 +32,8 @@ public class Checker {
if (!phone.matches(PHONE_NUMBER_REGEX)) return -1;
try {
return Long.parseLong(phone);
} catch (NumberFormatException ignored) { }
} catch (NumberFormatException ignored) {
}
return -1;
}
@@ -40,7 +41,8 @@ public class Checker {
if (isp == null) return null;
try {
return ISP.fromId(Integer.parseInt(isp));
} catch (NumberFormatException ignored) { }
} catch (NumberFormatException ignored) {
}
return null;
}
@@ -59,7 +61,8 @@ public class Checker {
return b;
else
return -1;
} catch (NumberFormatException ignored) { }
} catch (NumberFormatException ignored) {
}
return -1;
}
@@ -72,7 +75,8 @@ public class Checker {
return i;
else
return -1;
} catch (NumberFormatException ignored) { }
} catch (NumberFormatException ignored) {
}
return -1;
}

View File

@@ -19,9 +19,11 @@ public class ParseUtil {
.append(lang("Ticket_Info_Id")).append(t.getId()).append("\n")
.append(lang("Ticket_Info_Desc")).append(t.getDescription()).append("\n")
.append(lang("Ticket_Info_Submit_Time")).append(dateFormat.format(t.getSubmitTime())).append("\n");
if (t.getOperator() != null) sb.append(lang("Ticket_Info_Operator")).append(t.getOperator().getId()).append("\n");
if (t.getOperator() != null)
sb.append(lang("Ticket_Info_Operator")).append(t.getOperator().getId()).append("\n");
if (t.getRemark() != null) sb.append(lang("Ticket_Info_Remark")).append(t.getRemark()).append("\n");
if (t.getUpdateTime() != null) sb.append(lang("Ticket_Info_Update_Time")).append(dateFormat.format(t.getUpdateTime())).append("\n");
if (t.getUpdateTime() != null)
sb.append(lang("Ticket_Info_Update_Time")).append(dateFormat.format(t.getUpdateTime())).append("\n");
sb.append(lang("Ticket_Info_Status")).append(Status.getLocalized(t.getStatus()));
return sb.toString();
}

View File

@@ -19,9 +19,9 @@ public class RSAUtil {
public static String publicKey_s;
public static String privateKey_s;
static {
genKeyPair();
}
static {
genKeyPair();
}
public static void genKeyPair() {
try {
@@ -38,27 +38,27 @@ public class RSAUtil {
}
public static String encrypt(String value) {
try {
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.ENCRYPT_MODE, publicKey);
byte[] encrypted = cipher.doFinal(value.getBytes(StandardCharsets.UTF_8));
return Base64.encodeBase64String(encrypted);
} catch (Exception ex) {
ex.printStackTrace();
}
return null;
}
try {
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.ENCRYPT_MODE, publicKey);
byte[] encrypted = cipher.doFinal(value.getBytes(StandardCharsets.UTF_8));
return Base64.encodeBase64String(encrypted);
} catch (Exception ex) {
ex.printStackTrace();
}
return null;
}
public static String decrypt(String encrypted) {
try {
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.DECRYPT_MODE, privateKey);
byte[] original = cipher.doFinal(Base64.decodeBase64(encrypted));
return new String(original, StandardCharsets.UTF_8);
} catch (Exception ex) {
ex.printStackTrace();
}
return null;
}
public static String decrypt(String encrypted) {
try {
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.DECRYPT_MODE, privateKey);
byte[] original = cipher.doFinal(Base64.decodeBase64(encrypted));
return new String(original, StandardCharsets.UTF_8);
} catch (Exception ex) {
ex.printStackTrace();
}
return null;
}
}

View File

@@ -98,8 +98,7 @@ public class Redirect {
WARN("weui_icon_warn"),
WARN_SAFE("weui_icon_safe_warn"),
DOWNLOAD("weui_icon_download"),
CANCEL("weui_icon_cancel"),
;
CANCEL("weui_icon_cancel"),;
private String value;