Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Eladmin
Commits
7167f292
Unverified
Commit
7167f292
authored
Nov 16, 2021
by
18331247943
Committed by
GitHub
Nov 16, 2021
Browse files
Update StringUtils.java (#696)
资源泄漏
parent
38262e06
Changes
1
Hide whitespace changes
Inline
Side-by-side
eladmin-common/src/main/java/me/zhengjie/utils/StringUtils.java
View file @
7167f292
...
@@ -217,14 +217,17 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
...
@@ -217,14 +217,17 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
*/
*/
public
static
String
getLocalCityInfo
(
String
ip
)
{
public
static
String
getLocalCityInfo
(
String
ip
)
{
try
{
try
{
D
ataBlock
dataBlock
=
new
DbSearcher
(
config
,
file
.
getPath
())
D
bSearcher
dbSearcher
=
new
DbSearcher
(
config
,
file
.
getPath
())
;
.
binarySearch
(
ip
);
DataBlock
dataBlock
=
dbSearcher
.
binarySearch
(
ip
);
String
region
=
dataBlock
.
getRegion
();
String
region
=
dataBlock
.
getRegion
();
String
address
=
region
.
replace
(
"0|"
,
""
);
String
address
=
region
.
replace
(
"0|"
,
""
);
char
symbol
=
'|'
;
char
symbol
=
'|'
;
if
(
address
.
charAt
(
address
.
length
()
-
1
)
==
symbol
)
{
if
(
address
.
charAt
(
address
.
length
()
-
1
)
==
symbol
)
{
address
=
address
.
substring
(
0
,
address
.
length
()
-
1
);
address
=
address
.
substring
(
0
,
address
.
length
()
-
1
);
}
}
if
(
dataBlock
!=
null
){
dbSearcher
.
close
();
}
return
address
.
equals
(
ElAdminConstant
.
REGION
)
?
"内网IP"
:
address
;
return
address
.
equals
(
ElAdminConstant
.
REGION
)
?
"内网IP"
:
address
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
log
.
error
(
e
.
getMessage
(),
e
);
...
...
Write
Preview
Supports
Markdown
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