Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
common
Project
Project
Details
Activity
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
曲欣亮
common
Commits
86fd1903
Commit
86fd1903
authored
Nov 25, 2020
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
9ee3817b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
0 deletions
+20
-0
StringUtil.java
src/main/java/com/egolm/common/StringUtil.java
+20
-0
No files found.
src/main/java/com/egolm/common/StringUtil.java
View file @
86fd1903
...
@@ -1161,6 +1161,8 @@ public class StringUtil {
...
@@ -1161,6 +1161,8 @@ public class StringUtil {
return
null
;
return
null
;
}
else
if
(
object
instanceof
Date
)
{
}
else
if
(
object
instanceof
Date
)
{
return
DateUtil
.
format
((
Date
)
object
);
return
DateUtil
.
format
((
Date
)
object
);
}
else
if
(
object
instanceof
Throwable
)
{
return
toStackString
((
Throwable
)
object
).
toString
();
}
}
return
object
.
toString
();
return
object
.
toString
();
}
}
...
@@ -1169,4 +1171,22 @@ public class StringUtil {
...
@@ -1169,4 +1171,22 @@ public class StringUtil {
return
str1
==
null
?
str2
==
null
:
str1
.
equals
(
str2
);
return
str1
==
null
?
str2
==
null
:
str1
.
equals
(
str2
);
}
}
public
static
StringBuffer
toStackString
(
Throwable
ex
)
{
StringBuffer
stack
=
new
StringBuffer
();
if
(
ex
!=
null
)
{
stack
.
append
(
ex
.
getClass
().
getName
()).
append
(
": "
).
append
(
ex
.
getMessage
()).
append
(
System
.
lineSeparator
());
StackTraceElement
[]
elms
=
ex
.
getStackTrace
();
for
(
StackTraceElement
elm
:
elms
)
{
stack
.
append
(
"\t"
).
append
(
elm
.
getClassName
()).
append
(
"."
).
append
(
elm
.
getMethodName
()).
append
(
"("
).
append
(
elm
.
getFileName
()).
append
(
" "
).
append
(
elm
.
getLineNumber
()).
append
(
")\n"
);
}
if
(
ex
.
getCause
()
!=
null
)
{
stack
.
append
(
"\n\n"
).
append
(
"Cause By: \n"
).
append
(
toStackString
(
ex
.
getCause
()));
}
for
(
Throwable
e
:
ex
.
getSuppressed
())
{
stack
.
append
(
"\n\n"
).
append
(
"Suppressed By: \n"
).
append
(
toStackString
(
e
));
}
}
return
stack
;
}
}
}
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