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 270998 - NullPointerException at org.netbeans.modules.javascript2.editor.formatter.JsFormatVisitor.getStart
Summary: NullPointerException at org.netbeans.modules.javascript2.editor.formatter.JsF...
Status: NEW
Alias: None
Product: javascript
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.2
Hardware: All All
: P3 normal (vote)
Assignee: Petr Pisl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-06-29 12:22 UTC by sanhome
Modified: 2017-07-05 11:49 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 229570


Attachments
stacktrace (5.13 KB, text/plain)
2017-06-29 12:22 UTC, sanhome
Details

Note You need to log in before you can comment on or make changes to this bug.
Description sanhome 2017-06-29 12:22:50 UTC
This bug was originally marked as duplicate of bug 268660, that is already resolved. This bug is still valid, so this seems to be another bug, but it might be related.

Build: NetBeans IDE 8.2 (Build 201705191307)
VM: Java HotSpot(TM) 64-Bit Server VM, 25.102-b14, Java(TM) SE Runtime Environment, 1.8.0_102-b14
OS: Windows 10

User Comments:
GUEST: Working on a React JSX file doing code formatting.

GUEST: while formatting ES6

sanhome: JSX file editing

ralphbenjamin: format js code

sanhome: Formatting in JSX.
Open JSX file for editing, make some changes, hit Shift+Alt+F

GUEST: editing

GUEST: Problem

sanhome: Formatting of JSX code.

Gary.A.Peach: normal operation

GUEST: ?

Gary.A.Peach: formatting jsx

jmail: It was silent error - I do not know what has happened

GUEST: throw error when format javascript code of react.the code has include jsx tags,I think this error's reason is netbeans support react not perfect.

GUEST: An exception is thrown when I right click the mouse and select "Format". Code completion using TAB also don't work, for example if I type "cl" then TAB, an exception is also thrown.

var React = require('react');
var AddItem = React.createClass({
    render: function () {
        return (
                <form id="add-todo" onSubmit={this.handleSubmit}>
                 <input type="text" required ref="newItem"/>
                 <input type="submit" value="Hit me"/>
                </form>
                );
    },
    
    handleSubmit: function() {
        console.log(this.refs.newItem);
    }
});


module.exports = AddItem;

Gary.A.Peach: trying to format jsx




Stacktrace: 
java.lang.NullPointerException
   at org.netbeans.modules.javascript2.editor.formatter.JsFormatVisitor.getStart(JsFormatVisitor.java:1451)
   at org.netbeans.modules.javascript2.editor.formatter.JsFormatVisitor.enterJsxAttributeNode(JsFormatVisitor.java:218)
   at com.oracle.js.parser.ir.JsxAttributeNode.accept(JsxAttributeNode.java:66)
   at com.oracle.js.parser.ir.Node.accept(Node.java:280)
   at com.oracle.js.parser.ir.JsxElementNode.accept(JsxElementNode.java:85)
   at com.oracle.js.parser.ir.ReturnNode.accept(ReturnNode.java:74)
Comment 1 sanhome 2017-06-29 12:22:53 UTC
Created attachment 164656 [details]
stacktrace