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 219447 - Error saving XML with LATIN character
Summary: Error saving XML with LATIN character
Status: RESOLVED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Generic Infrastructure (show other bugs)
Version: 7.2.1
Hardware: PC All
: P2 normal with 1 vote (vote)
Assignee: Svata Dedic
URL:
Keywords:
: 219267 220710 226895 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-10-03 12:38 UTC by ksfreitas
Modified: 2013-06-05 14:21 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Error reproduction (2.45 KB, application/xml)
2012-10-03 12:47 UTC, ksfreitas
Details
Proposed fix (3.22 KB, patch)
2012-10-16 10:39 UTC, Svata Dedic
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description ksfreitas 2012-10-03 12:38:39 UTC
NetBeans IDE 7.2 (Build 201207171143)
Java: 1.7.0_05; Java HotSpot(TM) 64-Bit Server VM 23.1-b03
Windows 7 versão 6.1 em execução em amd64; Cp1252; pt_BR (nb)


Exeception raised when save button is clicked (document with LATIN character):

java.lang.IllegalStateException: Current state = FLUSHED, new state = CODING_END
	at java.nio.charset.CharsetEncoder.throwIllegalStateException(CharsetEncoder.java:968)
	at java.nio.charset.CharsetEncoder.encode(CharsetEncoder.java:554)
	at org.netbeans.api.queries.FileEncodingQuery$ProxyCharset$ProxyEncoder.implFlush(FileEncodingQuery.java:432)
	at java.nio.charset.CharsetEncoder.flush(CharsetEncoder.java:650)
	at java.nio.charset.CharsetEncoder.encode(CharsetEncoder.java:786)
	at java.nio.charset.CharsetEncoder.canEncode(CharsetEncoder.java:892)
	at java.nio.charset.CharsetEncoder.canEncode(CharsetEncoder.java:961)
	at org.netbeans.modules.xml.text.TextEditorSupport.saveDocument(TextEditorSupport.java:398)
	at org.netbeans.modules.xml.text.TextEditorSupport$Env.save(TextEditorSupport.java:646)
	at org.openide.actions.SaveAction.performAction(SaveAction.java:132)
	at org.openide.actions.SaveAction.performAction(SaveAction.java:102)
	at org.openide.actions.SaveAction$Delegate.actionPerformed(SaveAction.java:249)
	at org.openide.awt.ContextAction$Performer.actionPerformed(ContextAction.java:231)
	at org.openide.awt.ContextManager.actionPerformed(ContextManager.java:247)
	at org.openide.awt.ContextAction.actionPerformed(ContextAction.java:109)
	at org.openide.util.actions.ActionInvoker$1.run(ActionInvoker.java:93)
	at org.openide.util.actions.ActionInvoker$ActionRunnable.actionPerformed(ActionInvoker.java:162)
	at org.netbeans.core.ModuleActions.invokeAction(ModuleActions.java:109)
	at org.netbeans.modules.openide.actions.ActionsBridgeImpl.invokeAction(ActionsBridgeImpl.java:60)
	at org.openide.util.actions.ActionInvoker$ActionRunnable.doRun(ActionInvoker.java:153)
	at org.openide.util.actions.ActionInvoker$2.run(ActionInvoker.java:110)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1452)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2032)
Comment 1 Svata Dedic 2012-10-03 12:41:26 UTC
Could you please attach the file, or a portion of it, which I could use to raise the error ? Thanks.
Comment 2 ksfreitas 2012-10-03 12:47:15 UTC
Created attachment 125302 [details]
Error reproduction

You have to put a latin character in body before try to save. (like ç, á, ã)
Comment 3 ksfreitas 2012-10-03 12:48:54 UTC
It worked before the last update.
Comment 4 ksfreitas 2012-10-09 22:03:17 UTC
sdedic, you're able to reproduce the problem?
Comment 5 Svata Dedic 2012-10-10 20:39:27 UTC
Yes, thanks for the detailed report.
Comment 6 Svata Dedic 2012-10-16 10:33:57 UTC
This defect can actually affect not only XMLs and is in the generic infrastructure. If triggered, the user may loose data (unsaved file).
Comment 7 Svata Dedic 2012-10-16 10:39:04 UTC
Created attachment 126003 [details]
Proposed fix

The proxy encoder did not properly handle OVERFLOW condition during encodeHead
Comment 8 Svata Dedic 2012-10-16 10:39:31 UTC
Tomasi, could you please review the fix (as one of the original authors) ?
Comment 9 Svata Dedic 2012-10-17 15:55:34 UTC
there was a defect in FEQ delegating encoder in that during flush(), the delegate encoder was flushed although it did not encode all contents of the buffer because of output buffer's overflow.
Comment 10 Svata Dedic 2012-10-17 15:57:03 UTC
Changeset: 4dbab72bb677
Author:    Svata Dedic <sdedic@netbeans.org>
Date:      2012-10-17 17:57
Message:   Fixed behaviour on output buffer boundary/overflow
Comment 11 Quality Engineering 2012-10-18 02:04:50 UTC
Integrated into 'main-golden', will be available in build *201210180002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/4dbab72bb677
User: Svata Dedic <sdedic@netbeans.org>
Log: Issue #219447 - Error saving XML with LATIN character: fixed
Fixed behaviour on output buffer boundary/overflow
Comment 12 Tomas Zezula 2012-10-18 05:10:44 UTC
The fix seems good to me.
Comment 13 Svata Dedic 2012-10-24 06:34:22 UTC
*** Bug 220710 has been marked as a duplicate of this bug. ***
Comment 14 Milos Kleint 2012-10-29 08:45:16 UTC
*** Bug 219267 has been marked as a duplicate of this bug. ***
Comment 15 Milutin Kristofic 2013-06-05 14:21:06 UTC
*** Bug 226895 has been marked as a duplicate of this bug. ***