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 86624 - XDM access problem when running Ant task inside NetBeans
Summary: XDM access problem when running Ant task inside NetBeans
Status: VERIFIED FIXED
Alias: None
Product: xml
Classification: Unclassified
Component: XDM (show other bugs)
Version: 5.x
Hardware: All All
: P1 blocker (vote)
Assignee: issues@xml
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-06 00:37 UTC by Jun Qian
Modified: 2007-04-11 00:39 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
patch for hybrid mode (2.19 KB, patch)
2006-10-06 16:43 UTC, Chris Webster
Details | Diff
Patch to allow overriding of default access provider (4.17 KB, patch)
2006-10-06 20:06 UTC, Chris Webster
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jun Qian 2006-10-06 00:37:03 UTC
This is related to memory leak problem in IZ 81985.

To fix the memory leak in CompApp Project Ant tasks, we need to declare in-VM
tasks to reuse classes loaded by NetBeans. The problem is that when running
inside NetBeans, the Ant task picks up the XDM module jar and its declared
services. The XDMAccessProvider will cause NPE with readonly models:

at org.netbeans.modules.xml.xdm.nodes.XMLSyntaxParser.parse(XMLSyntaxParser.java:46)
        at org.netbeans.modules.xml.xdm.XDMModel.prepareSync(XDMModel.java:153)
        at org.netbeans.modules.xml.xdm.XDMModel.sync(XDMModel.java:144)
        at org.netbeans.modules.xml.xdm.xam.XDMAccess.sync(XDMAccess.java:109)
        at org.netbeans.modules.xml.xam.AbstractModel.sync(AbstractModel.java:230)
        at
org.netbeans.modules.xml.xam.AbstractModelFactory.getModel(AbstractModelFactory.java:83)
        at
org.netbeans.modules.xml.wsdl.model.WSDLModelFactory.getModel(WSDLModelFactory.java:56)
        at
org.netbeans.modules.compapp.projects.jbi.anttasks.wsdlRepository.getAllWsdlDocumentFormSEJars(wsdlRepository.java:231)
        at
org.netbeans.modules.compapp.projects.jbi.anttasks.wsdlRepository.<init>(wsdlRepository.java:97)
        at
org.netbeans.modules.compapp.projects.jbi.anttasks.BuildServiceAssembly.execute(BuildServiceAssembly.java:227)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at org.apache.tools.ant.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
        at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
        at
org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:240)
        at
org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:293)
        at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:131)

It works when the XDM is removed from the Ant task's classpath because NetBeans
lookup returns:

   org.netbeans.modules.xml.xam.dom.ReadOnlyAccess

instead of:

   org.netbeans.modules.xml.xdm.xam.XDMAccess

Not sure how to work around this now.
Comment 1 Chris Webster 2006-10-06 16:43:49 UTC
Created attachment 34998 [details]
patch for hybrid mode
Comment 2 Chris Webster 2006-10-06 19:51:50 UTC
This problem was caused by a design change to the classpath for the ANT task.
Previously, the classpath was isolated from the IDE's classpath and the XDM
service was not available so the models performed as they would outside the IDE.
There was a recent change to resolve a memory leak, where the IDE classpath is
not available and thus the XDMModelAccessProvider is on the classpath. The
suggested fix is to allow a client to override the default
DocumentAccessProvider via the ModelSource lookup. A client which requires
read-only access could add the following to the lookup to override the default
Model Access Support:

org.netbeans.modules.xml.xam.dom.ReadOnlyAccess.Provider.getInstance()

The fix to XAM is to look at the current ModelSource's lookup before using the
default implementation. 

Comment 3 Chris Webster 2006-10-06 20:06:06 UTC
Created attachment 35004 [details]
Patch to allow overriding of default access provider
Comment 4 Chris Webster 2006-10-06 22:00:42 UTC
fixed in release55_dev
Comment 5 Nam Nguyen 2006-10-06 22:17:28 UTC
Good change for added flexibility for model source to tell which model access
provider to use.  Code looks goods, change would have no effects on existing
client code and existing behaviour.
Comment 6 Chris Webster 2006-10-07 01:06:44 UTC
fixed in release55.
Comment 7 tonybeckham 2007-04-11 00:19:31 UTC
jqian:

This issue submitted by you is marked as resolved. Since it relates to some
source code specifics, QA is unable to verify it. Could you please verify this
issue and mark it as verified or reopen it?
Comment 8 Jun Qian 2007-04-11 00:39:42 UTC
Verified.