Skip to content

Commit

Permalink
fix locale match bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Dong Liu committed May 18, 2015
1 parent 2323e90 commit 1165655
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/java/net/dongliu/apk/parser/Main.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package net.dongliu.apk.parser;

import net.dongliu.apk.parser.bean.CertificateMeta;

import java.io.IOException;
import java.security.cert.CertificateException;
import java.util.List;
import java.util.Locale;

import net.dongliu.apk.parser.bean.CertificateMeta;

/**
* Main method for parser apk
*
Expand All @@ -16,7 +16,7 @@ public class Main {
public static void main(String[] args) throws IOException, CertificateException {
String apkFile = args[0];
try (ApkParser parser = new ApkParser(apkFile)) {
parser.setPreferredLocale(Locale.SIMPLIFIED_CHINESE);
parser.setPreferredLocale(Locale.getDefault());
System.out.println(parser.getApkMeta());
List<CertificateMeta> certList = parser.getCertificateMetaList();
for (CertificateMeta certificateMeta : certList) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,13 @@ public StringPool getStringPool() {
public void setStringPool(StringPool stringPool) {
this.stringPool = stringPool;
}

@Override
public String toString() {
return "Type{" +
"name='" + name + '\'' +
", id=" + id +
", locale=" + locale +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,12 @@ public short getId() {
public void setId(short id) {
this.id = id;
}

@Override
public String toString() {
return "TypeSpec{" +
"name='" + name + '\'' +
", id=" + id +
'}';
}
}
1 change: 1 addition & 0 deletions src/main/java/net/dongliu/apk/parser/utils/ParseUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ public static String getResourceById(long resourceId, boolean isStyle,
break;
} else if (level > currentLevel) {
result = resource.toStringValue(resourceTable, locale);
currentLevel = level;
}
}
if (locale == null || result == null) {
Expand Down

0 comments on commit 1165655

Please sign in to comment.