Bug 46012 - IllegalArgumentException in StringLiteral
Summary: IllegalArgumentException in StringLiteral
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0 M5   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 46988 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-11-04 04:55 EST by Dani Megert CLA
Modified: 2003-11-20 21:03 EST (History)
3 users (show)

See Also:


Attachments
Patch file to fix this issue (2.50 KB, patch)
2003-11-20 13:28 EST, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2003-11-04 04:55:48 EST
I20031029

Happened while editing JavaEditor.java

java.lang.IllegalArgumentException
        at
org.eclipse.jdt.core.dom.StringLiteral.setEscapedValue(StringLiteral.java:119)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1410)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:847)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:909)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:793)
        at
org.eclipse.jdt.core.dom.ASTConverter.convertToVariableDeclarationFragment(ASTConverter.java:2697)
        at
org.eclipse.jdt.core.dom.ASTConverter.convertToVariableDeclarationStatement(ASTConverter.java:2737)
        at
org.eclipse.jdt.core.dom.ASTConverter.checkAndAddMultipleLocalDeclaration(ASTConverter.java:288)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:721)
        at
org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations(ASTConverter.java:244)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:183)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:81)
        at org.eclipse.jdt.core.dom.AST.parseCompilationUnit(AST.java:353)
        at org.eclipse.jdt.core.dom.AST.parseCompilationUnit(AST.java:247)
        at
org.eclipse.jdt.internal.ui.search.FindOccurrencesEngine$FindOccurencesCUEngine.createAST(FindOccurrencesEngine.java:104)
        at
org.eclipse.jdt.internal.ui.search.FindOccurrencesEngine.findOccurrences(FindOccurrencesEngine.java:156)
        at
org.eclipse.jdt.internal.ui.javaeditor.JavaEditor$OccurrencesFinder.run(JavaEditor.java:2713)
        at java.lang.Thread.run(Thread.java:534)
Comment 1 Olivier Thomann CLA 2003-11-04 08:48:04 EST
Could you please provide the source code?
Comment 2 Olivier Thomann CLA 2003-11-04 08:53:35 EST
Could it be possible that you have an invalid string literal in your compilation
unit?
I need the test case for further investigation.
Comment 3 Olivier Thomann CLA 2003-11-04 09:57:23 EST
I will add more tracing to find out what is the error case.
Comment 4 Olivier Thomann CLA 2003-11-14 08:18:51 EST
Change milestone till we get a reproducable test case.
Comment 5 Olivier Thomann CLA 2003-11-19 12:27:18 EST
Do you remember in what context you used "Occurrences in file" action?
Comment 6 Dani Megert CLA 2003-11-19 12:34:34 EST
I thought I answered but obviously not.

>Source code of what?
I was editing JavaEditor (I think)

>Could it be possible that you have an invalid string literal in your compilation
>unit?
Yes this is possible since I was adding new code

Comment 7 Olivier Thomann CLA 2003-11-19 12:37:56 EST
We got a second report about a similar problem. The problem always occures in 
during the search for occurrences in files. I'd like to know when this is 
activated. In the second case, the user doesn't remember that he ran this 
operation. So something might be done in the background. If only I could 
reproduce it, I am sure it would be easy to fix.
Comment 8 Dani Megert CLA 2003-11-19 12:42:19 EST
Java > Work in Progress > Mark Occurrences.

This triggers which runs in background after post selection in the editor. As a
starting point for the code see JavaEditor.OccurrencesFinder
Comment 9 Olivier Thomann CLA 2003-11-19 12:57:12 EST
The problem seems to be related to invalid positions in the string literal. I 
am investigating.
Comment 10 Rafael Chaves CLA 2003-11-20 12:21:17 EST
Happened to me as well (i200311192030). The only feedback I had in the UI was in
the progress view/icon ("An internal error occurred during: "Java AST
creation"."), and it seems code assist temporarily stopped working. Sorry, but I
don't know what may have triggered it. Will pay more attention next time it happens.

