This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 165183

Summary: A review is required for an xml.xam API change
Product: xml Reporter: Nikita Krjukov <supernikita>
Component: XAMAssignee: apireviews <apireviews>
Status: RESOLVED WONTFIX    
Severity: blocker CC: anebuzelsky, dkonecny, mmirilovic
Priority: P2 Keywords: API_REVIEW_FAST
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:
Attachments: The diff with the main changes is going to be applied

Description Nikita Krjukov 2009-05-14 15:34:44 UTC
A new abstract method is necessary to be added to the
xml.xam/src/org/netbeans/modules/xml/xam/dom/AbstractDocumentModel.java in order to fix the issue #162769

/**
 * Removes the root component from the model. 
 * It is intended to be called automatically when a user delete corresponding root component from 
 * xml sources. Avoid calling it without necessity. 
 */
public abstract void removeRootComponent();

The adding of the method breaks backward compatibility. But it is required to fix the mentioned issue.
Comment 1 Nikita Krjukov 2009-05-14 16:41:33 UTC
Created attachment 82140 [details]
The diff with the main changes is going to be applied
Comment 2 Nikita Krjukov 2009-05-14 16:46:36 UTC
The suggested change violates backward compatibility. But it looks inevitable. 
Please look the issue #162769 for additional descriptions. 
Comment 3 Milos Kleint 2009-05-15 07:53:37 UTC
I suppose you will fix every instance in the main + main/contrib repositories? maven.model also using xam for maven's
xml models.
Comment 4 Nikita Krjukov 2009-05-15 11:51:41 UTC
Thank you for mentioning maven model. I'll take care about it. 
I'll definitely fix all modules dependent from XAM. Although some additional actions can be required because some
modules relies on unconditional presence of the root component. 

For example, it can be necessary to add new checks by the following pattern.
Where the following code happens  
  if (model != null && model.getState() == State.VALID) {
it usually has to be changed to
  if (model != null && model.getRootComponent() != null && model.getState() == State.VALID) {

I'm going to provide simple implementation of the removeRootComponent() method like you can see in the attached diff. 
Sometimes it can be necessary to add a write check or fire an event. But it depends on the specific implementation of
the model. 

I hope it is acceptable support, which I'm going to provide?
Comment 5 Antonin Nebuzelsky 2009-05-15 11:55:46 UTC
> Sometimes it can be necessary to add a write check or fire an event.

So, my understanding is that you expect people will do these additional fixes in their code after your change in
xml.xam. Right?

> I hope it is acceptable support, which I'm going to provide?

No, not a 1 week before 6.7 code-freeze.
Comment 6 Nikita Krjukov 2009-05-15 17:03:19 UTC
I've applied changes to all related modules locally. But there are too many modules, which depend on XAM. So there is
big risk of damaging something. So I decided postpone applying the changes until the new branch for NetBeans 6.7 will
appear. Here is the list of modules:

-- MAIN --
bpel.model
compapp.casaeditor
iep.model
maven.model
web.jsf
websvc.axis2
websvc.jaxwsmodel
websvc.rest.wadl.model
xml.axi
xml.schema.model
xml.retriever
xml.wsdl.model
xslt.model
xslt.tmap

-- MAIN/CONTRIB -- 

org.sample.registry.model

I'm going to waive the issue #162769
Comment 7 Nikita Krjukov 2010-03-23 10:05:24 UTC
We don't have to do the described changes because I managed to fix the issue #162769 another way, which doesn't require API changes.