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.
Build: NetBeans IDE 7.0 (Build 201104080000) VM: Java HotSpot(TM) 64-Bit Server VM, 20.1-b02, Java(TM) Platform, Standard Edition for Business, 1.6.0_26-ea-b02 OS: Windows 7 User Comments: GUEST: Generating hibernate.cfg.xml. Stacktrace: javax.swing.text.BadLocationException: BaseDocument.write() at org.netbeans.editor.BaseDocument.write(BaseDocument.java:1548) at org.netbeans.editor.BaseKit.write(BaseKit.java:722) at org.netbeans.modules.xml.multiview.XmlMultiViewEditorSupport.saveFromKitToStream(XmlMultiViewEditorSupport.java:239) at org.openide.text.CloneableEditorSupport.getInputStream(CloneableEditorSupport.java:1625) at org.netbeans.modules.xml.multiview.XmlMultiViewEditorSupport.getInputStream(XmlMultiViewEditorSupport.java:195) at org.netbeans.modules.hibernate.loaders.cfg.HibernateCfgDataObject.parseDocument(HibernateCfgDataObject.java:135)
Created attachment 108355 [details] stacktrace
Created attachment 108702 [details] stacktrace
It looks like a problem is from XmlMultiViewEditorSupport. Please evaluate.
Created attachment 111585 [details] stacktrace To reproduce: - create web application with GlassFish serve and Hibernate framework - open new file wizard - choose "Hibernate|Hibernate Configuration Wizard" - continue in wizard and when you click the Finish button it throws this exception
Created attachment 112366 [details] stacktrace To reproduce: - create web project with Hibernate framework and GlassFish server - open new file wizard - choose "Hibernate|Hibernate Configuration Wizard" and click Next - finish the wizard with default values - create the same file again and exception is thrown
Created attachment 112919 [details] stacktrace
This bug already has 20 duplicates see http://statistics.netbeans.org/exceptions/detail.do?id=158059
Could this be a problem in the Hibernate support? Cc'ing Sergey.
yes, may be hibernate support issue with attempt to override already created configuration, wizard should block this case.
looks like it;s not the reason as I can't create new config with the same name. something else need to be broken.
can't reproduce it yet
Whoever can reproduce, can you please attach steps to reproduce? Changing to incomplete for now - please reopen after attaching the steps. Thanks.
I'm not sure it's really hibernate issue but have no proof, there is another issue with report from jpa side first (issue 134726) but also have comments on getting this problem in another case (RCP on netbeans). So either all cases prepare environment in wrong way or it's an issue in XML multiview support.
I am still able to reproduce it: - create web project with Hibernate framework and GlassFish server - open new file wizard - choose "Hibernate|Hibernate Configuration Wizard" and click Next - finish the wizard with default values - repeat creation of file and exception appears (on 3-rd attempt in this case) http://statistics.netbeans.org/exceptions/exception.do?id=541075
I was able to reproduce, in my case it was 5th attempt, 4th and 5th cfg files seems ok regardless exception.
XMLKit::write(new OutputStreamWriter(stream, dObj.getEncodingHelper().getEncoding()), doc, 0, doc.getLength()); is called but as it's not atomic action doc.length is changed during processing and is smaller when BaseDocument::write is invoked inside the method.
as it's XmlMultiViewEditorSupport use to get doc.getLength() in saveFromKitToStream and use it in call to XMLKit(BaseKit) it's likely should be the place to lock this document or handle possible changes somehow else, please evaluate.
just decide it may be good to catch this exception on hibernate/persistence support side anyway, but will keep 134726 to track as something missed in xml multiview, as 134726 have a report from RCP application.
http://hg.netbeans.org/web-main/rev/65bf55e7cbe5 fix
Created attachment 113113 [details] Possible patch I am not able to reproduce the defect that reliably. However when it happened to me, I have discovered that the event is fired during *first* load of the document - it does not make much sense. The attached patch should eliminate the 1st event, and it seems that the wsdl hierarchy refreshes properly after that.
Seems good and even better as fix root cause, may be have sense to reopen the issue and patch for hibernate/persistence area can be reverted and this one applied or anyway this one may be valuable even without reverting.
Integrated into 'main-golden' Changeset: http://hg.netbeans.org/main-golden/rev/65bf55e7cbe5 User: Sergey B. Petrov <sj-nb@netbeans.org> Log: #198676, #134726 add "catch" to possible parsing issue
I can confirm that with the patch by sdedic I am not able to reproduce it (before applying the patch I reverted #65bf55e7cbe5).