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 135015 - NPE on formatting unbalanced braces
Summary: NPE on formatting unbalanced braces
Status: VERIFIED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Editor (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Alexander Simon
URL:
Keywords:
Depends on:
Blocks:
 
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
Exception Reporter:


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