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 216585 - NullPointerException at org.netbeans.modules.php.editor.indent.TokenFormatter$1.countWhiteSpaceBeforeLeftBrace
Summary: NullPointerException at org.netbeans.modules.php.editor.indent.TokenFormatter...
Status: VERIFIED FIXED
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.2
Hardware: All All
: P3 normal (vote)
Assignee: Ondrej Brejla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-09 11:16 UTC by Exceptions Reporter
Modified: 2012-09-05 09:40 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 190611


Attachments
stacktrace (2.50 KB, text/plain)
2012-08-09 11:16 UTC, Exceptions Reporter
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Exceptions Reporter 2012-08-09 11:16:18 UTC
Build: NetBeans IDE 7.2 (Build 201207301726)
VM: Java HotSpot(TM) Client VM, 20.1-b02, Java(TM) SE Runtime Environment, 1.6.0_26-b03
OS: Linux

User Comments:
GUEST: Called Format Text from Source menu.

gahgneh: typed inside function { 
  {cursor here} 
}
a code template

gahgneh: auto-complete is randomly broken, the exception happens either on code-template or code completion

GUEST: PHP????"??? > ??"?????????????????????




Stacktrace: 
java.lang.NullPointerException
   at org.netbeans.modules.php.editor.indent.TokenFormatter$1.countWhiteSpaceBeforeLeftBrace(TokenFormatter.java:1445)
   at org.netbeans.modules.php.editor.indent.TokenFormatter$1.run(TokenFormatter.java:484)
   at org.netbeans.editor.GuardedDocument.runAtomic(GuardedDocument.java:317)
   at org.netbeans.modules.php.editor.indent.TokenFormatter.reformat(TokenFormatter.java:344)
   at org.netbeans.modules.php.editor.indent.PHPFormatter.reformat(PHPFormatter.java:96)
   at org.netbeans.modules.csl.core.GsfReformatTask$1.run(GsfReformatTask.java:105)
Comment 1 Exceptions Reporter 2012-08-09 11:16:21 UTC
Created attachment 122918 [details]
stacktrace
Comment 2 Ondrej Brejla 2012-08-09 11:41:13 UTC
Reproducible.
Comment 3 Ondrej Brejla 2012-08-09 11:43:49 UTC
Reproducible use case:

Set Tools -> Options -> Editor -> Formatting -> PHP -> Braces -> "try catch" to "Preserve existing"

<?php
function b() {
try{
// here invoke "fnc" code template
}catch (Exception $exc) {echo $exc->getTraceAsString();}
}
?>
Comment 4 Ondrej Brejla 2012-08-09 12:51:21 UTC
Fixed in web-main #4ea97e5b4547

Vlado, please, verify it for 7.2 patch 1. Thanks.
Comment 5 Quality Engineering 2012-08-10 02:25:07 UTC
Integrated into 'main-golden', will be available in build *201208100001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/4ea97e5b4547
User: Ondrej Brejla <obrejla@netbeans.org>
Log: #216585 - NullPointerException at org.netbeans.modules.php.editor.indent.TokenFormatter$1.countWhiteSpaceBeforeLeftBrace
Comment 6 Vladimir Riha 2012-08-10 10:44:28 UTC
verified in trunk

Product Version: NetBeans IDE Dev (Build 201208100001)
Java: 1.7.0_06; Java HotSpot(TM) Client VM 23.2-b09
System: Linux version 3.0.0-23-generic-pae running on i386; UTF-8; en_US (nb)
Comment 7 Ondrej Brejla 2012-08-13 10:12:00 UTC
Integrated into releases #c1f31bc03c31
Comment 8 Quality Engineering 2012-09-01 11:09:01 UTC
Integrated into 'releases', will be available in build *201209010822* or newer. Wait for official and publicly available build.
Changeset: http://hg.netbeans.org/releases/rev/c1f31bc03c31
User: Ondrej Brejla <obrejla@netbeans.org>
Log: #216585 - NullPointerException at org.netbeans.modules.php.editor.indent.TokenFormatter$1.countWhiteSpaceBeforeLeftBrace
(transplanted from 4ea97e5b4547e92f6386bfd717e03a644972b6a8)
Comment 9 Vladimir Riha 2012-09-05 09:40:33 UTC
verified in patch


Product Version: NetBeans IDE 7.2 (Build 201207171143)
Java: 1.7.0_06; Java HotSpot(TM) Client VM 23.2-b09
System: Linux version 3.2.0-29-generic-pae running on i386; UTF-8; en_US (nb)