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.
[ JDK VERSION : 1.7.4 ] We have some schema files but I am not able to use the code completion because the XML download never finishes. I will attach a sample schema soon.
Created attachment 119841 [details] Sample xsd If I call code completion, in this particular schema, I can see that some UIs are opened to confirm the download of some schemas (probably official ones), but the retriever never ends and the only thing I can see at Retriever Output is: May 24, 2012 3:58:04 PM : Retrieving Location: http://www.riobranco.com.br/schemas/tipos_basicos I will attach a thread dump, maybe it can help you too.
Created attachment 119842 [details] Thread dump
I have tested with 7.0.1, 7.1.2 and 7.2 ans I can confirm that it is present since 7.1.2 (I don't have 7.1 and 7.1.1 here to test it right now). Product Version: NetBeans IDE Dev (Build 20120523-da4743d1f776) Java: 1.7.0_04; Java HotSpot(TM) Client VM 23.0-b21 System: Linux version 3.0.0-17-generic-pae running on i386; UTF-8; en_US (nb)
I can reproduce it too. Product Version: NetBeans IDE Dev (Build 201205280002) Java: 1.7.0_04; Java HotSpot(TM) 64-Bit Server VM 23.0-b21 System: Linux version 3.0.0-12-generic running on amd64; UTF-8; cs_CZ (nb) User directory: /home/cesilko/.netbeans/dev Cache directory: /home/cesilko/.cache/netbeans/dev
There appears to be some redirect loop; try to run the IDE with -J-Dorg.netbeans.modules.xml.retriever.impl.level=100 and check the ide log file. According to my testing, the site's SSO creates an infinite redirect loop when the user agent does not accept & use cookies - the Retriever is an example. An easy fix is to stop downloading a resource after certain amount of redirects. More elaborate fix would require to properly use cookies + all the cookie management (expiration, ...) as in user agents.
As a workaround for buggy site, please download the schema manually, then use XML catalog (Tools | DTD and XML Schemas) to define local mapping from the NS URI to downloaded file.
I think you have not understand the issue here. If you take a look at the import, the schema location is locally defined. Actually the imported schema is stored at local drive, at the same folder. We have others examples, where the path is relative too. <import namespace="http://www.riobranco.com.br/schemas/tipos_basicos" schemaLocation="tiposBasicos_v1.1.xsd"/> IMHO, the CC should be able to find this schemas since it has the correct path where to find it, and if it is not located, the search should be aborted.
Hm, apparently I did not. I was focused on the 'download problem' and forgot about the reported scenario, sorry. I would bet that the IDE tries to download the http://www.riobranco.com.br/schemas/tipos_basicos because it tries to fill in the b: namespace prefix for CC dropdown box - this is not strictly necessary, as I guess in the context you invoke CC, only xsd: elements are allowed. If this is the case, then either http://www.riobranco.com.br/schemas/tipos_basicos is in the NB Catalog, or basic XML completion does not have a clue where to find the resource except the NS URI itself. The XML CC (which suggests schema contents) does not actually understand the schema, it works because of schema for schemas :) BTW in my debugger, the model for the imported tipos_basicos WAS loaded from the local harddrive. Please run NB with the mentioned switch, and to be sure also add: -J-Dorg.netbeans.modules.xml.schema.completion.util.level=100 -J-Dorg.netbeans.modules.xml.retriever.catalog.level=100 so we get the real data on what's going on in your case. Please attach the logs here. An additional workaround would be to define an attribute xsi:schemaLocation="http://www.riobranco.com.br/schemas/tipos_basicos tiposBasicos_v1.1.xsd" in the XSD's root element, to give further hint to XML parsing. I would recommend that anyway, since all XML processing tools would get this hint. So the identified defects here are: * the namespace contents are fetched/created eagerly. The models should be created (and possibly xsd for them retrieved) only if the namespace could be actually in scope - an element from the namespace is allowed in the current context. * the XML CC core does not understand meaning of xsd:targetNamespace, and also tries to load contents of the target namespace itself. Naturally there's no schemaLocation for it, so it goes to the web. * [an enhancement] the XML CC core should be hinted from xsd:import instructions; if xsd:import contains a schemaLocation, it should be used in namespace fetching, too. Not a standard behaviour, since the schema XML would not probably XML-validate without xmlns URI reachable or xsi:schemaLocation, but could be done.
Created attachment 120009 [details] Log file The log has some timeout exceptions. I can see at the Retriever Output the follow text: May 29, 2012 11:55:17 AM : Retrieving Location: http://www.riobranco.com.br/schemas/tipos_basicos Error: An I/O error occured. Connection timed out May 29, 2012 11:59:12 AM : Retrieving Location: http://www.riobranco.com.br/wsdls/CotacaoService Error: An I/O error occured. Connection timed out
Created attachment 120010 [details] Log file using xsi:schemaLocation workaround Now, the only thing I can see at Retriever Output is: May 29, 2012 1:34:27 PM : Retrieving Location: http://www.riobranco.com.br/wsdls/CotacaoService Error: An I/O error occured. Connection timed out
Do you need anything else? Just let me know if I can help with additional information.
Created attachment 120012 [details] Sample XSD with xsi:schemaLocation workaround Just for the record.
Implemented a workaround - schemaLocation attribute (if present) is used for fetching + targetNamespace URI is not fetched. But still, the fetching is quite eager and should be improved. However I think this fix is sufficient to make the defect P3.
Integrated into 'main-golden', will be available in build *201206150001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/a6bf0360d183 User: Svata Dedic <sdedic@netbeans.org> Log: #212972: partial fix: schemaLocation attribute is honoured when getting namespace definitions. NS mentioned in targetNamespace attribute ignored.
Report from old NetBeans version. Due to code changes since it was reported likely not reproducible now. Feel free to reopen if happens in 8.0.2 or 8.1.