Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 135015 - NPE on formatting unbalanced braces
NPE on formatting unbalanced braces
Status: VERIFIED FIXED
Product: cnd
Classification: Unclassified
Component: Editor
6.x
All All
: P2 (vote)
: TBD
Assigned To: Alexander Simon
issues@cnd
formatting, 61fixes2-fixed
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-05-14 06:31 UTC by Alexander Simon
Modified: 2008-07-10 15:20 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Simon 2008-05-14 06:31:20 UTC
Code fragment:
-------------------------
#define FOR(n) for (int i = 0; i < n; i++) {

int g() {
    FOR(2);
        foo();
    }
}
-------------------------
Formatting result in NPE:
java.lang.NullPointerException
        at org.netbeans.modules.cnd.editor.reformat.ReformatterImpl.indentRbrace(ReformatterImpl.java:1161)
        at org.netbeans.modules.cnd.editor.reformat.ReformatterImpl.reformat(ReformatterImpl.java:368)
        at org.netbeans.modules.cnd.editor.reformat.Reformatter.reformatImpl(Reformatter.java:141)
        at org.netbeans.modules.cnd.editor.reformat.Reformatter.reformatImpl(Reformatter.java:127)
        at org.netbeans.modules.cnd.editor.reformat.Reformatter.reformatLanguage(Reformatter.java:107)
        at org.netbeans.modules.cnd.editor.reformat.Reformatter.reformatImpl(Reformatter.java:96)
        at org.netbeans.modules.cnd.editor.reformat.Reformatter.reformat(Reformatter.java:80)
        at org.netbeans.modules.editor.indent.TaskHandler$MimeItem.runTask(TaskHandler.java:504)
        at org.netbeans.modules.editor.indent.TaskHandler.runTasks(TaskHandler.java:271)
        at org.netbeans.modules.editor.indent.IndentImpl.reformat(IndentImpl.java:293)
        at org.netbeans.modules.editor.indent.FormatterImpl.reformat(FormatterImpl.java:161)
        at org.netbeans.modules.cnd.editor.cplusplus.CCKit$CCFormatAction.actionPerformed(CCKit.java:288)
...
Comment 1 Alexander Simon 2008-05-14 06:59:34 UTC
fixed
http://hg.netbeans.org/main/rev/b66212835033
Comment 2 Alexander Pepin 2008-05-20 10:59:18 UTC
verified in build 20080520
Comment 3 jinb 2008-05-29 13:16:22 UTC
fix backported into release61_fixes branch
changeset:   77603:886951659f02


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo