apache / netbeans

Apache NetBeans
https://netbeans.apache.org/
Apache License 2.0
2.67k stars 855 forks source link

java.lang.NullPointerException: Cannot invoke "javax.swing.text.AttributeSet.getAttribute(Object)" #4479

Open filipe-maia opened 2 years ago

filipe-maia commented 2 years ago

Apache NetBeans version

Apache NetBeans 14

What happened

Started NetBeans and got a notification saying: "A java.lang.NullPointerException exception has occurred. Please report this at https://netbeans.apache.org/nb/report-issue, including a copy of your messages.log file as an attachment. The messages.log file is located in your C:\Users***\AppData\Roaming\NetBeans\14\var\log folder."

java.lang.NullPointerException: Cannot invoke "javax.swing.text.AttributeSet.getAttribute(Object)" because "attr" is null at org.netbeans.modules.editor.fold.ui.CodeFoldingSideBar.resolveBackColor(CodeFoldingSideBar.java:353) at org.netbeans.modules.editor.fold.ui.CodeFoldingSideBar.updateColors(CodeFoldingSideBar.java:368) at org.netbeans.modules.editor.fold.ui.CodeFoldingSideBar.access$200(CodeFoldingSideBar.java:99) at org.netbeans.modules.editor.fold.ui.CodeFoldingSideBar$2.preferenceChange(CodeFoldingSideBar.java:231) at org.netbeans.modules.editor.fold.ui.CodeFoldingSideBar.addNotify(CodeFoldingSideBar.java:287) at java.desktop/java.awt.Container.addNotify(Container.java:2804) at java.desktop/javax.swing.JComponent.addNotify(JComponent.java:4839) at org.netbeans.modules.editor.impl.CustomizableSideBar$WestSidebarHolder.addNotify(CustomizableSideBar.java:288) at java.desktop/java.awt.Container.addNotify(Container.java:2804) at java.desktop/javax.swing.JComponent.addNotify(JComponent.java:4839) at java.desktop/java.awt.Container.addNotify(Container.java:2804) at java.desktop/javax.swing.JComponent.addNotify(JComponent.java:4839) at java.desktop/java.awt.Container.addNotify(Container.java:2804) at java.desktop/javax.swing.JComponent.addNotify(JComponent.java:4839) at java.desktop/java.awt.Container.addNotify(Container.java:2804) at java.desktop/javax.swing.JComponent.addNotify(JComponent.java:4839) at java.desktop/java.awt.Container.addNotify(Container.java:2804) at java.desktop/javax.swing.JComponent.addNotify(JComponent.java:4839) at java.desktop/java.awt.Container.addNotify(Container.java:2804) at java.desktop/javax.swing.JComponent.addNotify(JComponent.java:4839) at java.desktop/javax.swing.JRootPane.addNotify(JRootPane.java:729) at java.desktop/java.awt.Container.addNotify(Container.java:2804) at java.desktop/java.awt.Window.addNotify(Window.java:791) at java.desktop/java.awt.Frame.addNotify(Frame.java:495) at java.desktop/java.awt.Window.pack(Window.java:829) at org.netbeans.modules.java.editor.JavaEditorWarmUpTask.run(JavaEditorWarmUpTask.java:269) at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318) at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:771) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:722) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:716) at java.base/java.security.AccessController.doPrivileged(AccessController.java:399) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:741) at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:136) [catch] at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90

messages.log messages1.log messages2.log

How to reproduce

Just started NetBeans 14 after updating from 12.0 to 14 and after importing 12.0 definitions.

Did this work correctly in an earlier version?

No / Don't know

Operating System

Win10 64bit

JDK

OpenJDK17.0.2

Apache NetBeans packaging

Apache NetBeans binary zip

Anything else

No response

Are you willing to submit a pull request?

No

Code of Conduct

Yes

filipe-maia commented 2 years ago

This bug is not urgent, I think.

filipe-maia commented 2 years ago

At the same time, another notification I got was:

A java.io.FileNotFoundException exception has occurred. However, the system should continue working without further problems. Click Show Details for the stack trace.

