Skip to content

Conversation

@mbien
Copy link
Member

@mbien mbien commented Oct 27, 2025

Don't dump the serialized form on DataObjectNotFoundException when a TopComponent can't be deserialized. This is often harmless and happens for example when an opened project moved while NB was closed. A single warning line should be sufficient.

Full exception is logged with FINE level.

example log line:

WARNING [org.netbeans.core.windows.persistence]: [PersistenceManager.getTopComponentForID] Problem when deserializing TopComponent for tcID:'MultiView-java#002Eso2D0988CFtext#002Ehistory#007C'. Reason: /tmp/mavenproject1/src/main/java/com/mycompany/mavenproject1/Mavenproject1.java@6051f4cb:671b4d0d[invalid]

open project -> close NB -> remove project -> start NB

as sidenote:
the original stack dump had several lines which just said "msg". Those were ResourceBundle keys which weren't substituted with the actual message. But substituting it might cause more harm than good (given the key name). I haven't seen this anywhere else so far. My guess is that the mechanism isn't used very often. In any case the hotfix would look like:

diff --git a/platform/openide.util/src/org/openide/util/Exceptions.java b/platform/openide.util/src/org/openide/util/Exceptions.java
index 65bdd7c..de07b22 100644
--- a/platform/openide.util/src/org/openide/util/Exceptions.java
+++ b/platform/openide.util/src/org/openide/util/Exceptions.java
@@ -304,10 +304,17 @@
                 return;
             }
             try {
-
                 for (LogRecord log : r) {
-                    if (log.getMessage() != null) {
-                        a.append(log.getMessage()).append("\n");
+                    String msg = log.getMessage();
+                    if (msg != null) {
+                        ResourceBundle rb = log.getResourceBundle();
+                        if (rb != null) {
+                            String localized = rb.getString(msg);
+                            if (localized != null) {
+                                msg = localized;
+                            }
+                        }
+                        a.append(msg).append("\n");
                     }
                     if (log.getThrown() != null) {
                         StringWriter w = new StringWriter();

Don't dump the serialized form on DataObjectNotFoundException when
a TopComponent can't be deserialized. This is often harmless and
happens for example when an opened project moved while NB was closed.
A single warning line should be sufficient.

Full exception is logged with FINE level.
@mbien mbien added this to the NB29 milestone Oct 27, 2025
@mbien mbien added Platform [ci] enable platform tests (platform/*) ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) labels Oct 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) Platform [ci] enable platform tests (platform/*)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant