APAR status
Closed as program error.
Error description
Description: NullPointerException when custom validator sets a target on an u nresolved proxy When this error arises, the validation stops completely. It also seems that the ID of the validation listener is not replaced in the error message. Message: An exception occurred while initializing and informing a validat ion listener with id {0}. The listener has been removed for this session. Exception stack trace: java.lang.NullPointerException at com.ibm.xtools.emf.validation.core.presentation.markers.Abstr actValidationMarkerPresenter.addElementIdsToMarkerAttributeMap(A bstractValidationMarkerPresenter.java:149) at com.ibm.xtools.emf.validation.core.presentation.markers.Abstr actValidationMarkerPresenter.createMarkerDescriptor(AbstractVali dationMarkerPresenter.java:132) at com.ibm.xtools.modeler.ui.internal.ui.views.tasklist.Validati onProblemsReporter.createMarkerDescriptor(ValidationProblemsRepo rter.java:254) at com.ibm.xtools.emf.validation.core.presentation.markers.Abstr actValidationMarkerPresenter.createMarker(AbstractValidationMark erPresenter.java:297) at com.ibm.xtools.emf.validation.core.presentation.markers.Abstr actValidationMarkerPresenter.createMarkers(AbstractValidationMar kerPresenter.java:1186) at com.ibm.xtools.emf.validation.core.presentation.markers.Abstr actValidationMarkerPresenter$BuildMarkerData$2.run(AbstractValid ationMarkerPresenter.java:396) at org.eclipse.gmf.runtime.emf.core.internal.domain.MSLTransacti onalEditingDomain.runExclusive(MSLTransactionalEditingDomain.jav a:339) at org.eclipse.gmf.runtime.emf.core.internal.domain.MSLEditingDo main.runExclusive(MSLEditingDomain.java:2656) at com.ibm.xtools.emf.validation.core.presentation.markers.Abstr actValidationMarkerPresenter$BuildMarkerData.execute(AbstractVal idationMarkerPresenter.java:394) at com.ibm.xtools.modeler.ui.internal.ui.views.tasklist.Validati onProblemsReporter$BatchBuildMarkerData.execute(ValidationProble msReporter.java:469) at com.ibm.xtools.modeler.ui.internal.ui.views.tasklist.Validati onProblemsReporter.validationEvent(ValidationProblemsReporter.ja va:164) at com.ibm.xtools.emf.validation.core.internal.ValidationManager .validationOccurred(ValidationManager.java:312) at org.eclipse.emf.validation.service.ModelValidationService.bro adcastValidationEvent(ModelValidationService.java:309) at org.eclipse.emf.validation.internal.service.AbstractValidator .validate(AbstractValidator.java:160) at org.eclipse.emf.validation.internal.service.BatchValidator.va lidate(BatchValidator.java:120) at com.ibm.xtools.modeler.ui.internal.commands.ValidateCommand.d oExecuteWithResult(ValidateCommand.java:115) at org.eclipse.gmf.runtime.common.core.command.AbstractCommand.e xecute(AbstractCommand.java:135) at org.eclipse.core.commands.operations.DefaultOperationHistory. execute(DefaultOperationHistory.java:511) at org.eclipse.gmf.runtime.emf.ui.action.AbstractModelActionDele gate.execute(AbstractModelActionDelegate.java:168) at com.ibm.xtools.modeler.ui.internal.ui.actions.ValidateActionD elegate.doRun(ValidateActionDelegate.java:84) at org.eclipse.gmf.runtime.common.ui.action.AbstractActionDelega te.run(AbstractActionDelegate.java:391) at org.eclipse.gmf.runtime.emf.ui.action.AbstractModelActionDele gate.access$0(AbstractModelActionDelegate.java:1) at org.eclipse.gmf.runtime.emf.ui.action.AbstractModelActionDele gate$1.run(AbstractModelActionDelegate.java:73) at org.eclipse.gmf.runtime.emf.core.internal.domain.MSLTransacti onalEditingDomain.runExclusive(MSLTransactionalEditingDomain.jav a:339) at org.eclipse.gmf.runtime.emf.core.internal.domain.MSLEditingDo main.runExclusive(MSLEditingDomain.java:2656) at org.eclipse.gmf.runtime.emf.ui.action.AbstractModelActionDele gate.run(AbstractModelActionDelegate.java:70) at org.eclipse.gmf.runtime.common.ui.action.ActionManager$2.run( ActionManager.java:294) at org.eclipse.jface.operation.ModalContext$ModalContextThread.r un(ModalContext.java:121) Steps to reproduce: 1. Create a new 'Model Validation' project (Examples ? RMP ? UML Modeler ? Model Validation) 2. In 'JavaExample.java', replace the 'validate' code by the one below (just a demo code to create a Status on an unresolved pro xy): if (target instanceof Classifier) { Classifier clazz = (Classifier)target; ArrayList?EObject? myCollection = new ArrayList?EObject?(); myCollection.add(clazz.getAttributes().get(0).getType()); return ConstraintStatus.createStatus(ctx, clazz.getAttributes ().get(0).getType(), ctx.getResultLocus(), 'ERROOOOR', (Object)n ull); } 3. Run as Eclipse app. 4. In the runtime workbench, create 2 UML projects, with a class in each model 5. In the first model, create an attribute, and set its type to the class in the other project. 6. Close the first project, and delete the class in the second o ne: This will create an unresolved proxy on the type of the attr ibute. 7. Reopen the first project, and validate. You get this error. Workaround: Manually check if the target is a proxy in the code.
Local fix
Problem summary
**************************************************************** * USERS AFFECTED: * **************************************************************** * PROBLEM DESCRIPTION: * **************************************************************** * RECOMMENDATION: * **************************************************************** NullPointerException when custom validator sets a target on an unresolved proxy. We can prevent the NPE at that point, however the customer is using the framework incorrectly. They should be marking the attribute that references the missing type, not the missing type itself.
Problem conclusion
We can prevent the NPE at that point. They should be marking the attribute that references the missing type, not the missing type itself. Moved the declaration and intialization of a local variable so that it was NPE checked.
Temporary fix
Comments
APAR Information
APAR number
PM11461
Reported component name
SW MODELER WIN
Reported component ID
5724I6901
Reported release
754
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt
Submitted date
2010-04-02
Closed date
2010-08-20
Last modified date
2010-08-20
APAR is sysrouted FROM one or more of the following:
APAR is sysrouted TO one or more of the following:
Fix information
Fixed component name
SW MODELER WIN
Fixed component ID
5724I6901
Applicable component levels
R754 PSN
UP
[{"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"SSCLKU","label":"Rational Software Modeler"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"7.5.4","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]
Document Information
Modified date:
20 August 2010