From 79404470f0f6f2e84a6c09b34a44b83819c14c4b Mon Sep 17 00:00:00 2001 From: Slava Volkov Date: Mon, 24 Jul 2023 10:35:25 +0300 Subject: [PATCH] correct style with curly braces --- .../main/java/brut/androlib/apk/YamlLine.java | 3 +- .../java/brut/androlib/apk/YamlReader.java | 33 ++++++++++++------- .../java/brut/androlib/apk/YamlWriter.java | 15 ++++++--- 3 files changed, 34 insertions(+), 17 deletions(-) diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/apk/YamlLine.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/apk/YamlLine.java index 5ecd86d548e..f31dd62ac8c 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/apk/YamlLine.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/apk/YamlLine.java @@ -64,8 +64,9 @@ public static String unescape(String value) { } public String getValue() { - if (value.equals("null")) + if (value.equals("null")) { return null; + } String res = unescape(value); // remove quotation marks res = res.replaceAll("^\"|\"$", ""); diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/apk/YamlReader.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/apk/YamlReader.java index 79a3254f95a..a75bd8efa9b 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/apk/YamlReader.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/apk/YamlReader.java @@ -17,8 +17,9 @@ public YamlReader(InputStream in) { } public void pushLine() { - if (mCurrent > 0) + if (mCurrent > 0) { mCurrent--; + } } public void read(InputStream in) { @@ -48,22 +49,26 @@ public boolean isCommentOrEmpty() { } public void skipInsignificant() { - if (isEnd()) + if (isEnd()) { return; + } while (isCommentOrEmpty()) { mCurrent++; - if (isEnd()) + if (isEnd()) { break; + } } } public boolean nextLine() { - if (isEnd()) + if (isEnd()) { return false; + } while (true) { mCurrent++; - if (isCommentOrEmpty()) + if (isCommentOrEmpty()) { continue; + } return !isEnd(); } } @@ -80,13 +85,15 @@ interface Updater { * Read root object from start to end */ public void readRoot(T obj) throws AndrolibException { - if (isEnd()) + if (isEnd()) { return; + } int objIndent = 0; skipInsignificant(); while (true) { - if (isEnd()) + if (isEnd()) { return; + } YamlLine line = getLine(); // skip don't checked line or lines with other indent if (objIndent != line.indent || !line.hasColon) { @@ -106,8 +113,9 @@ public void readRoot(T obj) throws AndrolibExceptio public void readObject(T obj, Checker check, Updater updater) throws AndrolibException { - if (isEnd()) + if (isEnd()) { return; + } int prevIndent = getIndent(); // detect indent for the object data nextLine(); @@ -121,8 +129,9 @@ public void readObject(T obj, } updater.update(obj, this); while (nextLine()) { - if (isEnd()) + if (isEnd()) { return; + } line = getLine(); if (objIndent != line.indent || !check.check(line)) { pushLine(); @@ -145,14 +154,16 @@ void readObject(T obj) throws AndrolibException { */ public void readList(List list, Updater> updater) throws AndrolibException { - if (isEnd()) + if (isEnd()) { return; + } int listIndent = getIndent(); nextLine(); int dataIndent = getIndent(); while (true) { - if (isEnd()) + if (isEnd()) { return; + } // check incorrect data indent if (dataIndent < listIndent) { pushLine(); diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/apk/YamlWriter.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/apk/YamlWriter.java index 7cc921641ac..6750212b39b 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/apk/YamlWriter.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/apk/YamlWriter.java @@ -36,8 +36,9 @@ public void nextIndent() { } public void prevIndent() { - if (mIndent != 0) + if (mIndent != 0) { mIndent -= 2; + } } public void writeIndent() { @@ -55,8 +56,9 @@ public void writeString(String key, String value, boolean quoted) { if (Objects.isNull(value)) { mWriter.println(escape(key) + ": null"); } else { - if (quoted) + if (quoted) { value = QUOTE + value + QUOTE; + } mWriter.println(escape(key) + ": " + escape(value)); } } @@ -66,8 +68,9 @@ public void writeString(String key, String value) { } public void writeList(String key, List list) { - if (Objects.isNull(list)) + if (Objects.isNull(list)) { return; + } writeIndent(); mWriter.println(escape(key) + ":"); for (T item: list) { @@ -77,8 +80,9 @@ public void writeList(String key, List list) { } public void writeStringMap(String key, Map map) { - if (Objects.isNull(map)) + if (Objects.isNull(map)) { return; + } writeIndent(); mWriter.println(escape(key) + ":"); nextIndent(); @@ -89,8 +93,9 @@ public void writeStringMap(String key, Map map) { } public void writeObject(String key, T obj) { - if (Objects.isNull(obj)) + if (Objects.isNull(obj)) { return; + } writeIndent(); mWriter.println(escape(key) + ":"); nextIndent();