Bug 318700 - NPE in CodeGenUtil getLeadingSeparators
Summary: NPE in CodeGenUtil getLeadingSeparators
Status: NEW
Alias: None
Product: EMFT
Classification: Modeling
Component: Mint (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Peter Nehrer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-02 07:48 EDT by Daniel Hirscher CLA
Modified: 2010-07-05 04:22 EDT (History)
0 users

See Also:


Attachments
stack trace (1.92 KB, text/plain)
2010-07-02 07:49 EDT, Daniel Hirscher CLA
no flags Details
another stack trace (1.75 KB, text/plain)
2010-07-05 04:16 EDT, Daniel Hirscher CLA
no flags Details
stacktrace with ClassCastException (1.73 KB, text/plain)
2010-07-05 04:22 EDT, Daniel Hirscher CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Hirscher CLA 2010-07-02 07:48:11 EDT
Build Identifier: I20100608-0911 (3.6 Helios)

When using Shift+Ctrl+G (search workspace references) on a Java-Element, the error log is filled up with entries while searching through all my *.genmodel files. I have Mint installed which shows up in the stack trace. However, the NPE occures on the CodeGenUtil.

Reproducible: Always

Steps to Reproduce:
1. start with Eclipse 3.6
2. install Mint
3. create some EMF project with at least one *.genmodel file
4. create some Java Project (which is not neccessarily related to the EMF project).
5. open some Java file
6. place cursor on some type
7. press Shift+Ctrl+G
8. open error log view
-> entries like attached one
Comment 1 Daniel Hirscher CLA 2010-07-02 07:49:15 EDT
Created attachment 173293 [details]
stack trace
Comment 2 Ed Merks CLA 2010-07-02 10:26:33 EDT
My sense is that you have a broken Ecore model, i.e., one that doesn't validate and in particular one with an enum literal with a null name.  I'm not sure if Mint wants to guard against such failures, but I won't change the GenModel to deal with the 1000 different failures that an ill formed Ecore model can produce.
Comment 3 Daniel Hirscher CLA 2010-07-05 04:15:39 EDT
(In reply to comment #2)
Thank you for your quick response.

I checked every single ecore which is referenced by the genmodel files where the error occures. Every ecore is valid. Every genmodel is valid, too. Yes, almost all ecore models contain enums (one does not, but another one referenced by the genmodel where the error occured does). So I checked all enums if there are null names somewhere. There are no null names. Every enum has a name and a unique integer value.

Beyond that, I changed one of the models and regenerated code from it. The error is still present.

Then I reloaded the genmodel (right-clicked genmodel and selected Reload...). To my surprise this changed something in the  genmodel. I had a look at it to find out what it was. There was one enum which had in the genmodel another name than in the ecore model. I regenerated code which didn't change anything. Then the error disappeard.

Well, ok, so on to the other genmodel files which where genereated from XSDs.

On one of them reloading does not work any more. On the XML Schema import wizard page I cannot press "Next". Clicking "Load" of my model does something. I can see the progress bar flickering. But it won't enable the Next-Button. This is weired. I will investigate this further. Regenerating code does work. It didn't change anything. The generated code works fine.

The other two genmodels do reload but will not change anything on the genmodel files. Regenerating code does work.

So the validation did not give me a hint on that discrepancy. The generated code did always work well. Up to eclipse 3.5.2 Mint did not produce an error on that.

So I realized that the exceptions are different.

I attached them. Maybe you or peter could give me a hint where to look.

Thank you for your time.
Comment 4 Daniel Hirscher CLA 2010-07-05 04:16:54 EDT
Created attachment 173391 [details]
another stack trace
Comment 5 Daniel Hirscher CLA 2010-07-05 04:22:53 EDT
Created attachment 173392 [details]
stacktrace with ClassCastException