Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
keyescgm
jadx
提交
ea167cbe
J
jadx
项目概览
keyescgm
/
jadx
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jadx
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
ea167cbe
编写于
11月 08, 2021
作者:
S
Skylot
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(gui): resolve NPE in resource index for single dex, other minor issues
上级
90a43623
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
27 addition
and
13 deletion
+27
-13
jadx-gui/src/main/java/jadx/gui/ui/MainWindow.java
jadx-gui/src/main/java/jadx/gui/ui/MainWindow.java
+5
-1
jadx-gui/src/main/java/jadx/gui/utils/search/ResourceIndex.java
...ui/src/main/java/jadx/gui/utils/search/ResourceIndex.java
+22
-12
未找到文件。
jadx-gui/src/main/java/jadx/gui/ui/MainWindow.java
浏览文件 @
ea167cbe
...
...
@@ -1319,7 +1319,11 @@ public class MainWindow extends JFrame {
for
(
EditorViewState
viewState
:
openTabs
)
{
tabbedPane
.
restoreEditorViewState
(
viewState
);
}
tabbedPane
.
setSelectedIndex
(
project
.
getActiveTab
());
try
{
tabbedPane
.
setSelectedIndex
(
project
.
getActiveTab
());
}
catch
(
Exception
e
)
{
LOG
.
warn
(
"Failed to restore active tab"
,
e
);
}
}
private
void
saveSplittersInfo
()
{
...
...
jadx-gui/src/main/java/jadx/gui/utils/search/ResourceIndex.java
浏览文件 @
ea167cbe
...
...
@@ -11,6 +11,10 @@ import java.util.zip.ZipFile;
import
javax.swing.tree.TreeNode
;
import
org.jetbrains.annotations.Nullable
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
io.reactivex.BackpressureStrategy
;
import
io.reactivex.Flowable
;
import
io.reactivex.FlowableEmitter
;
...
...
@@ -26,9 +30,12 @@ import static jadx.core.utils.StringUtils.countLinesByPos;
import
static
jadx
.
core
.
utils
.
StringUtils
.
getLine
;
public
class
ResourceIndex
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
ResourceIndex
.
class
);
private
final
List
<
JResource
>
resNodes
=
new
ArrayList
<>();
private
final
Set
<
String
>
extSet
=
new
HashSet
<>();
private
CacheObject
cache
;
private
final
CacheObject
cache
;
private
String
fileExts
;
private
boolean
anyExt
;
private
int
sizeLimit
;
...
...
@@ -40,7 +47,6 @@ public class ResourceIndex {
private
void
search
(
final
JResource
resNode
,
FlowableEmitter
<
JResSearchNode
>
emitter
,
SearchSettings
searchSettings
)
{
int
pos
=
0
;
int
line
=
0
;
int
lastPos
=
0
;
int
lastLineOccurred
=
-
1
;
...
...
@@ -50,12 +56,12 @@ public class ResourceIndex {
try
{
content
=
resNode
.
getContent
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
);
LOG
.
error
(
"Error load resource node content"
,
e
);
return
;
}
do
{
searchSettings
.
setStartPos
(
lastPos
);
pos
=
searchSettings
.
find
(
content
);
int
pos
=
searchSettings
.
find
(
content
);
if
(
pos
>
-
1
)
{
line
+=
countLinesByPos
(
content
,
pos
,
lastPos
);
lastPos
=
pos
+
searchStrLen
;
...
...
@@ -103,7 +109,7 @@ public class ResourceIndex {
resNodes
.
clear
();
}
private
void
traverseTree
(
TreeNode
root
,
ZipFile
zip
)
{
private
void
traverseTree
(
TreeNode
root
,
@Nullable
ZipFile
zip
)
{
for
(
int
i
=
0
;
i
<
root
.
getChildCount
();
i
++)
{
TreeNode
node
=
root
.
getChildAt
(
i
);
if
(
node
instanceof
JResource
)
{
...
...
@@ -111,7 +117,7 @@ public class ResourceIndex {
try
{
resNode
.
loadNode
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
);
LOG
.
error
(
"Error load resource node: {}"
,
resNode
,
e
);
return
;
}
ResourceFile
resFile
=
resNode
.
getResFile
();
...
...
@@ -133,6 +139,7 @@ public class ResourceIndex {
return
anyExt
||
fileExts
.
contains
(
".xml"
);
}
@Nullable
private
ZipFile
getZipFile
(
TreeNode
res
)
{
for
(
int
i
=
0
;
i
<
res
.
getChildCount
();
i
++)
{
TreeNode
node
=
res
.
getChildAt
(
i
);
...
...
@@ -141,7 +148,7 @@ public class ResourceIndex {
try
{
resNode
.
loadNode
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
);
LOG
.
error
(
"Error load resource node: {}"
,
resNode
,
e
);
return
null
;
}
ResourceFile
file
=
resNode
.
getResFile
();
...
...
@@ -151,11 +158,14 @@ public class ResourceIndex {
return
zip
;
}
}
else
{
File
zfile
=
file
.
getZipRef
().
getZipFile
();
if
(
FileUtils
.
isZipFile
(
zfile
))
{
try
{
return
new
ZipFile
(
zfile
);
}
catch
(
IOException
ignore
)
{
ResourceFile
.
ZipRef
zipRef
=
file
.
getZipRef
();
if
(
zipRef
!=
null
)
{
File
zfile
=
zipRef
.
getZipFile
();
if
(
FileUtils
.
isZipFile
(
zfile
))
{
try
{
return
new
ZipFile
(
zfile
);
}
catch
(
IOException
ignore
)
{
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录