Skip to content

Commit

Permalink
fix(res): XML "@null" decoding (#1583)(PR #1594)
Browse files Browse the repository at this point in the history
minor improvements
  • Loading branch information
jpstotz committed Jul 31, 2022
1 parent 691d5cd commit ae2d4da
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion jadx-core/src/main/java/jadx/core/deobf/Deobfuscator.java
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,9 @@ private String makeClsPrefix(ClassNode cls) {
return "Enum";
}
String result = "";
if (cls.getAccessFlags().isAbstract()) {
if (cls.getAccessFlags().isInterface()) {
result += "Interface";
} else if (cls.getAccessFlags().isAbstract()) {
result += "Abstract";
}

Expand Down
6 changes: 4 additions & 2 deletions jadx-core/src/main/java/jadx/core/xmlgen/ResXmlGen.java
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,13 @@ private void addProtoItem(ICodeWriter cw, String itemTag, String typeName, Proto
private void addItem(ICodeWriter cw, String itemTag, String typeName, RawNamedValue value) {
String nameStr = vp.decodeNameRef(value.getNameRef());
String valueStr = vp.decodeValue(value.getRawValue());
int dataType = value.getRawValue().getDataType();

if (!typeName.equals("attr")) {
if (valueStr == null || valueStr.equals("0")) {
if (dataType == ParserConstants.TYPE_REFERENCE && (valueStr == null || valueStr.equals("0"))) {
valueStr = "@null";
}
if (nameStr != null) {
if (dataType == ParserConstants.TYPE_INT_DEC && nameStr != null) {
try {
int intVal = Integer.parseInt(valueStr);
String newVal = ManifestAttributes.getInstance().decode(nameStr.replace("android:attr.", ""), intVal);
Expand Down
2 changes: 1 addition & 1 deletion jadx-gui/src/main/java/jadx/gui/ui/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ private boolean openSingleFile(Path singleFile, Runnable onFinish) {
// check if project file already saved with default name
Path projectPath = getProjectPathForFile(singleFile);
if (Files.exists(projectPath)) {
LOG.info("Loading project for this file");
LOG.info("Loading project {}", projectPath);
openProject(projectPath, onFinish);
return true;
}
Expand Down

0 comments on commit ae2d4da

Please sign in to comment.