From f5badba2bb9f40695ab5d1e362a3f63298989a4d Mon Sep 17 00:00:00 2001
From: Sxile <3440626@qq.com>
Date: 星期五, 19 六月 2020 18:13:54 +0800
Subject: [PATCH] 添加{}使代码更容易理解
---
ruoyi/src/main/java/com/ruoyi/common/utils/ip/IpUtils.java | 18 ++++++++++++------
ruoyi/src/main/java/com/ruoyi/common/utils/VerifyCodeUtils.java | 6 ++++--
2 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/ruoyi/src/main/java/com/ruoyi/common/utils/VerifyCodeUtils.java b/ruoyi/src/main/java/com/ruoyi/common/utils/VerifyCodeUtils.java
index 80b8c84..0417181 100644
--- a/ruoyi/src/main/java/com/ruoyi/common/utils/VerifyCodeUtils.java
+++ b/ruoyi/src/main/java/com/ruoyi/common/utils/VerifyCodeUtils.java
@@ -139,10 +139,12 @@
private static Color getRandColor(int fc, int bc)
{
- if (fc > 255)
+ if (fc > 255) {
fc = 255;
- if (bc > 255)
+ }
+ if (bc > 255) {
bc = 255;
+ }
int r = fc + random.nextInt(bc - fc);
int g = fc + random.nextInt(bc - fc);
int b = fc + random.nextInt(bc - fc);
diff --git a/ruoyi/src/main/java/com/ruoyi/common/utils/ip/IpUtils.java b/ruoyi/src/main/java/com/ruoyi/common/utils/ip/IpUtils.java
index b9f1373..771e3f8 100644
--- a/ruoyi/src/main/java/com/ruoyi/common/utils/ip/IpUtils.java
+++ b/ruoyi/src/main/java/com/ruoyi/common/utils/ip/IpUtils.java
@@ -110,8 +110,9 @@
{
case 1:
l = Long.parseLong(elements[0]);
- if ((l < 0L) || (l > 4294967295L))
+ if ((l < 0L) || (l > 4294967295L)) {
return null;
+ }
bytes[0] = (byte) (int) (l >> 24 & 0xFF);
bytes[1] = (byte) (int) ((l & 0xFFFFFF) >> 16 & 0xFF);
bytes[2] = (byte) (int) ((l & 0xFFFF) >> 8 & 0xFF);
@@ -119,12 +120,14 @@
break;
case 2:
l = Integer.parseInt(elements[0]);
- if ((l < 0L) || (l > 255L))
+ if ((l < 0L) || (l > 255L)) {
return null;
+ }
bytes[0] = (byte) (int) (l & 0xFF);
l = Integer.parseInt(elements[1]);
- if ((l < 0L) || (l > 16777215L))
+ if ((l < 0L) || (l > 16777215L)) {
return null;
+ }
bytes[1] = (byte) (int) (l >> 16 & 0xFF);
bytes[2] = (byte) (int) ((l & 0xFFFF) >> 8 & 0xFF);
bytes[3] = (byte) (int) (l & 0xFF);
@@ -133,13 +136,15 @@
for (i = 0; i < 2; ++i)
{
l = Integer.parseInt(elements[i]);
- if ((l < 0L) || (l > 255L))
+ if ((l < 0L) || (l > 255L)) {
return null;
+ }
bytes[i] = (byte) (int) (l & 0xFF);
}
l = Integer.parseInt(elements[2]);
- if ((l < 0L) || (l > 65535L))
+ if ((l < 0L) || (l > 65535L)) {
return null;
+ }
bytes[2] = (byte) (int) (l >> 8 & 0xFF);
bytes[3] = (byte) (int) (l & 0xFF);
break;
@@ -147,8 +152,9 @@
for (i = 0; i < 4; ++i)
{
l = Integer.parseInt(elements[i]);
- if ((l < 0L) || (l > 255L))
+ if ((l < 0L) || (l > 255L)) {
return null;
+ }
bytes[i] = (byte) (int) (l & 0xFF);
}
break;
--
Gitblit v1.9.3