From c09e74c4dd18727a5a7db320c8135dc55628c868 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ryszard=20Wi=C5=9Bniewski?= Date: Fri, 26 Mar 2010 15:40:54 +0100 Subject: [PATCH] Make messages outputing/logging consistent between files. --- src/brut/androlib/res/AndrolibResources.java | 10 ++++++---- src/brut/androlib/res/ResSmaliUpdater.java | 8 ++++++-- .../androlib/res/decoder/AXmlResourceParser.java | 16 +++++++++------- .../res/decoder/XmlPullStreamDecoder.java | 6 +++--- 4 files changed, 24 insertions(+), 16 deletions(-) diff --git a/src/brut/androlib/res/AndrolibResources.java b/src/brut/androlib/res/AndrolibResources.java index 3ab61b0f..7e400172 100644 --- a/src/brut/androlib/res/AndrolibResources.java +++ b/src/brut/androlib/res/AndrolibResources.java @@ -29,6 +29,7 @@ import brut.directory.*; import brut.util.*; import java.io.*; import java.util.Arrays; +import java.util.logging.Logger; import org.xmlpull.v1.XmlSerializer; /** @@ -228,14 +229,12 @@ final public class AndrolibResources { "Arsc file with zero package groups"); } if (groups.length > 1) { - System.err.println( - "warning: arsc file with multiple package groups"); + LOGGER.warning("Arsc file with multiple package groups"); } for (int i = 0; i < groups.length; i++) { if (groups.length != 1 && i == 0 && "android".equals(groups[i].getName())) { - System.err.println( - "warning: skipping \"android\" package group"); + LOGGER.warning("Skipping \"android\" package group"); continue; } resTable.addPackage(groups[i], main); @@ -259,4 +258,7 @@ final public class AndrolibResources { } return value; } + + private final static Logger LOGGER = + Logger.getLogger(AndrolibResources.class.getName()); } diff --git a/src/brut/androlib/res/ResSmaliUpdater.java b/src/brut/androlib/res/ResSmaliUpdater.java index 9771b73d..7865f69a 100644 --- a/src/brut/androlib/res/ResSmaliUpdater.java +++ b/src/brut/androlib/res/ResSmaliUpdater.java @@ -28,6 +28,7 @@ import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.util.Iterator; +import java.util.logging.Logger; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.commons.io.IOUtils; @@ -125,8 +126,8 @@ public class ResSmaliUpdater { RES_NAME_FORMAT, spec.getFullName())); } catch (UndefinedResObject ex) { if (! R_FILE_PATTERN.matcher(fileName).matches()) { - System.err.println(String.format( - "warning: undefined resource spec in %s: 0x%08x" + LOGGER.warning(String.format( + "Undefined resource spec in %s: 0x%08x" , fileName, resID)); } } @@ -161,4 +162,7 @@ public class ResSmaliUpdater { private final static Pattern R_FILE_PATTERN = Pattern.compile( ".*R\\$[a-z]+\\.smali$"); + + private final static Logger LOGGER = + Logger.getLogger(ResSmaliUpdater.class.getName()); } diff --git a/src/brut/androlib/res/decoder/AXmlResourceParser.java b/src/brut/androlib/res/decoder/AXmlResourceParser.java index 8f50db79..02efaad9 100644 --- a/src/brut/androlib/res/decoder/AXmlResourceParser.java +++ b/src/brut/androlib/res/decoder/AXmlResourceParser.java @@ -311,13 +311,12 @@ public class AXmlResourceParser implements XmlResourceParser { return mAttrDecoder.decode(valueType, valueData, getAttributeNameResource(index)); } catch (AndrolibException ex) { - Logger.getLogger(AXmlResourceParser.class.getName()).log( - Level.WARNING, String.format( - "Could not decode attr value, using undecoded value " + - "instead: ns=%s, name=%s, value=0x%08x", - getAttributePrefix(index), getAttributeName(index), - valueData - ), ex); + LOGGER.log(Level.WARNING, String.format( + "Could not decode attr value, using undecoded value " + + "instead: ns=%s, name=%s, value=0x%08x", + getAttributePrefix(index), getAttributeName(index), + valueData + ), ex); } } @@ -923,6 +922,9 @@ public class AXmlResourceParser implements XmlResourceParser { private int m_idAttribute; private int m_classAttribute; private int m_styleAttribute; + + private final static Logger LOGGER = + Logger.getLogger(AXmlResourceParser.class.getName()); private static final String E_NOT_SUPPORTED = "Method is not supported."; private static final int ATTRIBUTE_IX_NAMESPACE_URI = 0, diff --git a/src/brut/androlib/res/decoder/XmlPullStreamDecoder.java b/src/brut/androlib/res/decoder/XmlPullStreamDecoder.java index ee64989c..fa4aa653 100644 --- a/src/brut/androlib/res/decoder/XmlPullStreamDecoder.java +++ b/src/brut/androlib/res/decoder/XmlPullStreamDecoder.java @@ -51,15 +51,15 @@ public class XmlPullStreamDecoder implements ResStreamDecoder { in.close(); out.close(); } catch (XmlPullParserException ex) { - mLogger.log(Level.SEVERE, null, ex); + LOGGER.log(Level.SEVERE, null, ex); } catch (IOException ex) { - mLogger.log(Level.SEVERE, null, ex); + LOGGER.log(Level.SEVERE, null, ex); } } private final XmlPullParser mParser; private final XmlSerializer mSerial; - private final static Logger mLogger = + private final static Logger LOGGER = Logger.getLogger(XmlPullStreamDecoder.class.getName()); }