diff options
author | Nitin Dahyabhai | 2019-11-26 21:47:30 +0000 |
---|---|---|
committer | Nitin Dahyabhai | 2019-11-26 21:47:30 +0000 |
commit | 6035364c199e699116578aa7517103da1c384b6e (patch) | |
tree | cfafba39816354d73902ec7979a2fbefd6b7c6d7 | |
parent | 0c2dc0c65b931ad970c648cbf22e2f79f2695f9b (diff) | |
download | webtools.sourceediting-6035364c199e699116578aa7517103da1c384b6e.tar.gz webtools.sourceediting-6035364c199e699116578aa7517103da1c384b6e.tar.xz webtools.sourceediting-6035364c199e699116578aa7517103da1c384b6e.zip |
[539420] NPE on each key press while editing XML file
-rw-r--r-- | xml/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/ValidationInfo.java | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/xml/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/ValidationInfo.java b/xml/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/ValidationInfo.java index 77ff946bb1..2b1bed78d8 100644 --- a/xml/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/ValidationInfo.java +++ b/xml/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/ValidationInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2001, 2016 IBM Corporation and others. + * Copyright (c) 2001, 2019 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -242,19 +242,23 @@ public class ValidationInfo implements ValidationReport return sameFilePreferenceContext; } - private IScopeContext[] createPreferenceScopes(URL url) { - IProject p = null; - try { - URI uri = new URI(url.toString()); - IFile[] matching = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocationURI(uri); - if( matching != null && matching.length > 0 ) { - p = matching[0].getProject(); - } - } catch(URISyntaxException urie) { - // shouldn't happen, but ignore - } - return createPreferenceScopesFromProject(p); - } + private IScopeContext[] createPreferenceScopes(URL url) { + IProject p = null; + // on null, fall through to non-project-specific defaults + if (url == null) { + try { + URI uri = new URI(url.toString()); + IFile[] matching = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocationURI(uri); + if (matching != null && matching.length > 0) { + p = matching[0].getProject(); + } + } + catch (URISyntaxException urie) { + // shouldn't happen, but ignore + } + } + return createPreferenceScopesFromProject(p); + } private IScopeContext[] createPreferenceScopesFromProject(IProject project) { if (project != null && project.isAccessible()) { final ProjectScope projectScope = new ProjectScope(project); |