mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
fix tests & double formatting
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.intellij.codeInspection;
|
||||
|
||||
import com.intellij.BundleBase;
|
||||
import com.intellij.codeInsight.CodeInsightBundle;
|
||||
import com.intellij.codeInsight.daemon.EmptyResolveMessageProvider;
|
||||
import com.intellij.lang.injection.InjectedLanguageManager;
|
||||
@@ -143,7 +144,7 @@ public class ProblemsHolder {
|
||||
String message;
|
||||
if (reference instanceof EmptyResolveMessageProvider) {
|
||||
String pattern = ((EmptyResolveMessageProvider)reference).getUnresolvedMessagePattern();
|
||||
message = pattern.contains("{0}") ? MessageFormat.format(pattern, reference.getCanonicalText()) : pattern;
|
||||
message = BundleBase.format(pattern, reference.getCanonicalText()); // avoid double formatting
|
||||
}
|
||||
else {
|
||||
message = CodeInsightBundle.message("error.cannot.resolve.default.message", reference.getCanonicalText());
|
||||
|
||||
@@ -55,6 +55,10 @@ public abstract class BundleBase {
|
||||
|
||||
value = replaceMnemonicAmpersand(value);
|
||||
|
||||
return format(value, params);
|
||||
}
|
||||
|
||||
public static String format(String value, Object... params) {
|
||||
if (params.length > 0 && value.indexOf('{') >= 0) {
|
||||
return MessageFormat.format(value, params);
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.codeInsight.daemon.impl.analysis;
|
||||
|
||||
import com.intellij.BundleBase;
|
||||
import com.intellij.codeInsight.daemon.*;
|
||||
import com.intellij.codeInsight.daemon.impl.HighlightInfo;
|
||||
import com.intellij.codeInsight.daemon.impl.HighlightInfoType;
|
||||
@@ -58,7 +59,6 @@ import com.intellij.xml.util.XmlUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.StringTokenizer;
|
||||
@@ -653,7 +653,7 @@ public class XmlHighlightVisitor extends XmlElementVisitor implements HighlightV
|
||||
|
||||
String description;
|
||||
try {
|
||||
description = MessageFormat.format(message, reference.getCanonicalText());
|
||||
description = BundleBase.format(message, reference.getCanonicalText()); // avoid double formatting
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
// unresolvedMessage provided by third-party reference contains wrong format string (e.g. {}), tolerate it
|
||||
|
||||
Reference in New Issue
Block a user