welovecoding / editorconfig-netbeans

A NetBeans IDE plugin supporting the EditorConfig standard. ⛺
https://editorconfig.org/
MIT License
126 stars 22 forks source link

Error when saving new section (like [*.js]) in .editorconfig #41

Closed bennycode closed 9 years ago

bennycode commented 9 years ago

Log

INFO [EditorConfigProcessor]: Update changes in Editor window for: Q:/dev/projects/trash/My HTML5 application/public_html/.editorconfig SEVERE [org.openide.util.Exceptions] java.lang.NullPointerException at com.welovecoding.netbeans.plugin.editorconfig.io.writer.StyledDocumentWriter.writeWithEditorKit(StyledDocumentWriter.java:139) at com.welovecoding.netbeans.plugin.editorconfig.processor.EditorConfigProcessor.lambda$null$0(EditorConfigProcessor.java:239) at com.welovecoding.netbeans.plugin.editorconfig.processor.EditorConfigProcessor$$Lambda$32/1554876959.run(Unknown Source) at org.netbeans.editor.GuardedDocument.runAtomic(GuardedDocument.java:323) at org.openide.text.NbDocument.runAtomic(NbDocument.java:436)

Null pointer occurs on

kit.read(is, document, document.getLength());

bennycode commented 9 years ago

Steps to reproduce:

Add this content:

root = true

[*.xml]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

Error:

INFO [EditorConfigProcessor]: Mapped rules for: Q:/dev/projects/welovecoding/editorconfig-netbeans/target/classes/com/welovecoding/nbeditorconfig/FontAndColors.xml
1. charset: UTF-8
2. end_of_line: null
3. indent_size: 2
4. indent_style: space
5. insert_final_newline: true
6. tab_width: 2
7. trim_trailing_whitespace: true
INFO [EditorConfigProcessor]: "charset": UTF-8 (Q:/dev/projects/welovecoding/editorconfig-netbeans/target/classes/com/welovecoding/nbeditorconfig/FontAndColors.xml)
INFO [CharsetOperation]: ¬ Current charset: ISO-8859-1
INFO [CharsetOperation]: ¬ Changing charset from "ISO-8859-1" to "UTF-8"
INFO [EditorConfigProcessor]: "indent_size": 2 (Q:/dev/projects/welovecoding/editorconfig-netbeans/target/classes/com/welovecoding/nbeditorconfig/FontAndColors.xml)
INFO [IndentSizeOperation]: ¬ Current value: 2
INFO [IndentSizeOperation]: ¬ New value: 2
INFO [IndentSizeOperation]: ¬ No change needed
INFO [EditorConfigProcessor]: "indent_style": space (Q:/dev/projects/welovecoding/editorconfig-netbeans/target/classes/com/welovecoding/nbeditorconfig/FontAndColors.xml)
INFO [IndentSizeOperation]: ¬ Current value: true
INFO [IndentSizeOperation]: ¬ New value: true
INFO [IndentSizeOperation]: ¬ No change needed
INFO [EditorConfigProcessor]: "insert_final_newline": true (Q:/dev/projects/welovecoding/editorconfig-netbeans/target/classes/com/welovecoding/nbeditorconfig/FontAndColors.xml)
INFO [FinalNewLineOperation]: ¬ Added final new line
INFO [EditorConfigProcessor]: "trim_trailing_whitespace": true (Q:/dev/projects/welovecoding/editorconfig-netbeans/target/classes/com/welovecoding/nbeditorconfig/FontAndColors.xml)
INFO [TrimTrailingWhiteSpaceOperation]: ¬ Content length until caret: 0
INFO [TrimTrailingWhiteSpaceOperation]: ¬ Trimmed content length: 0
INFO [TrimTrailingWhiteSpaceOperation]: ¬ Caret offset: 0
INFO [TrimTrailingWhiteSpaceOperation]: ¬ Trimmed whitespaces
INFO [EditorConfigProcessor]: Flush file changes for: Q:/dev/projects/welovecoding/editorconfig-netbeans/target/classes/com/welovecoding/nbeditorconfig/FontAndColors.xml
INFO [EditorConfigProcessor]: Write content (with all rules applied) to file: Q:/dev/projects/welovecoding/editorconfig-netbeans/target/classes/com/welovecoding/nbeditorconfig/FontAndColors.xml
INFO [StyledDocumentWriter]: Write to "is": java.io.ByteArrayInputStream@4243114c
INFO [StyledDocumentWriter]: Write to "document": java.io.ByteArrayInputStream@4243114c
SEVERE [global]
java.lang.NullPointerException
    at com.welovecoding.netbeans.plugin.editorconfig.io.writer.StyledDocumentWriter.writeWithEditorKit(StyledDocumentWriter.java:135)
    at com.welovecoding.netbeans.plugin.editorconfig.processor.EditorConfigProcessor.lambda$null$1(EditorConfigProcessor.java:251)
    at com.welovecoding.netbeans.plugin.editorconfig.processor.EditorConfigProcessor$$Lambda$34/2041107524.run(Unknown Source)
    at org.netbeans.editor.GuardedDocument.runAtomic(GuardedDocument.java:323)
    at org.openide.text.NbDocument.runAtomic(NbDocument.java:436)
    at com.welovecoding.netbeans.plugin.editorconfig.processor.EditorConfigProcessor.lambda$updateChangesInEditorWindow$2(EditorConfigProcessor.java:249)
    at com.welovecoding.netbeans.plugin.editorconfig.processor.EditorConfigProcessor$$Lambda$33/1295722535.run(Unknown Source)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:744)
    at java.awt.EventQueue.access$400(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:697)
    at java.awt.EventQueue$3.run(EventQueue.java:691)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:714)
    at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:159)
[catch] at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
INFO [FileChangeListener]: Attribute changed: Q:/dev/projects/welovecoding/editorconfig-netbeans/target/classes/com/welovecoding/nbeditorconfig/FontAndColors.xml
INFO [FileChangeListener]: File content changed: Q:/dev/projects/welovecoding/editorconfig-netbeans/target/classes/com/welovecoding/nbeditorconfig/FontAndColors.xml
INFO [EditorConfigProcessor]: Apply rules to file: Q:/dev/projects/welovecoding/editorconfig-netbeans/target/classes/com/welovecoding/nbeditorconfig/FontAndColors.xml (MIME type: text/x-nbeditor-fontcolorsettings)
bennycode commented 9 years ago

During my bug I tried to change FontAndColors.xml. NetBeans created a file called .LCKFontAndColors.xml~ when the bug occured.

StyledDocumentWriter.java:135 is kit.read(is, document, document.getLength());

Yserz commented 9 years ago

Did your last commit fixed that issue?

bennycode commented 9 years ago

Fixed with https://github.com/welovecoding/editorconfig-netbeans/issues/57.