mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
XmlAttribute#getValue|getDisplayValue are @Nullable: fix some potential NPEs
This commit is contained in:
+3
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -86,7 +86,7 @@ public class AddSchemaPrefixIntention extends PsiElementBaseIntentionAction {
|
||||
tag.accept(new XmlRecursiveElementVisitor() {
|
||||
@Override
|
||||
public void visitXmlTag(XmlTag tag) {
|
||||
if (namespace.equals(tag.getNamespace()) && tag.getNamespacePrefix().length() == 0) {
|
||||
if (tag.getNamespace().equals(namespace) && tag.getNamespacePrefix().length() == 0) {
|
||||
tags.add(tag);
|
||||
}
|
||||
super.visitXmlTag(tag);
|
||||
@@ -109,7 +109,7 @@ public class AddSchemaPrefixIntention extends PsiElementBaseIntentionAction {
|
||||
if (xmlElement instanceof XmlElement) {
|
||||
final XmlTag tag = PsiTreeUtil.getParentOfType(xmlElement, XmlTag.class, false);
|
||||
if (tag != null) {
|
||||
if (namespace.equals(tag.getNamespace())) {
|
||||
if (tag.getNamespace().equals(namespace)) {
|
||||
if (ref.getRangeInElement().getLength() == value.getValue().length()) { //no ns prefix
|
||||
values.add(value);
|
||||
}
|
||||
|
||||
+2
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -92,6 +92,7 @@ public class ConvertSchemaPrefixToDefaultIntention extends PsiElementBaseIntenti
|
||||
}
|
||||
}
|
||||
for (XmlAttribute attr : attrs) {
|
||||
//noinspection ConstantConditions
|
||||
attr.setValue(attr.getValue().substring(index));
|
||||
}
|
||||
xmlns.setName("xmlns");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -229,7 +229,7 @@ public class DefaultXmlExtension extends XmlExtension {
|
||||
rootTag.add(xmlAttribute);
|
||||
} else {
|
||||
final String value = xmlAttribute.getValue();
|
||||
if (!value.contains(namespace)) {
|
||||
if (value != null && !value.contains(namespace)) {
|
||||
if (StringUtil.isEmptyOrSpaces(value)) {
|
||||
xmlAttribute.setValue(pair);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user