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 128063 - Should not try to access DTD on the network
Summary: Should not try to access DTD on the network
Status: VERIFIED FIXED
Alias: None
Product: xml
Classification: Unclassified
Component: Text-Edit (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Samaresh Panda
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-21 18:07 UTC by Dongmei Cao
Modified: 2008-03-10 19:52 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Sample project for reproducing the problem (26.97 KB, application/x-compressed)
2008-03-03 19:22 UTC, Dongmei Cao
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dongmei Cao 2008-02-21 18:07:51 UTC
I noticed this when I was trying to provide code completion for the Hibernate configuration files and mapping files. The
generic XML editing tries to access the DTDs on the network during code completion. This makes the code completion very
slow (even fail) when the network is very slow. For example, when I'm on a slow network, I keep getting the following
messages in the log file and the code completion fails with no completion items after after a few seconds (timeout).

INFO [org.netbeans.modules.xml.schema.completion.util.CompletionUtil]: Connection timed out: connect
INFO [org.netbeans.modules.xml.schema.completion.util.CompletionUtil]: Connection timed out: connect
INFO [org.netbeans.modules.xml.schema.completion.util.CompletionUtil]: Connection timed out: connect
INFO [org.netbeans.modules.xml.schema.completion.util.CompletionUtil]: Connection timed out: connect
INFO [org.netbeans.modules.xml.schema.completion.util.CompletionUtil]: Connection reset

Note that the HibernateCatalog has already bean registered to resolve the Hibernate DTDs to local resources. Why the
code completion is not using the local DTDs.
Comment 1 Dongmei Cao 2008-02-21 18:09:38 UTC
You can try it out on any DTD based xml files, for example, sun-web.xml.
Comment 2 Dongmei Cao 2008-02-21 18:22:07 UTC
I had to disconnect myself from the (slow) network so that the connection would fail right away and move on.
Comment 3 Ayub Khan 2008-02-28 23:51:23 UTC
The issue is in DTD Code completion code do not have the same capability as far as loading from catalog
as the Schema Code completion.

I think this is an enhancement, since this is a missing feature for DTD code completion. We can fix this after 6.1.
Comment 4 Dongmei Cao 2008-02-29 05:43:45 UTC
I do not agree this an ENHANCEMENT. With this bug, the code completion for the Hibernate configuration and mapping files
is unusable 50% of times.
Comment 5 Samaresh Panda 2008-03-02 04:55:28 UTC
Can you please attach a sample xml document? Also please do mention the build or configuration I must use in order to
see the problem.
Comment 6 Dongmei Cao 2008-03-03 19:20:12 UTC
I attached a sample project for you to see the problem. I'm using the latest code from main. But you do need the
Hibernate support modules in the main/contrib (hibernatelib and hibernate) installed for the attached sample project to
work. Here is what you can do to get the Hibernate support modules:
- clone the main/contrib (make sure you cd to main before cloning the main/contrib)
- cd to main/contrib/hibernatelib and ant
- cd to main/contrib/hibernate and ant
- Now you have the Hibernate support modules

- Open the attached the project; 
- Open the Hibernate configuration file - hibernate.cfg.xml, which is under the default package. 
- Try to edit the xml file, for example, add another <property>. 
It depends on the network and the web server for the dtd, sometimes, it is fast. But sometimes, it is very slow so that
you get "Please wait...", then "No Suggestion". For you to see it is actually trying the access the dtd on the network,
just disconnect yourself from the network when you're in the middle of editing the xml file. You'll get the INFO message
as following in the IDE log

INFO [org.netbeans.modules.xml.schema.completion.util.CompletionUtil]: Software caused connection abort: connect
INFO [org.netbeans.modules.xml.schema.completion.util.CompletionUtil]: Software caused connection abort: connect
INFO [org.netbeans.modules.xml.schema.completion.util.CompletionUtil]: No route to host: connect
INFO [org.netbeans.modules.xml.schema.completion.util.CompletionUtil]: No route to host: connect
Comment 7 Dongmei Cao 2008-03-03 19:22:12 UTC
Created attachment 57696 [details]
Sample project for reproducing the problem
Comment 8 Dongmei Cao 2008-03-03 21:14:08 UTC
You can also see the problem by editing the sun-web.xml.
Just like the steps I listed for the attached sample project, create a web project and try to edit the sub-web.xml. In
the middle of editing, disconnect your network. You'll see message like the following too:
INFO [org.netbeans.modules.xml.schema.completion.util.CompletionUtil]: Software caused connection abort: connect
INFO [org.netbeans.modules.xml.schema.completion.util.CompletionUtil]: No route to host: connect
INFO [org.netbeans.modules.xml.schema.completion.util.CompletionUtil]: No route to host: connect
INFO [org.netbeans.modules.xml.schema.completion.util.CompletionUtil]: No route to host: connect
Comment 9 Samaresh Panda 2008-03-05 17:24:29 UTC
Fix integrated, http://hg.netbeans.org/main?cmd=changeset;node=2d51c2f933bc.
Comment 10 Dongmei Cao 2008-03-10 19:52:31 UTC
Verified in a build from 3/06/08