Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bundles/org.eclipse.e4.ui.workbench/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.e4.ui.workbench;singleton:=true
Bundle-Version: 1.18.200.qualifier
Bundle-Version: 1.18.300.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
import java.util.TreeSet;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.atomic.AtomicReference;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
Expand Down Expand Up @@ -209,6 +211,8 @@ public void removedBundle(Bundle bundle, BundleEvent event, List<FragmentWrapper

private final List<ServiceReference<IModelProcessorContribution>> processorContributions = new CopyOnWriteArrayList<>();

private static final Pattern MESSAGE_FORMAT_BRACKETS_PATTERN = Pattern.compile("\\{\\}"); //$NON-NLS-1$

private BundleContext bundleContext;

private BundleTracker<List<FragmentWrapperElementMapping>> tracker;
Expand Down Expand Up @@ -820,7 +824,7 @@ private void log(LogMethod logMethod, PrintStream stream, String message, Object
logMethod.invoke(log, message, args);
} else {
// fallback if no LogService is available
stream.println(MessageFormat.format(message, args));
stream.println(MessageFormat.format(addIndex(message), args));
}
}

Expand All @@ -845,4 +849,20 @@ public void unsetLogger(LoggerFactory loggerFactory) {
this.logger = null;
}
}

/**
* Adds missing indices to {@code {}} sequences in {@code format}. See:
* {@link com.sun.org.slf4j.internal.Logger#addIndex(String)}
*/
private static String addIndex(String format) {
Matcher matcher = MESSAGE_FORMAT_BRACKETS_PATTERN.matcher(format);
StringBuilder sb = new StringBuilder();
int index = 0;
while (matcher.find()) {
String r = "{" + Integer.toString(index++) + "}"; //$NON-NLS-1$ //$NON-NLS-2$
matcher.appendReplacement(sb, r);
}
matcher.appendTail(sb);
return sb.toString();
}
}
Loading