Skip to content

Commit f743a7a

Browse files
committed
Use own Parser in UpdateUnitVersions to avoid concurrency problems
Fixes: #666
1 parent fd130c0 commit f743a7a

File tree

1 file changed

+10
-1
lines changed
  • ui/org.eclipse.pde.genericeditor.extension/src/org/eclipse/pde/internal/genericeditor/target/extension/command

1 file changed

+10
-1
lines changed

ui/org.eclipse.pde.genericeditor.extension/src/org/eclipse/pde/internal/genericeditor/target/extension/command/UpdateUnitVersions.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141

4242
public class UpdateUnitVersions extends AbstractHandler {
4343

44+
private static Parser parser;
45+
4446
@Override
4547
public Object execute(ExecutionEvent event) throws ExecutionException {
4648
IDocument document = getDocument();
@@ -52,7 +54,7 @@ public Object execute(ExecutionEvent event) throws ExecutionException {
5254
return null;
5355
}
5456

55-
Parser parser = Parser.getDefault();
57+
Parser parser = parser();
5658
try {
5759
parser.parse(document);
5860
} catch (XMLStreamException e) {
@@ -144,4 +146,11 @@ private IDocument getDocument() {
144146
IEditorInput input = editor.getEditorInput();
145147
return provider.getDocument(input);
146148
}
149+
150+
private static synchronized Parser parser() {
151+
if (parser == null) {
152+
parser = new Parser();
153+
}
154+
return parser;
155+
}
147156
}

0 commit comments

Comments
 (0)