| Summary: | NullPointerException in Open Model Element dialog | ||
|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | Mirko Raner <mirko> |
| Component: | Xtext | Assignee: | Jan Koehnlein <jan> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | elbrown, jan, sven.efftinge, tmf.xtext-inbox |
| Version: | 1.0.1 | Flags: | sven.efftinge:
indigo+
|
| Target Milestone: | M7 | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
Fix pushed to master. Now you should really fix your Ecore models ! :-) Closing all bugs that were set to RESOLVED before Neon.0 Closing all bugs that were set to RESOLVED before Neon.0 |
We're getting an NPE in the Open Model Element dialog when we perform the following steps: (1) enter some search text in the element name field, and then (2) remove all text from the element name field, leaving it empty The error message and stack trace is: Message: An internal error occurred during: "Calculate result size". java.lang.NullPointerException at org.eclipse.xtext.ui.search.IteratorJob$1.compare(IteratorJob.java:68) at org.eclipse.xtext.ui.search.IteratorJob$1.compare(IteratorJob.java:1) at java.util.Arrays.mergeSort(Arrays.java:1293) at java.util.Arrays.mergeSort(Arrays.java:1282) at java.util.Arrays.sort(Arrays.java:1210) at java.util.Collections.sort(Collections.java:159) at com.google.common.collect.Lists.sortedCopy(Lists.java:214) at org.eclipse.xtext.ui.search.IteratorJob.sortedCopy(IteratorJob.java:64) at org.eclipse.xtext.ui.search.IteratorJob.run(IteratorJob.java:59) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54) We're not sure what exactly is going on here, but it looks like the comparator could use some safety guards in line 68: private Collection<IEObjectDescription> sortedCopy(Iterable<IEObjectDescription> list) { return Lists.sortedCopy(matches, new Comparator<IEObjectDescription>() { public int compare(IEObjectDescription o1, IEObjectDescription o2) { int diff = o1.getQualifiedName().compareToIgnoreCase(o2.getQualifiedName()); if(diff==0) { diff = o1.getEClass().getName().compareToIgnoreCase(o2.getEClass().getName()); if(diff==0) { diff = o1.getEObjectURI().toString().compareTo(o2.getEObjectURI().toString()); } } return diff; } }); } There may be a problem with our model in that getName() returns null for some EClasses, but the comparison should probably handle this more gracefully.