!ENTRY org.eclipse.core.runtime 4 2 Nov 20, 2003 12:02:35.875
!MESSAGE An internal error occurred during: "Java AST creation".
!STACK 0
java.lang.IllegalArgumentException: Invalid string literal : >rg.eclipse.b3", <
	at org.eclipse.jdt.core.dom.StringLiteral.setEscapedValue(StringLiteral.java:119)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1410)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:847)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1665)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:871)
	at
org.eclipse.jdt.core.dom.ASTConverter.convertToVariableDeclarationFragment(ASTConverter.java:2697)
	at
org.eclipse.jdt.core.dom.ASTConverter.convertToVariableDeclarationStatement(ASTConverter.java:2737)
	at
org.eclipse.jdt.core.dom.ASTConverter.checkAndAddMultipleLocalDeclaration(ASTConverter.java:292)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1846)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2055)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1787)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:723)
	at
org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations(ASTConverter.java:244)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:183)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:81)
	at org.eclipse.jdt.core.dom.AST.parseCompilationUnit(AST.java:354)
	at org.eclipse.jdt.core.dom.AST.parseCompilationUnit(AST.java:247)
	at
org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartListenerGroup.computeAST(SelectionListenerWithASTManager.java:106)
	at
org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartListenerGroup.calculateASTandInform(SelectionListenerWithASTManager.java:116)
	at
org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$1.run(SelectionListenerWithASTManager.java:92)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:62)
Comment 11 Olivier Thomann CLA 2003-11-20 12:36:37 EST
The problem is that I cannot reproduce this positions problems. I don't know 
from where this offset is coming from. It looks like the positions are computed 
with a different source.
As long as I cannot reproduce it, it is really difficult to see what is 
happening. It seems related with the "Occurences in file" feature.
Comment 12 Olivier Thomann CLA 2003-11-20 13:08:48 EST
I think I know what is going on. It is a concurrency problem. I get twice the
source of the compilation unit in order to create the AST. The problem is that
the source might have been modified meanwhile.
The only way to fix this is to reuse the same source to compute the compiler ast
and inside the converter.
Won't be fixed for M5.
Comment 13 Olivier Thomann CLA 2003-11-20 13:28:14 EST
*** Bug 46988 has been marked as a duplicate of this bug. ***
Comment 14 Olivier Thomann CLA 2003-11-20 13:28:44 EST
Created attachment 6888 [details]
Patch file to fix this issue

Too late for M5.
Comment 15 Tom Hofmann CLA 2003-11-20 15:22:09 EST
I guess this is the same, but just for completeness the NumberLiteral version of it:

when editing JavaIndenter.java:

java.lang.IllegalArgumentException
        at org.eclipse.jdt.core.dom.NumberLiteral.setToken(NumberLiteral.java:124)
        at org.eclipse.jdt.core.dom.AST.newNumberLiteral(AST.java:1799)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1350)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:835)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1551)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:859)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1665)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:871)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1812)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1848)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1745)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1993)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1769)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2029)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1778)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:723)
        at
org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations(ASTConverter.java:244)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:183)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:81)
        at org.eclipse.jdt.core.dom.AST.parseCompilationUnit(AST.java:354)
        at org.eclipse.jdt.core.dom.AST.parseCompilationUnit(AST.java:247)
        at
org.eclipse.jdt.internal.ui.search.FindOccurrencesEngine$FindOccurencesCUEngine.createAST(FindOccurrencesEngine.java:105)
        at
org.eclipse.jdt.internal.ui.search.FindOccurrencesEngine.resolveTarget(FindOccurrencesEngine.java:160)
        at
org.eclipse.jdt.internal.ui.javaeditor.JavaEditor$OccurrencesFinder.run(JavaEditor.java:2731)
        at java.lang.Thread.run(Thread.java:534)
Comment 16 Olivier Thomann CLA 2003-11-20 15:28:22 EST
Same thing. This is due to the concurrent change of the buffer.
Comment 17 Philipe Mulet CLA 2003-11-20 15:33:34 EST
Considering for M5
Comment 18 Olivier Thomann CLA 2003-11-20 15:42:35 EST
Released for M5.
Files changed:
AST
CompilationUnitResolver
buildnotes_jdt-core.html
Comment 19 Olivier Thomann CLA 2003-11-20 21:03:49 EST
Verified that this is included in 200311201600.