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
16f736e7
Commit
16f736e7
authored
Jul 30, 2014
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: fix missing 'catch' code
parent
1fe24ad1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
103 additions
and
2 deletions
+103
-2
RegionMaker.java
...main/java/jadx/core/dex/visitors/regions/RegionMaker.java
+3
-2
TestIssue13.java
...src/test/java/jadx/tests/internal/others/TestIssue13.java
+100
-0
No files found.
jadx-core/src/main/java/jadx/core/dex/visitors/regions/RegionMaker.java
View file @
16f736e7
...
...
@@ -571,8 +571,9 @@ public class RegionMaker {
LOG
.
debug
(
ErrorsCounter
.
formatErrorMsg
(
mth
,
"No successors for splitter: "
+
splitter
));
continue
;
}
BlockNode
cross
=
BlockUtils
.
getPathCross
(
mth
,
s
.
get
(
0
),
handler
);
if
(
cross
!=
null
)
{
BlockNode
ss
=
s
.
get
(
0
);
BlockNode
cross
=
BlockUtils
.
getPathCross
(
mth
,
ss
,
handler
);
if
(
cross
!=
null
&&
cross
!=
ss
&&
cross
!=
handler
)
{
exits
.
add
(
cross
);
}
}
...
...
jadx-core/src/test/java/jadx/tests/internal/others/TestIssue13.java
0 → 100644
View file @
16f736e7
package
jadx
.
tests
.
internal
.
others
;
import
jadx.api.InternalJadxTest
;
import
jadx.core.dex.nodes.ClassNode
;
import
java.lang.reflect.Field
;
import
java.util.HashMap
;
import
org.junit.Test
;
import
static
jadx
.
tests
.
utils
.
JadxMatchers
.
containsOne
;
import
static
org
.
junit
.
Assert
.
assertThat
;
public
class
TestIssue13
extends
InternalJadxTest
{
public
static
class
TestCls
{
private
static
final
String
TAG
=
"Parcel"
;
private
static
HashMap
<
ClassLoader
,
HashMap
<
String
,
Parcelable
.
Creator
>>
mCreators
;
public
final
<
T
extends
Parcelable
>
T
test
(
ClassLoader
loader
)
{
String
name
=
readString
();
if
(
name
==
null
)
{
return
null
;
}
Parcelable
.
Creator
<
T
>
creator
;
synchronized
(
mCreators
)
{
HashMap
<
String
,
Parcelable
.
Creator
>
map
=
mCreators
.
get
(
loader
);
if
(
map
==
null
)
{
map
=
new
HashMap
<
String
,
Parcelable
.
Creator
>();
mCreators
.
put
(
loader
,
map
);
}
creator
=
map
.
get
(
name
);
if
(
creator
==
null
)
{
try
{
Class
c
=
loader
==
null
?
Class
.
forName
(
name
)
:
Class
.
forName
(
name
,
true
,
loader
);
Field
f
=
c
.
getField
(
"CREATOR"
);
creator
=
(
Parcelable
.
Creator
)
f
.
get
(
null
);
}
catch
(
IllegalAccessException
e
)
{
Log
.
e
(
TAG
,
"1"
+
name
+
", e: "
+
e
);
throw
new
RuntimeException
(
"2"
+
name
);
}
catch
(
ClassNotFoundException
e
)
{
Log
.
e
(
TAG
,
"3"
+
name
+
", e: "
+
e
);
throw
new
RuntimeException
(
"4"
+
name
);
}
catch
(
ClassCastException
e
)
{
throw
new
RuntimeException
(
"5"
+
name
);
}
catch
(
NoSuchFieldException
e
)
{
throw
new
RuntimeException
(
"6"
+
name
);
}
if
(
creator
==
null
)
{
throw
new
RuntimeException
(
"7"
+
name
);
}
map
.
put
(
name
,
creator
);
}
}
if
(
creator
instanceof
Parcelable
.
ClassLoaderCreator
<?>)
{
return
((
Parcelable
.
ClassLoaderCreator
<
T
>)
creator
).
createFromParcel
(
this
,
loader
);
}
return
creator
.
createFromParcel
(
this
);
}
private
String
readString
()
{
return
""
;
}
private
class
Parcelable
{
public
class
Creator
<
T
>
{
public
T
createFromParcel
(
TestCls
testCls
)
{
return
null
;
}
}
public
class
ClassLoaderCreator
<
T
>
extends
Creator
<
T
>
{
public
T
createFromParcel
(
TestCls
testCls
,
ClassLoader
loader
)
{
return
null
;
}
}
}
private
static
class
Log
{
public
static
void
e
(
String
tag
,
String
s
)
{
}
}
}
@Test
public
void
test
()
{
ClassNode
cls
=
getClassNode
(
TestCls
.
class
);
String
code
=
cls
.
getCode
().
toString
();
System
.
out
.
println
(
code
);
for
(
int
i
=
1
;
i
<=
7
;
i
++)
{
assertThat
(
code
,
containsOne
(
"\""
+
i
+
"\""
));
}
// TODO: add additional checks
// assertThat(code, not(containsString("Throwable")));
}
}
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