Skip to content

Commit 1091cb3

Browse files
committed
correct style with curly braces
1 parent aac062c commit 1091cb3

File tree

3 files changed

+34
-17
lines changed

3 files changed

+34
-17
lines changed

brut.apktool/apktool-lib/src/main/java/brut/androlib/apk/YamlLine.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,9 @@ public static String unescape(String value) {
6464
}
6565

6666
public String getValue() {
67-
if (value.equals("null"))
67+
if (value.equals("null")) {
6868
return null;
69+
}
6970
String res = unescape(value);
7071
// remove quotation marks
7172
res = res.replaceAll("^\"|\"$", "");

brut.apktool/apktool-lib/src/main/java/brut/androlib/apk/YamlReader.java

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ public YamlReader(InputStream in) {
1717
}
1818

1919
public void pushLine() {
20-
if (mCurrent > 0)
20+
if (mCurrent > 0) {
2121
mCurrent--;
22+
}
2223
}
2324

2425
public void read(InputStream in) {
@@ -48,22 +49,26 @@ public boolean isCommentOrEmpty() {
4849
}
4950

5051
public void skipInsignificant() {
51-
if (isEnd())
52+
if (isEnd()) {
5253
return;
54+
}
5355
while (isCommentOrEmpty()) {
5456
mCurrent++;
55-
if (isEnd())
57+
if (isEnd()) {
5658
break;
59+
}
5760
}
5861
}
5962

6063
public boolean nextLine() {
61-
if (isEnd())
64+
if (isEnd()) {
6265
return false;
66+
}
6367
while (true) {
6468
mCurrent++;
65-
if (isCommentOrEmpty())
69+
if (isCommentOrEmpty()) {
6670
continue;
71+
}
6772
return !isEnd();
6873
}
6974
}
@@ -80,13 +85,15 @@ interface Updater<T> {
8085
* Read root object from start to end
8186
*/
8287
public <T extends YamlSerializable> void readRoot(T obj) throws AndrolibException {
83-
if (isEnd())
88+
if (isEnd()) {
8489
return;
90+
}
8591
int objIndent = 0;
8692
skipInsignificant();
8793
while (true) {
88-
if (isEnd())
94+
if (isEnd()) {
8995
return;
96+
}
9097
YamlLine line = getLine();
9198
// skip don't checked line or lines with other indent
9299
if (objIndent != line.indent || !line.hasColon) {
@@ -106,8 +113,9 @@ public <T extends YamlSerializable> void readRoot(T obj) throws AndrolibExceptio
106113
public <T> void readObject(T obj,
107114
Checker check,
108115
Updater<T> updater) throws AndrolibException {
109-
if (isEnd())
116+
if (isEnd()) {
110117
return;
118+
}
111119
int prevIndent = getIndent();
112120
// detect indent for the object data
113121
nextLine();
@@ -121,8 +129,9 @@ public <T> void readObject(T obj,
121129
}
122130
updater.update(obj, this);
123131
while (nextLine()) {
124-
if (isEnd())
132+
if (isEnd()) {
125133
return;
134+
}
126135
line = getLine();
127136
if (objIndent != line.indent || !check.check(line)) {
128137
pushLine();
@@ -145,14 +154,16 @@ <T extends YamlSerializable> void readObject(T obj) throws AndrolibException {
145154
*/
146155
public <T> void readList(List<T> list,
147156
Updater<List<T>> updater) throws AndrolibException {
148-
if (isEnd())
157+
if (isEnd()) {
149158
return;
159+
}
150160
int listIndent = getIndent();
151161
nextLine();
152162
int dataIndent = getIndent();
153163
while (true) {
154-
if (isEnd())
164+
if (isEnd()) {
155165
return;
166+
}
156167
// check incorrect data indent
157168
if (dataIndent < listIndent) {
158169
pushLine();

brut.apktool/apktool-lib/src/main/java/brut/androlib/apk/YamlWriter.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ public void nextIndent() {
3636
}
3737

3838
public void prevIndent() {
39-
if (mIndent != 0)
39+
if (mIndent != 0) {
4040
mIndent -= 2;
41+
}
4142
}
4243

4344
public void writeIndent() {
@@ -55,8 +56,9 @@ public void writeString(String key, String value, boolean quoted) {
5556
if (Objects.isNull(value)) {
5657
mWriter.println(escape(key) + ": null");
5758
} else {
58-
if (quoted)
59+
if (quoted) {
5960
value = QUOTE + value + QUOTE;
61+
}
6062
mWriter.println(escape(key) + ": " + escape(value));
6163
}
6264
}
@@ -66,8 +68,9 @@ public void writeString(String key, String value) {
6668
}
6769

6870
public <T> void writeList(String key, List<T> list) {
69-
if (Objects.isNull(list))
71+
if (Objects.isNull(list)) {
7072
return;
73+
}
7174
writeIndent();
7275
mWriter.println(escape(key) + ":");
7376
for (T item: list) {
@@ -77,8 +80,9 @@ public <T> void writeList(String key, List<T> list) {
7780
}
7881

7982
public void writeStringMap(String key, Map<String, String> map) {
80-
if (Objects.isNull(map))
83+
if (Objects.isNull(map)) {
8184
return;
85+
}
8286
writeIndent();
8387
mWriter.println(escape(key) + ":");
8488
nextIndent();
@@ -89,8 +93,9 @@ public void writeStringMap(String key, Map<String, String> map) {
8993
}
9094

9195
public <T extends YamlSerializable> void writeObject(String key, T obj) {
92-
if (Objects.isNull(obj))
96+
if (Objects.isNull(obj)) {
9397
return;
98+
}
9499
writeIndent();
95100
mWriter.println(escape(key) + ":");
96101
nextIndent();

0 commit comments

Comments
 (0)