Author: vrubezhny
Date: 2009-12-31 07:27:52 -0500 (Thu, 31 Dec 2009)
New Revision: 19637
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageContextFactory.java
Log:
JBIDE-5483: ConcurrentModificationException throws when open xhtml page
Getting and modifying the StyleSheet adapter is surrounded with synchronized block.
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageContextFactory.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageContextFactory.java 2009-12-31
11:43:08 UTC (rev 19636)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageContextFactory.java 2009-12-31
12:27:52 UTC (rev 19637)
@@ -713,25 +713,25 @@
* @return
*/
private CSSStyleSheetDescriptor getSheetForTagAttribute(final Node stylesContainer,
String attribute) {
-
INodeNotifier notifier = (INodeNotifier) stylesContainer;
-
- IStyleSheetAdapter adapter = (IStyleSheetAdapter) notifier
- .getAdapterFor(IStyleSheetAdapter.class);
-
- if (!(adapter instanceof ExtendedLinkElementAdapter)) {
- notifier.removeAdapter(adapter);
- adapter = new ExtendedLinkElementAdapter(
- (Element) stylesContainer, attribute);
- notifier.addAdapter(adapter);
- }
-
CSSStyleSheet sheet = null;
String source = null;
- if (adapter != null) {
- sheet = (CSSStyleSheet) adapter.getSheet();
- source = ((ExtendedLinkElementAdapter)adapter).getSource();
+ synchronized (notifier) {
+ IStyleSheetAdapter adapter = (IStyleSheetAdapter)
notifier.getAdapterFor(IStyleSheetAdapter.class);
+
+ if (!(adapter instanceof ExtendedLinkElementAdapter)) {
+ notifier.removeAdapter(adapter);
+ adapter = new ExtendedLinkElementAdapter(
+ (Element) stylesContainer, attribute);
+ notifier.addAdapter(adapter);
+ }
+
+ if (adapter != null) {
+ sheet = (CSSStyleSheet) adapter.getSheet();
+ source = ((ExtendedLinkElementAdapter)adapter).getSource();
+ }
+
}
return sheet == null || source == null ? null : new CSSStyleSheetDescriptor(source,
sheet);
@@ -743,16 +743,15 @@
* @return
*/
private CSSStyleSheet getSheetForTag(final Node stylesContainer) {
-
INodeNotifier notifier = (INodeNotifier) stylesContainer;
-
- IStyleSheetAdapter adapter = (IStyleSheetAdapter) notifier
- .getAdapterFor(IStyleSheetAdapter.class);
-
CSSStyleSheet sheet = null;
- if (adapter != null) {
- sheet = (CSSStyleSheet) adapter.getSheet();
+ synchronized (notifier) {
+ IStyleSheetAdapter adapter = (IStyleSheetAdapter)
notifier.getAdapterFor(IStyleSheetAdapter.class);
+
+ if (adapter != null) {
+ sheet = (CSSStyleSheet) adapter.getSheet();
+ }
}
return sheet;
Show replies by date