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
a234227b
Commit
a234227b
authored
Aug 02, 2014
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: fix errors in try/catch processing (issue #13)
parent
16f736e7
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
101 additions
and
6 deletions
+101
-6
MethodNode.java
jadx-core/src/main/java/jadx/core/dex/nodes/MethodNode.java
+1
-0
RegionMaker.java
...main/java/jadx/core/dex/visitors/regions/RegionMaker.java
+5
-3
BlockUtils.java
jadx-core/src/main/java/jadx/core/utils/BlockUtils.java
+1
-1
TestIssue13a.java
...rc/test/java/jadx/tests/internal/others/TestIssue13a.java
+4
-2
TestIssue13b.java
...rc/test/java/jadx/tests/internal/others/TestIssue13b.java
+90
-0
No files found.
jadx-core/src/main/java/jadx/core/dex/nodes/MethodNode.java
View file @
a234227b
...
...
@@ -259,6 +259,7 @@ public class MethodNode extends LineAttrNode implements ILoadable {
if
(
ct1
!=
ct2
&&
ct2
.
containsAllHandlers
(
ct1
))
{
for
(
ExceptionHandler
h
:
ct1
.
getHandlers
())
{
ct2
.
removeHandler
(
this
,
h
);
h
.
setTryBlock
(
ct1
);
}
}
}
...
...
jadx-core/src/main/java/jadx/core/dex/visitors/regions/RegionMaker.java
View file @
a234227b
...
...
@@ -273,13 +273,15 @@ public class RegionMaker {
}
Region
body
=
makeRegion
(
loopStart
,
stack
);
if
(!
RegionUtils
.
isRegionContainsBlock
(
body
,
loop
.
getEnd
()))
{
body
.
getSubBlocks
().
add
(
loop
.
getEnd
());
BlockNode
loopEnd
=
loop
.
getEnd
();
if
(!
RegionUtils
.
isRegionContainsBlock
(
body
,
loopEnd
)
&&
!
loopEnd
.
contains
(
AType
.
EXC_HANDLER
))
{
body
.
getSubBlocks
().
add
(
loopEnd
);
}
loopRegion
.
setBody
(
body
);
if
(
loopExit
==
null
)
{
BlockNode
next
=
getNextBlock
(
loop
.
getEnd
()
);
BlockNode
next
=
getNextBlock
(
loop
End
);
loopExit
=
RegionUtils
.
isRegionContainsBlock
(
body
,
next
)
?
null
:
next
;
}
stack
.
pop
();
...
...
jadx-core/src/main/java/jadx/core/utils/BlockUtils.java
View file @
a234227b
...
...
@@ -255,7 +255,7 @@ public class BlockUtils {
}
BitSet
b
=
new
BitSet
();
b
.
or
(
b1
.
getDomFrontier
());
b
.
or
(
b2
.
getDomFrontier
());
b
.
and
(
b2
.
getDomFrontier
());
b
.
clear
(
b1
.
getId
());
b
.
clear
(
b2
.
getId
());
if
(
b
.
cardinality
()
==
1
)
{
...
...
jadx-core/src/test/java/jadx/tests/internal/others/TestIssue13.java
→
jadx-core/src/test/java/jadx/tests/internal/others/TestIssue13
a
.java
View file @
a234227b
...
...
@@ -11,12 +11,14 @@ import org.junit.Test;
import
static
jadx
.
tests
.
utils
.
JadxMatchers
.
containsOne
;
import
static
org
.
junit
.
Assert
.
assertThat
;
public
class
TestIssue13
extends
InternalJadxTest
{
public
class
TestIssue13
a
extends
InternalJadxTest
{
public
static
class
TestCls
{
private
static
final
String
TAG
=
"Parcel"
;
private
static
HashMap
<
ClassLoader
,
HashMap
<
String
,
Parcelable
.
Creator
>>
mCreators
;
private
static
final
HashMap
<
ClassLoader
,
HashMap
<
String
,
Parcelable
.
Creator
>>
mCreators
=
new
HashMap
<
ClassLoader
,
HashMap
<
String
,
Parcelable
.
Creator
>>();
@SuppressWarnings
(
"unchecked"
)
public
final
<
T
extends
Parcelable
>
T
test
(
ClassLoader
loader
)
{
String
name
=
readString
();
if
(
name
==
null
)
{
...
...
jadx-core/src/test/java/jadx/tests/internal/others/TestIssue13b.java
0 → 100644
View file @
a234227b
package
jadx
.
tests
.
internal
.
others
;
import
jadx.api.InternalJadxTest
;
import
jadx.core.dex.nodes.ClassNode
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.util.Properties
;
import
java.util.concurrent.CountDownLatch
;
import
org.junit.Test
;
import
static
jadx
.
tests
.
utils
.
JadxMatchers
.
containsOne
;
import
static
jadx
.
tests
.
utils
.
JadxMatchers
.
countString
;
import
static
org
.
junit
.
Assert
.
assertThat
;
public
class
TestIssue13b
extends
InternalJadxTest
{
public
static
class
TestCls
{
private
static
final
String
PROPERTIES_FILE
=
""
;
private
static
final
String
TAG
=
""
;
private
final
CountDownLatch
mInitializedLatch
=
new
CountDownLatch
(
1
);
private
int
mC2KServerPort
=
0
;
private
String
mSuplServerHost
=
""
;
private
int
mSuplServerPort
=
0
;
private
String
mC2KServerHost
=
""
;
public
TestCls
()
{
Properties
mProperties
=
new
Properties
();
try
{
File
file
=
new
File
(
PROPERTIES_FILE
);
FileInputStream
stream
=
new
FileInputStream
(
file
);
mProperties
.
load
(
stream
);
stream
.
close
();
mSuplServerHost
=
mProperties
.
getProperty
(
"SUPL_HOST"
);
String
portString
=
mProperties
.
getProperty
(
"SUPL_PORT"
);
if
(
mSuplServerHost
!=
null
&&
portString
!=
null
)
{
try
{
mSuplServerPort
=
Integer
.
parseInt
(
portString
);
}
catch
(
NumberFormatException
e
)
{
Log
.
e
(
TAG
,
"unable to parse SUPL_PORT: "
+
portString
);
}
}
mC2KServerHost
=
mProperties
.
getProperty
(
"C2K_HOST"
);
portString
=
mProperties
.
getProperty
(
"C2K_PORT"
);
if
(
mC2KServerHost
!=
null
&&
portString
!=
null
)
{
try
{
mC2KServerPort
=
Integer
.
parseInt
(
portString
);
}
catch
(
NumberFormatException
e
)
{
Log
.
e
(
TAG
,
"unable to parse C2K_PORT: "
+
portString
);
}
}
}
catch
(
IOException
e
)
{
Log
.
e
(
TAG
,
"Could not open GPS configuration file "
+
PROPERTIES_FILE
);
}
Thread
mThread
=
new
Thread
();
mThread
.
start
();
while
(
true
)
{
try
{
mInitializedLatch
.
await
();
break
;
}
catch
(
InterruptedException
e
)
{
Thread
.
currentThread
().
interrupt
();
}
}
}
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
);
assertThat
(
code
,
countString
(
4
,
"} catch ("
));
assertThat
(
code
,
countString
(
3
,
"Log.e("
));
assertThat
(
code
,
containsOne
(
"Thread.currentThread().interrupt();"
));
}
}
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