Re: file locking error in tree editor

Petr Kuzel <[email protected]> Tue, 18 Nov 2003 11:00:02 +0100
Newsgroups gmane.comp.java.netbeans.modules.xml.devel
Organization Sun Microsystems
Message-ID <[email protected]>
Rich Unger wrote:
> I'm trying to debug a file locking problem in the tree editor (it's
> probably my fault to begin with).  The problem can be reproduced as
> follows:
> 
> 1. Create an XML file with a DTD DOCTYPE reference.
> Here's an example:
> 
> <?xml version="1.0" encoding="utf-8"?>
> 
> <!DOCTYPE struts-config
>   PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" 
>   "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
> <struts-config>
>    <action-mappings/>
> </struts-config>
> 
> 2. Expand it's node in the Explorer window.
> 3. Delete the node in the Explorer window.
> 
> You won't be allowed to delete the file.
> 
> The error does not occur if there's no DOCTYPE line, nor is there a
> problem if I open up the file in the text editor.  It seems limited to
> tree-editor/Explorer code.
> 
> My first thought was to look at xml/tree/completion/GrammarManager.java. 
> It has a static Map which holds onto references to the XMLDataObject (both
> in the key and, indirectly, in the value.  I tried replacing the key with
> Integer.toHexString(dObj.hashCode()), and making the dObj member variable
> a WeakReference.  None of that helped.
> 
> Then, just to make sure, I short-circuited all the calls to
> GrammarManager.getGrammar().  Still no luck.  So, perhaps it's not the
> completion code.
> 
> Perhaps something in the TAX representation is holding a reference to the
> FileInputStream?
> 
> Anyone got any other ideas?

All tree-edit functionality should use TAX abstraction. So
I guess that TAX's XNIBuilder does not close input stream's
properly (moreover it was known Xerces bug). Try new Xerces
with <http://xml.netbeans.org/issues/show_bug.cgi?id=18777>
patch applied.

   Cc.

-- 
<address>
<a href="mailto:[email protected]">Petr Kuzel</a> at Sun Microsystems :
<a href="http://www.netbeans.org/">NetBeans Java IDE</a></address>