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.editor.global.format.GlobalFormatAction.doFormat(GlobalFormatAction.java:240) at org.netbeans.modules.editor.global.format.GlobalFormatAction.access$000(GlobalFormatAction.java:102) at org.netbeans.modules.editor.global.format.GlobalFormatAction$ProgressRunnableImpl.run(GlobalFormatAction.java:361) at org.netbeans.modules.progress.ui.RunOffEDTImpl$ProgressBackgroundRunner$RunnablePR.run(RunOffEDTImpl.java:481) at org.netbeans.modules.progress.ui.RunOffEDTImpl$ProgressBackgroundRunner.runBackground(RunOffEDTImpl.java:458) at org.netbeans.modules.progress.ui.AbstractWindowRunner.call(AbstractWindowRunner.java:108) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1454) at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2036) Caused: java.util.concurrent.ExecutionException: java.lang.IllegalStateException: Current state = FLUSHED, new state = CODING_END at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:252) at java.util.concurrent.FutureTask.get(FutureTask.java:111) at org.netbeans.modules.progress.ui.RunOffEDTImpl.showProgressDialogAndRun(RunOffEDTImpl.java:373) at org.netbeans.api.progress.ProgressUtils.showProgressDialogAndRun(ProgressUtils.java:138) at org.netbeans.modules.editor.global.format.GlobalFormatAction.actionPerformed(GlobalFormatAction.java:111) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.AbstractButton.doClick(AbstractButton.java:376) at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:833) at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:877) at java.awt.Component.processMouseEvent(Component.java:6505) at javax.swing.JComponent.processMouseEvent(JComponent.java:3321) at java.awt.Component.processEvent(Component.java:6270) at java.awt.Container.processEvent(Container.java:2229) at java.awt.Component.dispatchEventImpl(Component.java:4861) at java.awt.Container.dispatchEventImpl(Container.java:2287) at java.awt.Component.dispatchEvent(Component.java:4687) at java.awt.LightweightDispatcher.retargetMouseEvent(LightweightDispatcher.java:4832) at java.awt.LightweightDispatcher.processMouseEvent(LightweightDispatcher.java:4492) at java.awt.LightweightDispatcher.dispatchEvent(LightweightDispatcher.java:4422) at java.awt.Container.dispatchEventImpl(Container.java:2273) at java.awt.Window.dispatchEventImpl(Window.java:2719) at java.awt.Component.dispatchEvent(Component.java:4687) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:703) at java.awt.EventQueue.access$000(EventQueue.java:102) at java.awt.EventQueue$3.run(EventQueue.java:662) at java.awt.EventQueue$3.run(EventQueue.java:660) at java.security.AccessController.doPrivileged(AccessController.java:0) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87) at java.awt.EventQueue$4.run(EventQueue.java:676) at java.awt.EventQueue$4.run(EventQueue.java:674) at java.security.AccessController.doPrivileged(AccessController.java:0) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) at java.awt.EventQueue.dispatchEvent(EventQueue.java:673) at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:158) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139) at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)