From 4dda8cb23158f91c7d0878f2eae8829861f7456a Mon Sep 17 00:00:00 2001 From: Maxi Rosson Date: Mon, 24 May 2021 17:07:32 -0300 Subject: [PATCH] Show "Received malformed sequence exception" warning stacktrace only when verbose is enabled. Close #36 (#37) --- build.gradle | 2 +- .../byebyejetifier/scanner/resource/XmlResourceScanner.kt | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 68943be..7c6bbeb 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -version = '1.1.2' +version = '1.1.3' ext.GITHUB_REPOSITORY_NAME = "bye-bye-jetifier" diff --git a/bye-bye-jetifier/src/main/java/com/dipien/byebyejetifier/scanner/resource/XmlResourceScanner.kt b/bye-bye-jetifier/src/main/java/com/dipien/byebyejetifier/scanner/resource/XmlResourceScanner.kt index 3d0b7d0..31373a7 100644 --- a/bye-bye-jetifier/src/main/java/com/dipien/byebyejetifier/scanner/resource/XmlResourceScanner.kt +++ b/bye-bye-jetifier/src/main/java/com/dipien/byebyejetifier/scanner/resource/XmlResourceScanner.kt @@ -79,9 +79,11 @@ class XmlResourceScanner( // files so we at least try to recover by defaulting to UTF-8. LoggerHelper.warn("Received malformed sequence exception when trying to detect the encoding " + "for ${file.fileName}. Defaulting to UTF-8.") - val tracePrinter = StringWriter() - e.printStackTrace(PrintWriter(tracePrinter)) - LoggerHelper.warn(tracePrinter.toString()) + if (LoggerHelper.verbose) { + val tracePrinter = StringWriter() + e.printStackTrace(PrintWriter(tracePrinter)) + LoggerHelper.warn(tracePrinter.toString()) + } return StandardCharsets.UTF_8 } }