Skip to content

Cannot invoke "org.openide.filesystems.FileObject.getMIMEType()" #5626

@JQL

Description

@JQL

Apache NetBeans version

Apache NetBeans 17

What happened

I'm getting a java.lang.NullPointerException when opening a .JSON file in NetBeans. Note the file opens correctly just this Silent Error is thrown.

The error is:
Cannot invoke "org.openide.filesystems.FileObject.getMIMEType()" because "this.internalFo" is null

I believe it is because there are no Code Templates for JSON and the Code Templates window is open. Although not tested, I believe the same error will be thrown if other Code Templates sections don't have any code templates defined.

How to reproduce

  1. Open the Code Templates window (Window>Code Templates)
  2. Create a JSON file with some dummy JSON data and give the file the extension: .json
  3. In Tools>Options>Editor>Code Templates>JSON make sure there are no templates
  4. Open the .json file in NetBeans.
  5. Silent Error (Unexpected Exception) is thrown

Did this work correctly in an earlier version?

No / Don't know

Operating System

Linux Mint 19.3 Cinnamon - Linux Kernel 5.4.0-144-generic

JDK

openjdk version "17.0.6" 2023-01-17 OpenJDK Runtime Environment (build 17.0.6+10-Ubuntu-0ubuntu118.04.1)

Apache NetBeans packaging

Apache NetBeans provided installer

Anything else

This error can be eliminated by adding a Code Template to the Code Templates (JSON) section.

Are you willing to submit a pull request?

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions