Bug 371398

Summary: [misc] AssertionFailedException when replacing text
Product: [WebTools] WTP Source Editing Reporter: Natalia Bartol <natalia.bartol>
Component: wst.sseAssignee: wst.sse <wst.sse-inbox>
Status: NEW --- QA Contact: Nick Sandonato <nsand.dev>
Severity: normal    
Priority: P3 CC: nsand.dev
Version: unspecifiedKeywords: needinfo
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
AssertionFailedException caught
none
AssertionFailedException caught none

Description Natalia Bartol CLA 2012-02-13 12:36:01 EST
Build Identifier: 

!ENTRY org.eclipse.wst.sse.core 4 4 2012-02-08 10:21:25.071
!MESSAGE assertion failed: 
!STACK 0
org.eclipse.core.runtime.AssertionFailedException: assertion failed: 
at org.eclipse.core.runtime.Assert.isTrue(Assert.java:110)
at org.eclipse.core.runtime.Assert.isTrue(Assert.java:96)
at org.eclipse.jface.text.Position.<init>(Position.java:62)
at org.eclipse.jface.text.TypedPosition.<init>(TypedPosition.java:45)
at org.eclipse.wst.sse.ui.internal.provisional.style.StructuredPresentationReconciler$InternalListener.documentAboutToBeChanged(StructuredPresentationReconciler.java:340)
at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument._fireDocumentAboutToChange(BasicStructuredDocument.java:389)
at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.fireDocumentAboutToChanged(BasicStructuredDocument.java:1120)
at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.internalReplaceText(BasicStructuredDocument.java:1912)
at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.replaceText(BasicStructuredDocument.java:2423)
at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.replaceText(BasicStructuredDocument.java:2408)
at org.eclipse.wst.sse.core.internal.text.JobSafeStructuredDocument.access$2(JobSafeStructuredDocument.java:1)
at org.eclipse.wst.sse.core.internal.text.JobSafeStructuredDocument$3.run(JobSafeStructuredDocument.java:141)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)

Reproducible: Sometimes

Steps to Reproduce:
1. Modify document, use Ctrl+D
Comment 1 Natalia Bartol CLA 2012-02-13 12:41:08 EST
Created attachment 210928 [details]
AssertionFailedException caught

I think that offset < 0 which causes AssertionFailedException in TypedPosition constructor has the same cause as possible BadLocatioException: concurrent threads   modifying document. As BadLocationException is caught in org.eclipse.wst.sse.ui.internal.provisional.style.StructuredPresentationReconciler.InternalListener.documentAboutToBeChanged(DocumentEvent e) what about catching there AssertionFailedException as well?
Comment 2 Natalia Bartol CLA 2012-02-13 12:42:31 EST
Created attachment 210930 [details]
AssertionFailedException caught
Comment 3 Nick Sandonato CLA 2012-02-20 10:34:39 EST
Hi Natalia,

Thank you for the patch. I'd like to understand the problem first so that maybe we can fix the cause of this instead of suppressing the exception. Can you provide a testcase or some steps to reproduce the problem? Thanks!
Comment 4 Nick Sandonato CLA 2012-04-12 14:37:27 EDT
Comment on attachment 210930 [details]
AssertionFailedException caught

As stated, I think the best course of action would be to find out the root of this problem. Thank you for the patch, though.