summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Green2011-10-06 19:28:50 (EDT)
committerSteffen Pingel2011-10-06 19:28:50 (EDT)
commit9adf19245e8ad1e5a32b064056510289dc980ef9 (patch)
tree81ac3914ebe3dd6fb2341ac7e46235217cd29fa2
parenta347ce3b0ab1ab7551d9779cf8f30d64d8aa35e0 (diff)
downloadorg.eclipse.mylyn.context-9adf19245e8ad1e5a32b064056510289dc980ef9.zip
org.eclipse.mylyn.context-9adf19245e8ad1e5a32b064056510289dc980ef9.tar.gz
org.eclipse.mylyn.context-9adf19245e8ad1e5a32b064056510289dc980ef9.tar.bz2
NEW - bug 360161: eliminate Eclipse error log header content from stack
trace context population https://bugs.eclipse.org/bugs/show_bug.cgi?id=360161
-rw-r--r--org.eclipse.mylyn.java.tests/src/org/eclipse/mylyn/java/tests/JavaStackTraceContextComputationStrategyTest.java33
-rw-r--r--org.eclipse.mylyn.java.tests/testdata/taskDescription2.txt55
-rw-r--r--org.eclipse.mylyn.java.ui/src/org/eclipse/mylyn/internal/java/ui/JavaStackTraceContextComputationStrategy.java2
3 files changed, 89 insertions, 1 deletions
diff --git a/org.eclipse.mylyn.java.tests/src/org/eclipse/mylyn/java/tests/JavaStackTraceContextComputationStrategyTest.java b/org.eclipse.mylyn.java.tests/src/org/eclipse/mylyn/java/tests/JavaStackTraceContextComputationStrategyTest.java
index 16b7690..b7aaf52 100644
--- a/org.eclipse.mylyn.java.tests/src/org/eclipse/mylyn/java/tests/JavaStackTraceContextComputationStrategyTest.java
+++ b/org.eclipse.mylyn.java.tests/src/org/eclipse/mylyn/java/tests/JavaStackTraceContextComputationStrategyTest.java
@@ -53,4 +53,37 @@ public class JavaStackTraceContextComputationStrategyTest extends TestCase {
"org.eclipse.jface.viewers.StructuredViewer$UpdateItemSafeRunnable", "run")));
}
+ /**
+ * bug 354184
+ */
+ public void testStackTracePopulatedWithoutEclipseErrorHeaderElements() throws IOException {
+ File file = CommonTestUtil.getFile(this, "testdata/taskDescription2.txt");
+ List<Element> contextObjects = stackTraceDetector.computeElements(CommonTestUtil.read(file));
+ assertFalse(contextObjects.isEmpty());
+
+ // don't want
+ // Element [fqn=Date, methodName=null]
+ // Element [fqn=Message, methodName=null]
+ // Element [fqn=Severity, methodName=null]
+ // Element [fqn=Product, methodName=null]
+ // Element [fqn=Plugin, methodName=null]
+ // do want
+ // Element [fqn=org.eclipse.swt.SWTException, methodName=null]
+ // Element [fqn=org.eclipse.swt.SWT, methodName=error]
+ // Element [fqn=org.eclipse.swt.SWT, methodName=error]
+ // Element [fqn=org.eclipse.swt.SWT, methodName=error]
+ // Element [fqn=org.eclipse.swt.graphics.Image, methodName=getBounds]
+
+ //
+
+ assertFalse(contextObjects.contains(new Element("Date", null)));
+ assertFalse(contextObjects.contains(new Element("Message", null)));
+ assertFalse(contextObjects.contains(new Element("Severity", null)));
+ assertFalse(contextObjects.contains(new Element("Product", null)));
+ assertFalse(contextObjects.contains(new Element("Plugin", null)));
+
+ assertTrue(contextObjects.contains(new Element("org.eclipse.swt.SWTException", null)));
+ assertTrue(contextObjects.contains(new Element("org.eclipse.swt.SWT", "error")));
+ assertTrue(contextObjects.contains(new Element("org.eclipse.swt.graphics.Image", "getBounds")));
+ }
}
diff --git a/org.eclipse.mylyn.java.tests/testdata/taskDescription2.txt b/org.eclipse.mylyn.java.tests/testdata/taskDescription2.txt
new file mode 100644
index 0000000..6808c48
--- /dev/null
+++ b/org.eclipse.mylyn.java.tests/testdata/taskDescription2.txt
@@ -0,0 +1,55 @@
+When activating a task with no context, it was prepopulated with classes named Plugin, Product, Severity, and Date, and methods named error, because these words appear somewhere in a comment with a stack trace.
+
+Here's an example stack trace that should cause this problem:
+
+-- Error Details --
+Date: Mon Aug 08 14:35:23 CEST 2011
+Message: Unhandled event loop exception during blocked modal context.
+Severity: Error
+Product: Tasktop 2.0.2.qualifier (com.tasktop.ui.application.product)
+Plugin: org.eclipse.jface
+Session Data:
+eclipse.buildId=unknown
+java.version=1.6.0_22
+java.vendor=Sun Microsystems Inc.
+BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=en_US
+Framework arguments: -product com.tasktop.ui.application.product
+Command-line arguments: -product com.tasktop.ui.application.product -data /home/bmuskalla/.tasktop/workspace -dev file:/projects/tasktop-selfhost/.metadata/.plugins/org.eclipse.pde.core/Tasktop/dev.properties -os linux -ws gtk -arch x86 -consoleLog -console -clean
+
+Exception Stack Trace:
+
+org.eclipse.swt.SWTException: Graphic is disposed
+ at org.eclipse.swt.SWT.error(SWT.java:4282)
+ at org.eclipse.swt.SWT.error(SWT.java:4197)
+ at org.eclipse.swt.SWT.error(SWT.java:4168)
+ at org.eclipse.swt.graphics.Image.getBounds(Image.java:840)
+ at org.eclipse.ui.forms.widgets.ImageHyperlink.paintHyperlink(ImageHyperlink.java:108)
+ at org.eclipse.ui.forms.widgets.ImageHyperlink.paintHyperlink(ImageHyperlink.java:93)
+ at org.eclipse.ui.forms.widgets.AbstractHyperlink.paint(AbstractHyperlink.java:296)
+ at org.eclipse.ui.forms.widgets.AbstractHyperlink$2.paintControl(AbstractHyperlink.java:84)
+ at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:229)
+ at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
+ at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)
+ at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1282)
+ at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1267)
+ at org.eclipse.swt.widgets.Control.gtk_expose_event(Control.java:2961)
+ at org.eclipse.swt.widgets.Composite.gtk_expose_event(Composite.java:701)
+ at org.eclipse.swt.widgets.Canvas.gtk_expose_event(Canvas.java:167)
+ at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:1739)
+ at org.eclipse.swt.widgets.Control.windowProc(Control.java:5016)
+ at org.eclipse.swt.widgets.Display.windowProc(Display.java:4408)
+ at org.eclipse.swt.internal.gtk.OS._gtk_main_do_event(Native Method)
+ at org.eclipse.swt.internal.gtk.OS.gtk_main_do_event(OS.java:8394)
+ at org.eclipse.swt.widgets.Display.eventProc(Display.java:1245)
+ at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Native Method)
+ at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(OS.java:2258)
+ at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3207)
+ at org.eclipse.jface.operation.ModalContext$ModalContextThread.block(ModalContext.java:173)
+ at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:388)
+ at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:507)
+ at org.eclipse.ui.internal.progress.ProgressMonitorJobsDialog.run(ProgressMonitorJobsDialog.java:275)
+ at org.eclipse.ui.internal.progress.ProgressManager$5.run(ProgressManager.java:960)
+ at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
+ at org.eclipse.ui.internal.progress.ProgressManager.busyCursorWhile(ProgressManager.java:995)
+ at org.eclipse.ui.internal.progress.ProgressManager.busyCursorWhile(ProgressManager.java:970)
+
diff --git a/org.eclipse.mylyn.java.ui/src/org/eclipse/mylyn/internal/java/ui/JavaStackTraceContextComputationStrategy.java b/org.eclipse.mylyn.java.ui/src/org/eclipse/mylyn/internal/java/ui/JavaStackTraceContextComputationStrategy.java
index e6eed70..ad2ad02 100644
--- a/org.eclipse.mylyn.java.ui/src/org/eclipse/mylyn/internal/java/ui/JavaStackTraceContextComputationStrategy.java
+++ b/org.eclipse.mylyn.java.ui/src/org/eclipse/mylyn/internal/java/ui/JavaStackTraceContextComputationStrategy.java
@@ -46,7 +46,7 @@ public class JavaStackTraceContextComputationStrategy extends AbstractJavaContex
private static final String CLASS_PART = "[A-Za-z][a-zA-Z0-9_$]*"; //$NON-NLS-1$
- private static final String FQN_PART = "((" + PACKAGE_PART + "\\.)*" + CLASS_PART + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ private static final String FQN_PART = "((" + PACKAGE_PART + "\\.)+" + CLASS_PART + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
private static final Pattern STACK_TRACE_PATTERN = Pattern.compile("\\s*((" + "((Caused by:\\s+)|(at\\s+))?" //$NON-NLS-1$//$NON-NLS-2$
+ FQN_PART + "((:\\s+\\w.*)|(\\.((\\<(?:cl)?init\\>)|([a-zA-Z0-9_$]+))\\(.*?\\)))?" //$NON-NLS-1$