Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
J
jadx
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
open-source
jadx
Commits
78a7e65a
Commit
78a7e65a
authored
Mar 25, 2015
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: filter out java core classes from printed stacktraces
parent
3314de8d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
0 deletions
+36
-0
Utils.java
jadx-core/src/main/java/jadx/core/utils/Utils.java
+36
-0
No files found.
jadx-core/src/main/java/jadx/core/utils/Utils.java
View file @
78a7e65a
package
jadx
.
core
.
utils
;
import
jadx.api.JadxDecompiler
;
import
java.io.PrintWriter
;
import
java.io.StringWriter
;
import
java.util.Arrays
;
import
java.util.Iterator
;
public
class
Utils
{
public
static
final
String
JADX_API_PACKAGE
=
JadxDecompiler
.
class
.
getPackage
().
getName
();
private
Utils
()
{
}
...
...
@@ -90,10 +95,41 @@ public class Utils {
}
StringWriter
sw
=
new
StringWriter
();
PrintWriter
pw
=
new
PrintWriter
(
sw
,
true
);
filterRecursive
(
throwable
);
throwable
.
printStackTrace
(
pw
);
return
sw
.
getBuffer
().
toString
();
}
private
static
void
filterRecursive
(
Throwable
th
)
{
try
{
filter
(
th
);
}
catch
(
Exception
e
)
{
// ignore filter exceptions
}
Throwable
cause
=
th
.
getCause
();
if
(
cause
!=
null
)
{
filterRecursive
(
cause
);
}
}
private
static
void
filter
(
Throwable
th
)
{
StackTraceElement
[]
stackTrace
=
th
.
getStackTrace
();
int
cutIndex
=
-
1
;
int
length
=
stackTrace
.
length
;
for
(
int
i
=
0
;
i
<
length
;
i
++)
{
StackTraceElement
stackTraceElement
=
stackTrace
[
i
];
if
(
stackTraceElement
.
getClassName
().
startsWith
(
JADX_API_PACKAGE
))
{
cutIndex
=
i
;
}
else
if
(
cutIndex
>
0
)
{
cutIndex
=
i
;
break
;
}
}
if
(
cutIndex
>
0
&&
cutIndex
<
length
)
{
th
.
setStackTrace
(
Arrays
.
copyOfRange
(
stackTrace
,
0
,
cutIndex
));
}
}
public
static
int
compare
(
int
x
,
int
y
)
{
return
x
<
y
?
-
1
:
x
==
y
?
0
:
1
;
}
...
...
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