Skip to content

Commit 7c9c7a7

Browse files
authored
Merge pull request #414 from Achal1607/class-cast-exception
Handling class cast exception while opening pom.xml file
2 parents 8166db6 + fae5358 commit 7c9c7a7

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

build.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
patches/8289.diff
5959
patches/7893-draft.diff
6060
patches/8442-draft.diff
61+
patches/8460-draft.diff
6162
patches/disable-error-notification.diff
6263
patches/mvn-sh.diff
6364
patches/project-marker-jdk.diff

patches/8460-draft.diff

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
--- a/java/maven.hints/src/org/netbeans/modules/maven/hints/pom/MavenPOMParser.java
2+
+++ b/java/maven.hints/src/org/netbeans/modules/maven/hints/pom/MavenPOMParser.java
3+
@@ -23,6 +23,7 @@
4+
import java.util.prefs.PreferenceChangeListener;
5+
import java.util.prefs.Preferences;
6+
import javax.swing.event.ChangeListener;
7+
+import javax.swing.text.Document;
8+
import org.netbeans.api.editor.mimelookup.MimeRegistration;
9+
import org.netbeans.editor.BaseDocument;
10+
import org.netbeans.modules.maven.embedder.EmbedderFactory;
11+
@@ -76,9 +77,9 @@
12+
return;
13+
}
14+
//#236116 passing document protects from looking it up later and causing a deadlock.
15+
- final BaseDocument document = (BaseDocument)snapshot.getSource().getDocument(false);
16+
+ final Document document = snapshot.getSource().getDocument(false);
17+
final DataObject d = sFile.getLookup().lookup(DataObject.class);
18+
- ModelSource ms = Utilities.createModelSource(sFile, d, document);
19+
+ ModelSource ms = Utilities.createModelSource(sFile, d, document instanceof BaseDocument bd ? bd : null);
20+
synchronized (this) {
21+
theModel = POMModelFactory.getDefault().getModel(ms);
22+
lastSnapshot = snapshot;

0 commit comments

Comments
 (0)