Annotation: From: nbfs://nbhost/SystemFileSystem/org-netbeans-api-project-libraries/Libraries/restapi.xml Annotation: From: nbfs://nbhost/SystemFileSystem/org-netbeans-api-project-libraries/Libraries/restapi.xml Annotation: From: nbfs://nbhost/SystemFileSystem/org-netbeans-api-project-libraries/Libraries/restapi.xml From: nbfs://nbhost/SystemFileSystem/org-netbeans-api-project-libraries/Libraries/restapi.xml From: nbfs://nbhost/SystemFileSystem/org-netbeans-api-project-libraries/Libraries/restapi.xml Caused: java.nio.file.NoSuchFileException: C:\desenv-java\NetBeans IDE\14\enterprise\modules\org-netbeans-modules-websvc-restlib.jar at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:85) at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103) at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108) at java.base/sun.nio.fs.WindowsFileAttributeViews$Basic.readAttributes(WindowsFileAttributeViews.java:53) at java.base/sun.nio.fs.WindowsFileAttributeViews$Basic.readAttributes(WindowsFileAttributeViews.java:38) at java.base/sun.nio.fs.WindowsFileSystemProvider.readAttributes(WindowsFileSystemProvider.java:199) at java.base/java.nio.file.Files.readAttributes(Files.java:1851) at java.base/java.util.zip.ZipFile$Source.get(ZipFile.java:1264) at java.base/java.util.zip.ZipFile$CleanableResource.(ZipFile.java:709) at java.base/java.util.zip.ZipFile.(ZipFile.java:243) at java.base/java.util.zip.ZipFile.(ZipFile.java:172) at java.base/java.util.jar.JarFile.(JarFile.java:347) at java.base/sun.net.www.protocol.jar.URLJarFile.(URLJarFile.java:103) at java.base/sun.net.www.protocol.jar.URLJarFile.getJarFile(URLJarFile.java:72) at java.base/sun.net.www.protocol.jar.JarFileFactory.get(JarFileFactory.java:191) at java.base/sun.net.www.protocol.jar.JarFileFactory.getOrCreate(JarFileFactory.java:91) at java.base/sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:132) at java.base/sun.net.www.protocol.jar.JarURLConnection.getInputStream(JarURLConnection.java:175) at org.netbeans.core.startup.layers.BinaryFS$BFSFile.getInputStream(BinaryFS.java:863) Caused: java.io.FileNotFoundException: Cannot find 'jar:file:/C:/desenv-java/NetBeans%20IDE/14/enterprise/modules/org-netbeans-modules-websvc-restlib.jar!/org/netbeans/modules/websvc/swdp/restapi.xml' at org.netbeans.core.startup.layers.BinaryFS$BFSFile.getInputStream(BinaryFS.java:866) at org.openide.filesystems.MultiFileObject.getInputStream(MultiFileObject.java:640) at org.openide.filesystems.MultiFileObject.getInputStream(MultiFileObject.java:640) at org.netbeans.modules.project.libraries.LibrariesStorage$1.call(LibrariesStorage.java:261) at org.netbeans.modules.project.libraries.LibrariesStorage$1.call(LibrariesStorage.java:256) at org.netbeans.modules.project.libraries.FileLockManager.readAction(FileLockManager.java:53) at org.netbeans.modules.project.libraries.LibrariesStorage.readLibrary(LibrariesStorage.java:254) [catch] at org.netbeans.modules.project.libraries.LibrariesStorage.loadFromStorage(LibrariesStorage.java:142) at org.netbeans.modules.project.libraries.LibrariesStorage.initStorage(LibrariesStorage.java:219) at org.netbeans.modules.project.libraries.LibrariesStorage.stateChanged(LibrariesStorage.java:563) at org.openide.util.ChangeSupport.fireChange(ChangeSupport.java:108) at org.openide.util.ChangeSupport.fireChange(ChangeSupport.java:94) at org.netbeans.modules.project.libraries.LibraryTypeRegistry.fireChange(LibraryTypeRegistry.java:60) at org.netbeans.modules.project.libraries.LibraryTypeRegistryImpl$1.resultChanged(LibraryTypeRegistryImpl.java:50) at org.openide.util.lookup.AbstractLookup$NotifyListeners.run(AbstractLookup.java:517) at org.openide.loaders.FolderLookup$Dispatch.run(FolderLookup.java:289) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418) at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45) at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278) at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)

Maybe this was caused by some plugin imported from version 12.0 to 14.

filipe-maia commented 2 years ago

After further testing, the first notification appears everytime I try to open a XHTML file, and NetBeans won't open that XHTML file.

kuvalda4g commented 1 year ago

Same error in Apache NetBeans 17 and OpenJDK 17.0.7+7-LTS. NetBeans won't open any file.

