Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
ioc_sixiang_license
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zengtianlai3
ioc_sixiang_license
Commits
52be6d5f
Commit
52be6d5f
authored
Jul 06, 2022
by
zengtianlai3
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
解决null引用
parent
6bef9021
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
3 deletions
+8
-3
BalanceManager.java
...main/java/iot/sixiang/license/balance/BalanceManager.java
+4
-1
CommonUtil.java
...se/src/main/java/iot/sixiang/license/util/CommonUtil.java
+4
-2
No files found.
license/src/main/java/iot/sixiang/license/balance/BalanceManager.java
View file @
52be6d5f
...
...
@@ -46,7 +46,10 @@ public class BalanceManager {
}
catch
(
NoSuchAlgorithmException
e
)
{
log
.
error
(
"SecureRandom 不可用"
);
}
int
index
=
secureRandom
.
nextInt
(
count
);
int
index
=
0
;
if
(
secureRandom
!=
null
)
{
index
=
secureRandom
.
nextInt
(
count
);
}
List
<
Server
>
servers
=
new
ArrayList
<>(
allServers
.
values
());
return
servers
.
get
(
index
);
}
...
...
license/src/main/java/iot/sixiang/license/util/CommonUtil.java
View file @
52be6d5f
...
...
@@ -22,7 +22,7 @@ public class CommonUtil {
*/
public
static
String
genRandomNum
(
int
length
)
{
int
maxNum
=
36
;
int
i
;
int
i
=
-
1
;
int
count
=
0
;
char
[]
str
=
{
'A'
,
'B'
,
'C'
,
'D'
,
'E'
,
'F'
,
'G'
,
'H'
,
'I'
,
'J'
,
'K'
,
'L'
,
'M'
,
'N'
,
'O'
,
'P'
,
'Q'
,
'R'
,
'S'
,
'T'
,
'U'
,
'V'
,
'W'
,
'X'
,
'Y'
,
'Z'
,
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
};
...
...
@@ -34,7 +34,9 @@ public class CommonUtil {
log
.
error
(
"随机生成字符串失败"
);
}
while
(
count
<
length
)
{
i
=
Math
.
abs
(
secureRandom
.
nextInt
(
maxNum
));
if
(
secureRandom
!=
null
)
{
i
=
Math
.
abs
(
secureRandom
.
nextInt
(
maxNum
));
}
if
(
i
>=
0
&&
i
<
str
.
length
)
{
pwd
.
append
(
str
[
i
]);
count
++;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment