Created
July 7, 2014 19:11
-
-
Save gissuebot/e8f4cf8eecabfda26c74 to your computer and use it in GitHub Desktop.
Migrated attachment for Guice issue 757, comment 10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From ba922af5fd294ea65955d49cbcee2815d612de79 Mon Sep 17 00:00:00 2001 | |
From: Ben Tebulin <tebulin@gmail.com> | |
Date: Tue, 3 Dec 2013 17:49:50 +0100 | |
Subject: [PATCH] Do not hide root errors on issues resolving line numbers | |
Currently ASM fails under Java 8. On configuration exceptions Guice | |
tries too resolve the real root code location which might sometimes | |
fail due to an ASM failure. | |
Instead of leading to a totally unrelated $ComputedException which | |
completly hides the original cause, this patch simply skips the | |
line numbers in these case. | |
See http://code.google.com/p/google-guice/issues/detail?id=782 | |
--- | |
.../google/inject/internal/util/StackTraceElements.java | 14 ++++++++++---- | |
1 file changed, 10 insertions(+), 4 deletions(-) | |
diff --git a/core/src/com/google/inject/internal/util/StackTraceElements.java b/core/src/com/google/inject/internal/util/StackTraceElements.java | |
index 4f5b167..1eaf9ad 100644 | |
--- a/core/src/com/google/inject/internal/util/StackTraceElements.java | |
+++ b/core/src/com/google/inject/internal/util/StackTraceElements.java | |
@@ -53,10 +53,16 @@ public class StackTraceElements { | |
Class declaringClass = member.getDeclaringClass(); | |
/*if[AOP]*/ | |
- LineNumbers lineNumbers = lineNumbersCache.get(declaringClass); | |
- String fileName = lineNumbers.getSource(); | |
- Integer lineNumberOrNull = lineNumbers.getLineNumber(member); | |
- int lineNumber = lineNumberOrNull == null ? lineNumbers.getFirstLine() : lineNumberOrNull; | |
+ String fileName = null; | |
+ int lineNumber = -1; | |
+ try { | |
+ LineNumbers lineNumbers = lineNumbersCache.get(declaringClass); | |
+ fileName = lineNumbers.getSource(); | |
+ Integer lineNumberOrNull = lineNumbers.getLineNumber(member); | |
+ lineNumber = lineNumberOrNull == null ? lineNumbers.getFirstLine() : lineNumberOrNull; | |
+ } | |
+ catch (RuntimeException ignore) { | |
+ } | |
/*end[AOP]*/ | |
/*if[NO_AOP] | |
String fileName = null; | |
-- | |
1.8.5 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment