| Summary: | Potential NPE in mwe.Validator#groupByURI() | ||
|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | Karsten Thoms <karsten.thoms> |
| Component: | Xtext | Assignee: | Project Inbox <tmf.xtext-inbox> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | Flags: | sven.efftinge:
kepler+
|
| Version: | 2.0.0 | ||
| Target Milestone: | M4 | ||
| Hardware: | PC | ||
| OS: | Mac OS X - Carbon (unsup.) | ||
| Whiteboard: | |||
pushed Requested via bug 522520. -M. |
When the function Validator#groupByURI() that computes the multimap's key returns null, which it potentially does, a NPE is caused in a later step. -------------------- result.putAll(Multimaps.index(Arrays.asList(diagnostic), new Function<MWEDiagnostic, URI>() { public URI apply(MWEDiagnostic from) { Issue issue = (Issue) from.getElement(); URI uriToProblem = issue.getUriToProblem(); return uriToProblem != null ? uriToProblem.trimFragment() : null <-- this will cause a NPE; } })); -------------------- This situation should be handled better, maybe by throwing an exception in apply() with a meaningful text. Error stack: Thread [main] (Suspended (exception NullPointerException)) Preconditions.checkNotNull(T) line: 180 ImmutableListMultimap$Builder<K,V>(ImmutableMultimap$Builder<K,V>).put(K, V) line: 149 ImmutableListMultimap$Builder<K,V>.put(K, V) line: 161 Multimaps.index(Iterable<V>, Function<? super V,K>) line: 1223 Validator.groupByURI(MWEDiagnostic[]) line: 148 Validator.appendMessages(StringBuilder, MWEDiagnostic[]) line: 121 Validator.toString(Issues) line: 104 Validator.validate(ResourceSet, IResourceServiceProvider$Registry, Issues) line: 88 Reader.invokeInternal(WorkflowContext, ProgressMonitor, Issues) line: 165 Reader(AbstractWorkflowComponent).invoke(WorkflowContext, ProgressMonitor, Issues) line: 126 Mwe2Bridge.invoke(IWorkflowContext) line: 34 Reader(AbstractWorkflowComponent).invoke(IWorkflowContext) line: 201 Workflow(AbstractCompositeWorkflowComponent).invoke(IWorkflowContext) line: 35 Workflow.run(IWorkflowContext) line: 19 Mwe2Runner.run(String, Map<String,String>, IWorkflowContext) line: 97 Mwe2Runner.run(String, Map<String,String>) line: 73 Mwe2Runner.run(URI, Map<String,String>, IWorkflowContext) line: 64 Mwe2Runner.run(URI, Map<String,String>) line: 55 Mwe2Launcher.run(String[]) line: 74 Mwe2Launcher.main(String[]) line: 35