java.lang.NullPointerException: Cannot invoke "javax.swing.text.AttributeSet.getAttribute(Object)" because "as" is null at org.netbeans.editor.Coloring.toFont(Coloring.java:795) at org.netbeans.editor.Coloring.fromAttributeSet(Coloring.java:758) at com.junichi11.netbeans.modules.color.codes.preview.ui.DrawingPanel.updateColors(DrawingPanel.java:307) at com.junichi11.netbeans.modules.color.codes.preview.ui.DrawingPanel.(DrawingPanel.java:108) at com.junichi11.netbeans.modules.color.codes.preview.ui.DrawingPanel.create(DrawingPanel.java:97) at com.junichi11.netbeans.modules.color.codes.preview.ui.ColorsSideBarPanel.(ColorsSideBarPanel.java:32) at com.junichi11.netbeans.modules.color.codes.preview.ui.ColorsSideBarFactory.createSideBar(ColorsSideBarFactory.java:37) at org.netbeans.modules.editor.impl.CustomizableSideBar.createSideBarsMap(CustomizableSideBar.java:404) at org.netbeans.modules.editor.impl.CustomizableSideBar.getSideBarsInternal(CustomizableSideBar.java:180) at org.netbeans.modules.editor.impl.CustomizableSideBar.getSideBars(CustomizableSideBar.java:143) at org.netbeans.modules.editor.NbEditorUI.createExtComponent(NbEditorUI.java:263) at org.netbeans.editor.EditorUI.getExtComponent(EditorUI.java:934) at org.netbeans.modules.editor.NbEditorDocument.createEditor(NbEditorDocument.java:176) at org.openide.text.CloneableEditorInitializer.initCustomEditor(CloneableEditorInitializer.java:511) at org.openide.text.CloneableEditorInitializer.initCustomEditorAndDecorationsInEDT(CloneableEditorInitializer.java:573) [catch] at org.openide.text.CloneableEditorInitializer.run(CloneableEditorInitializer.java:321) at org.openide.text.CloneableEditorInitializer.processPendingEDTRequests(CloneableEditorInitializer.java:135) at org.openide.text.CloneableEditorInitializer$1.run(CloneableEditorInitializer.java:84) at org.netbeans.core.windows.WindowManagerImpl$Exclusive$1.run(WindowManagerImpl.java:1611) at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45) at org.openide.util.lookup.Lookups.executeWith(Lookups.java:287) at org.netbeans.modules.openide.util.NbMutexEventProvider$Event.lambda$doEventRequest$1(NbMutexEventProvider.java:112) at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318) at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:771) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:722) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:716) at java.base/java.security.AccessController.doPrivileged(AccessController.java:399) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:741) at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:136) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

PhuQuy2210 commented 1 year ago

How to fix this error? java.lang.NullPointerException: Cannot invoke "javax.swing.text.AttributeSet.getAttribute(Object)" because "attr" is null at org.netbeans.modules.editor.fold.ui.CodeFoldingSideBar.resolveBackColor(CodeFoldingSideBar.java:353) at org.netbeans.modules.editor.fold.ui.CodeFoldingSideBar.updateColors(CodeFoldingSideBar.java:368) at org.netbeans.modules.editor.fold.ui.CodeFoldingSideBar.access$200(CodeFoldingSideBar.java:99) at org.netbeans.modules.editor.fold.ui.CodeFoldingSideBar$2.preferenceChange(CodeFoldingSideBar.java:231) at org.netbeans.modules.editor.fold.ui.CodeFoldingSideBar.addNotify(CodeFoldingSideBar.java:287) at java.desktop/java.awt.Container.addNotify(Container.java:2804) at java.desktop/javax.swing.JComponent.addNotify(JComponent.java:4846) at org.netbeans.modules.editor.impl.CustomizableSideBar$WestSidebarHolder.addNotify(CustomizableSideBar.java:288) at java.desktop/java.awt.Container.addNotify(Container.java:2804) at java.desktop/javax.swing.JComponent.addNotify(JComponent.java:4846) at java.desktop/java.awt.Container.addNotify(Container.java:2804) at java.desktop/javax.swing.JComponent.addNotify(JComponent.java:4846) at java.desktop/java.awt.Container.addNotify(Container.java:2804) at java.desktop/javax.swing.JComponent.addNotify(JComponent.java:4846) at java.desktop/java.awt.Container.addImpl(Container.java:1150) at java.desktop/java.awt.Container.add(Container.java:1001) at org.openide.text.CloneableEditorInitializer.initCustomEditor(CloneableEditorInitializer.java:523) at org.openide.text.CloneableEditorInitializer.initCustomEditorAndDecorationsInEDT(CloneableEditorInitializer.java:573) [catch] at org.openide.text.CloneableEditorInitializer.run(CloneableEditorInitializer.java:321) at org.openide.text.CloneableEditorInitializer.processPendingEDTRequests(CloneableEditorInitializer.java:135) at org.openide.text.CloneableEditorInitializer.waitForFinishedInitialization(CloneableEditorInitializer.java:103) at org.openide.text.CloneableEditor.getEditorPane(CloneableEditor.java:673) at org.netbeans.core.multiview.MultiViewCloneableTopComponent.getEditorPane(MultiViewCloneableTopComponent.java:274) at org.openide.text.CloneableEditorSupport.getOpenedPanes(CloneableEditorSupport.java:830) at org.netbeans.modules.nbform.FormEditorSupport.isJavaEditorDisplayed(FormEditorSupport.java:1198) at org.netbeans.modules.form.JavaCodeGenerator$FormListener.formChanged(JavaCodeGenerator.java:4037) at org.netbeans.modules.form.FormModel.fireEvents(FormModel.java:1312) at org.netbeans.modules.form.FormModel.fireEventBatch(FormModel.java:1285) at org.netbeans.modules.form.FormModel.firePendingEvents(FormModel.java:1248) at org.netbeans.modules.form.FormModel.access$000(FormModel.java:43) at org.netbeans.modules.form.FormModel$2.run(FormModel.java:1225) at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318) at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714) at java.base/java.security.AccessController.doPrivileged(AccessController.java:400) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87) at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742) at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:136) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

Ghlent commented 4 months ago

I found this error after my pc ran out of battery and the drive where I had NetBeans got disconnected. Seems like the cache got corrupted, because deleting NetBeans' cache and restarting it fixed the problem