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
183eeb05
Commit
183eeb05
authored
Jul 06, 2022
by
zengtianlai3
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'm33' into 'master'
解决null引用 See merge request
!42
parents
6bef9021
52be6d5f
Changes
2
Show 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 @
183eeb05
...
@@ -46,7 +46,10 @@ public class BalanceManager {
...
@@ -46,7 +46,10 @@ public class BalanceManager {
}
catch
(
NoSuchAlgorithmException
e
)
{
}
catch
(
NoSuchAlgorithmException
e
)
{
log
.
error
(
"SecureRandom 不可用"
);
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
());
List
<
Server
>
servers
=
new
ArrayList
<>(
allServers
.
values
());
return
servers
.
get
(
index
);
return
servers
.
get
(
index
);
}
}
...
...
license/src/main/java/iot/sixiang/license/util/CommonUtil.java
View file @
183eeb05
...
@@ -22,7 +22,7 @@ public class CommonUtil {
...
@@ -22,7 +22,7 @@ public class CommonUtil {
*/
*/
public
static
String
genRandomNum
(
int
length
)
{
public
static
String
genRandomNum
(
int
length
)
{
int
maxNum
=
36
;
int
maxNum
=
36
;
int
i
;
int
i
=
-
1
;
int
count
=
0
;
int
count
=
0
;
char
[]
str
=
{
'A'
,
'B'
,
'C'
,
'D'
,
'E'
,
'F'
,
'G'
,
'H'
,
'I'
,
'J'
,
'K'
,
'L'
,
'M'
,
'N'
,
'O'
,
'P'
,
'Q'
,
'R'
,
'S'
,
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'
};
'T'
,
'U'
,
'V'
,
'W'
,
'X'
,
'Y'
,
'Z'
,
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
};
...
@@ -34,7 +34,9 @@ public class CommonUtil {
...
@@ -34,7 +34,9 @@ public class CommonUtil {
log
.
error
(
"随机生成字符串失败"
);
log
.
error
(
"随机生成字符串失败"
);
}
}
while
(
count
<
length
)
{
while
(
count
<
length
)
{
if
(
secureRandom
!=
null
)
{
i
=
Math
.
abs
(
secureRandom
.
nextInt
(
maxNum
));
i
=
Math
.
abs
(
secureRandom
.
nextInt
(
maxNum
));
}
if
(
i
>=
0
&&
i
<
str
.
length
)
{
if
(
i
>=
0
&&
i
<
str
.
length
)
{
pwd
.
append
(
str
[
i
]);
pwd
.
append
(
str
[
i
]);
count
++;
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