Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6c740cf7 authored by Xavier Ducrohet's avatar Xavier Ducrohet
Browse files

LayoutLib: Improve error reporting.

Change-Id: I37cad7e2efb959202960c57b271c55c759867139
parent 0de16070
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -351,7 +351,8 @@ public class BitmapFactory {
                If the exception happened on open, bm will be null.
                If it happened on close, bm is still valid.
            */
            Bridge.getLog().error(null, e);
            Bridge.getLog().error(null,
                    String.format("Error decoding bitmap of id 0x%x", id), e);
        } finally {
            try {
                if (is != null) is.close();
+3 −3
Original line number Diff line number Diff line
@@ -73,7 +73,7 @@ public final class NinePatch_Delegate {
            oos = new ObjectOutputStream(baos);
            oos.writeObject(chunk);
        } catch (IOException e) {
            Bridge.getLog().error("Failed to serialize NinePatchChunk.", e);
            Bridge.getLog().error(null, "Failed to serialize NinePatchChunk.", e);
            return null;
        } finally {
            if (oos != null) {
@@ -196,10 +196,10 @@ public final class NinePatch_Delegate {
                    sChunkCache.put(array, new SoftReference<NinePatchChunk>(chunk));
                }
            } catch (IOException e) {
                Bridge.getLog().error("Failed to deserialize NinePatchChunk content.", e);
                Bridge.getLog().error(null, "Failed to deserialize NinePatchChunk content.", e);
                return null;
            } catch (ClassNotFoundException e) {
                Bridge.getLog().error("Failed to deserialize NinePatchChunk class.", e);
                Bridge.getLog().error(null, "Failed to deserialize NinePatchChunk class.", e);
                return null;
            } finally {
                if (ois != null) {
+3 −7
Original line number Diff line number Diff line
@@ -35,7 +35,6 @@ public class XmlUtils_Delegate {
        // The Dalvik libraries are able to handle Integer.parse("XXXXXXXX", 16) where XXXXXXX
        // is > 80000000 but the Java VM cannot.

        int value;
        int sign = 1;
        int index = 0;
        int len = nm.length();
@@ -61,14 +60,11 @@ public class XmlUtils_Delegate {
                base = 8;
            }
        }
        else if ('#' == nm.charAt(index))
        {
        else if ('#' == nm.charAt(index)) {
            index++;
            base = 16;

            return ((int)Long.parseLong(nm.substring(index), base)) * sign;
        }

        return Integer.parseInt(nm.substring(index), base) * sign;
        return ((int)Long.parseLong(nm.substring(index), base)) * sign;
    }
}
+0 −10
Original line number Diff line number Diff line
@@ -141,16 +141,6 @@ public final class Bridge extends com.android.ide.common.rendering.api.Bridge {
            System.err.println(message);
        }

        @Override
        public void error(String tag, Throwable t) {
            String message = t.getMessage();
            if (message == null) {
                message = t.getClass().getName();
            }

            System.err.println(message);
        }

        @Override
        public void error(String tag, String message, Throwable throwable) {
            System.err.println(message);
+4 −2
Original line number Diff line number Diff line
@@ -178,8 +178,10 @@ public final class BridgeInflater extends LayoutInflater {

                        return inflate(bridgeParser, root);
                    } catch (Exception e) {
                        Bridge.getLog().error(null, e);
                        // return null below.
                        Bridge.getLog().error(null,
                                "Failed to parse file " + f.getAbsolutePath(), e);

                        return null;
                    }
                }
            }
Loading