Skip to content
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ protected void execute(final IProgressMonitor monitor) throws CoreException, Inv
IFile file = IResourcesSetupUtil.createFile(resourceURI.toPlatformString(true), contents);
getFiles().add(file);
} catch (IOException e) {
LOGGER.error("failed adding file to workspace: " + fileName, e);
LOGGER.error("failed adding file to workspace: {}", fileName, e);
fail("Error adding file " + fileName + " to workspace: " + e.getMessage());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ private String getCode(final IMarker marker) {
try {
return (String) marker.getAttribute(Issue.CODE_KEY);
} catch (CoreException e) {
LOGGER.error("Could not get code for marker: " + marker, e); //$NON-NLS-1$
LOGGER.error("Could not get code for marker: {}", marker, e); //$NON-NLS-1$
return null;
}
}
Expand All @@ -99,7 +99,7 @@ private URI getUri(final IMarker marker) {
try {
return URI.createURI((String) marker.getAttribute(Issue.URI_KEY));
} catch (CoreException e) {
LOGGER.error("Could not get uri for marker: " + marker, e); //$NON-NLS-1$
LOGGER.error("Could not get uri for marker: {}", marker, e); //$NON-NLS-1$
return null;
}
}
Expand All @@ -111,7 +111,7 @@ private String getLanguage(final URI uri) {
if (resourceServiceProvider != null) {
return resourceServiceProvider.get(Injector.class).getInstance(Key.get(String.class, Names.named(Constants.LANGUAGE_NAME)));
} else {
LOGGER.error("Could not fetch a ResourceServiceProvider for URI: " + uri); //$NON-NLS-1$
LOGGER.error("Could not fetch a ResourceServiceProvider for URI: {}", uri); //$NON-NLS-1$
}
} else {
LOGGER.warn("Could not fetch eResource from issue: URI to problem is null"); //$NON-NLS-1$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ private boolean checkIssueCodePredicates(final EObject context, final String iss
// caught and disabled by the usual check infrastructure.
} catch (Exception e) {
// CHECKSTYLE:CHECK-ON IllegalCatch
LOGGER.error("Failed to execute predicate " + method.getName() + " for issue code " + issueCode + ". Removing predicate for this issue code.", e); //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$
LOGGER.error("Failed to execute predicate {} for issue code {}. Removing predicate for this issue code.", method.getName(), issueCode, e); //$NON-NLS-1$
predicatesForIssueCode.remove(issueCode, method);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ public abstract class AbstractCheckImpl implements ICheckValidatorImpl {
protected void logCheckMethodFailure(final String rule, final EObject object, final Exception e) {
final Throwable cause = e instanceof InvocationTargetException ? ((InvocationTargetException) e).getTargetException() : e;
final Resource res = object.eResource();
LOGGER.error("Permanently disabling check method " + rule + " for context " + object.getClass().getName() + " because of failure" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ (res != null ? " in " + res.getURI() : ""), cause); //$NON-NLS-1$ //$NON-NLS-2$
LOGGER.error("Permanently disabling check method {} for context {} because of failure{}", rule, object.getClass().getName(), //$NON-NLS-1$
(res != null ? " in " + res.getURI() : ""), cause); //$NON-NLS-1$ //$NON-NLS-2$
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ private static Map<String, String> merge(final Stream<? extends Map<String, Stri
final Map<String, String> mergedMap = new HashMap<String, String>();
maps.map(Map::entrySet).flatMap(Set::stream).forEach(entry -> {
if (null != mergedMap.putIfAbsent(entry.getKey(), entry.getValue())) {
LOGGER.warn("Non-unique Check issue code found: " + entry.getKey()); //$NON-NLS-1$
LOGGER.warn("Non-unique Check issue code found: {}", entry.getKey()); //$NON-NLS-1$
}
});
return mergedMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import org.eclipse.emf.common.util.DiagnosticChain;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.osgi.util.NLS;
import org.eclipse.xtext.validation.AbstractInjectableValidator;

import com.avaloq.tools.ddk.check.runtime.issue.ICheckValidatorImpl;
Expand Down Expand Up @@ -83,7 +82,7 @@ protected Iterable<? extends ICheckValidatorImpl> internalCollectValidators(fina
if (language == null) {
throw new IllegalArgumentException("Input language cannot be null"); //$NON-NLS-1$
} else if (injector == null) {
LOGGER.debug(NLS.bind("No injector found for {0}. Could not inject registered validators.", language)); //$NON-NLS-1$
LOGGER.debug("No injector found for {}. Could not inject registered validators.", language); //$NON-NLS-1$
}

final List<ICheckValidatorImpl> result = Lists.newArrayList();
Expand All @@ -98,7 +97,7 @@ protected Iterable<? extends ICheckValidatorImpl> internalCollectValidators(fina
// CHECKSTYLE:OFF
} catch (Exception e) {
// CHECKSTYLE:ON
LOGGER.error("failed to inject validator " + validator, e); //$NON-NLS-1$
LOGGER.error("failed to inject validator {}", validator, e); //$NON-NLS-1$
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion com.avaloq.tools.ddk.check.runtime.ui/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.ui.ide
Bundle-RequiredExecutionEnvironment: JavaSE-21
Bundle-ActivationPolicy: lazy
Import-Package: org.apache.logging.log4j
Import-Package: org.apache.logging.log4j,
org.apache.logging.log4j.util
Export-Package: com.avaloq.tools.ddk.check.runtime.ui.editor,
com.avaloq.tools.ddk.check.runtime.ui.editor.model,
com.avaloq.tools.ddk.check.runtime.ui.quickfix,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
*******************************************************************************/
package com.avaloq.tools.ddk.check.runtime.ui.validation;

import java.text.MessageFormat;
import java.util.Collection;
import java.util.Set;

Expand Down Expand Up @@ -95,9 +94,7 @@ private IFile getFileFromStorageMapper(final IStorage2UriMapper storage2UriMappe
return (IFile) storage.getFirst();
}
}
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(MessageFormat.format("Could not find storage for URI {0}", fileUri.toString())); //$NON-NLS-1$
}
LOGGER.debug("Could not find storage for URI {}", fileUri::toString); //$NON-NLS-1$
return null;
}

Expand Down Expand Up @@ -135,9 +132,7 @@ protected IStatus run(final IProgressMonitor monitor) {
final IResourceServiceProvider serviceProvider = serviceProviderRegistry.getResourceServiceProvider(uri);
if (serviceProvider == null) {
// This may happen for non-Xtext resources in ice entities
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(MessageFormat.format("Could not validate {0}: no resource service provider found", uri.toString())); //$NON-NLS-1$
}
LOGGER.debug("Could not validate {}: no resource service provider found", uri::toString); //$NON-NLS-1$
continue; // Skip to next URI
}

Expand All @@ -152,7 +147,7 @@ protected IStatus run(final IProgressMonitor monitor) {
}

if (resourceValidator == null) {
LOGGER.error(MessageFormat.format("Could not validate {0}: no resource validator found", iFile.getName())); //$NON-NLS-1$
LOGGER.error("Could not validate {}: no resource validator found", iFile.getName()); //$NON-NLS-1$
} else if (iFile != null) {
monitor.subTask("loading " + iFile.getName()); //$NON-NLS-1$

Expand All @@ -175,11 +170,11 @@ protected IStatus run(final IProgressMonitor monitor) {
// CHECKSTYLE:OFF
} catch (final RuntimeException e) {
// CHECKSTYLE:ON
LOGGER.error(MessageFormat.format("{0} could not be validated.", iFile.getName()), e); //$NON-NLS-1$
LOGGER.error("{} could not be validated.", iFile.getName(), e); //$NON-NLS-1$
} finally {
if (eResource != null) {
validateAndCreateMarkers(resourceValidator, markerCreator, iFile, eResource, monitor);
LOGGER.debug("Validated " + uri); //$NON-NLS-1$
LOGGER.debug("Validated {}", uri); //$NON-NLS-1$
if (loaded) { // NOPMD
// unload any resource that was previously loaded as part of this loop.
eResource.unload();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
public class CheckProjectHelper {

private static final Logger LOGGER = LogManager.getLogger(CheckProjectHelper.class);
private static final String LOG_PLUGIN_PATH_ERROR = "Could not determine plugin path for catalog {}";

@Inject
private IStorage2UriMapper mapper;
Expand Down Expand Up @@ -90,7 +91,7 @@ public String getCatalogPluginPath(final CheckCatalog catalog) {
String result = packageFragment.getElementName().replace('.', '/');
return result + '/' + file.getName();
} catch (JavaModelException e) {
LOGGER.error("Could not determine plugin path for catalog " + catalog.getName(), e);
LOGGER.error(LOG_PLUGIN_PATH_ERROR, catalog.getName(), e);
}
return null;
}
Expand All @@ -114,7 +115,7 @@ public String getCatalogQualifiedName(final CheckCatalog catalog) {
final String fileNameWithoutExtension = file.getName().substring(0, file.getName().length() - (file.getFileExtension().length() + 1));
return packageFragment.getElementName() + '.' + fileNameWithoutExtension;
} catch (JavaModelException e) {
LOGGER.error("Could not determine plugin path for catalog " + catalog.getName(), e);
LOGGER.error(LOG_PLUGIN_PATH_ERROR, catalog.getName(), e);
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,15 @@ protected IStatus run(final IProgressMonitor monitor) {
return new Status(Status.ERROR, Activator.getPluginId(), Messages.DeployJob_CouldNotDeployCheckBundle, e);
}

LOGGER.info(NLS.bind("Generated bundle from project {0} deployed.", project.getName())); //$NON-NLS-1$
LOGGER.info("Generated bundle from project {} deployed.", project.getName()); //$NON-NLS-1$

try {
deployCheckConfiguration();
} catch (DeployException e) {
return new Status(Status.ERROR, Activator.getPluginId(), Messages.DeployJob_CannotDeployMoreThanOneCheckConfiguration, e);
}

LOGGER.info(NLS.bind("Check configuration for project {0} deployed.", project.getName())); //$NON-NLS-1$
LOGGER.info("Check configuration for project {} deployed.", project.getName()); //$NON-NLS-1$

return Status.OK_STATUS;
}
Expand Down Expand Up @@ -146,7 +146,7 @@ private void deployCheckBundle() throws DeployException {
}
}

LOGGER.info(NLS.bind("Starting the bundle {0} generated from the project {1}", bundleLocation, project.getName())); //$NON-NLS-1$
LOGGER.info("Starting the bundle {} generated from the project {}", bundleLocation, project.getName()); //$NON-NLS-1$
try {
managedBundle = bundleContext.installBundle(bundleLocation, Files.asByteSource(jar).openStream());
managedBundle.start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public static Collection<ICheckCfgPropertySpecification> getAllPropertyContribut
try {
contributions.add((ICheckCfgPropertySpecification) element.createExecutableExtension(PROPERTY_EXECUTABLE_EXTENSION_ATTRIBUTE));
} catch (CoreException e) {
LOGGER.warn("Failed to instantiate property from " + element.getContributor(), e); //$NON-NLS-1$
LOGGER.warn("Failed to instantiate property from {}", element.getContributor(), e); //$NON-NLS-1$
}
}
} else {
Expand Down
2 changes: 2 additions & 0 deletions com.avaloq.tools.ddk.test.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ Export-Package: com.avaloq.tools.ddk.test.core,
com.avaloq.tools.ddk.test.core.jupiter,
com.avaloq.tools.ddk.test.core.mock,
com.avaloq.tools.ddk.test.core.util
Import-Package: org.apache.logging.log4j,
org.apache.logging.log4j.util
Automatic-Module-Name: com.avaloq.tools.ddk.test.core
Original file line number Diff line number Diff line change
Expand Up @@ -63,29 +63,21 @@ private String getDescriptionName(final Description description) {

@Override
public void starting(final Description description) {
if (LOGGER.isInfoEnabled()) {
LOGGER.info("STARTING: " + getDescriptionName(description));
}
LOGGER.info("STARTING: {}", () -> getDescriptionName(description));
}

@Override
protected void finished(final Description description) {
if (LOGGER.isInfoEnabled()) {
LOGGER.info("FINISHED: " + getDescriptionName(description));
}
LOGGER.info("FINISHED: {}", () -> getDescriptionName(description));
}

@Override
protected void succeeded(final Description description) {
if (LOGGER.isInfoEnabled()) {
LOGGER.info("SUCCEEDED: " + getDescriptionName(description));
}
LOGGER.info("SUCCEEDED: {}", () -> getDescriptionName(description));
}

@Override
protected void failed(final Throwable e, final Description description) {
if (LOGGER.isInfoEnabled()) {
LOGGER.info("FAILED: " + getDescriptionName(description));
}
LOGGER.info("FAILED: {}", () -> getDescriptionName(description));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ public static LoggingRule getInstance() {

@Override
public void beforeEach(final ExtensionContext context) throws Exception {
if (LOGGER.isInfoEnabled()) {
LOGGER.info("STARTING: " + getDescriptionName(context));
}
LOGGER.info("STARTING: {}", () -> getDescriptionName(context));
}

/**
Expand All @@ -72,22 +70,16 @@ private String getDescriptionName(final ExtensionContext context) {

@Override
public void testSuccessful(final ExtensionContext context) {
if (LOGGER.isInfoEnabled()) {
LOGGER.info("SUCCEEDED: " + getDescriptionName(context));
}
LOGGER.info("SUCCEEDED: {}", () -> getDescriptionName(context));
}

@Override
public void testFailed(final ExtensionContext context, final Throwable cause) {
if (LOGGER.isInfoEnabled()) {
LOGGER.info("FAILED: " + getDescriptionName(context));
}
LOGGER.info("FAILED: {}", () -> getDescriptionName(context));
}

@Override
public void afterEach(final ExtensionContext context) throws Exception {
if (LOGGER.isInfoEnabled()) {
LOGGER.info("FINISHED: " + getDescriptionName(context));
}
LOGGER.info("FINISHED: {}", () -> getDescriptionName(context));
}
}
3 changes: 2 additions & 1 deletion com.avaloq.tools.ddk.test.ui/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Export-Package: com.avaloq.tools.ddk.test.ui,
com.avaloq.tools.ddk.test.ui.swtbot,
com.avaloq.tools.ddk.test.ui.swtbot.condition,
com.avaloq.tools.ddk.test.ui.swtbot.util
Import-Package: org.slf4j, org.apache.logging.log4j
Import-Package: org.slf4j, org.apache.logging.log4j,
org.apache.logging.log4j.util
Eclipse-RegisterBuddy: org.eclipse.swtbot.swt.finder
Automatic-Module-Name: com.avaloq.tools.ddk.test.ui
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public SwtBotButton(final Button button, final SelfDescribing description) {
*/
@Override
public SwtBotButton click() {
log.debug("Clicking on {}", SWTUtils.getText(widget)); //$NON-NLS-1$
log.debug("Clicking on {}", SWTUtils.getText(widget)); //$NON-NLS-1$ // NOPMD GuardLogStatement
waitForEnabled();
notify(SWT.MouseEnter);
notify(SWT.MouseMove);
Expand All @@ -48,7 +48,7 @@ public SwtBotButton click() {
notify(SWT.MouseDown);
notify(SWT.MouseUp);
notify(SWT.Selection);
log.debug("Clicked on {}", SWTUtils.getText(widget)); //$NON-NLS-1$
log.debug("Clicked on {}", SWTUtils.getText(widget)); //$NON-NLS-1$ // NOPMD GuardLogStatement
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ public static void clickContextMenu(final AbstractSWTBot<? extends Control> bot,
* @throw {@link WidgetNotFoundException} if the context menu could not be found
*/
public static void clickContextMenu(final Runnable setSelection, final AbstractSWTBot<? extends Control> bot, final DynamicMenuPredicate predicate, final String... labels) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("clickContextMenu(" + bot + " , " + Arrays.asList(labels) + ");"); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
}
LOGGER.debug("clickContextMenu({} , {});", () -> bot, () -> Arrays.asList(labels)); //$NON-NLS-1$
try {
setSelection.run();
logSelection(bot);
Expand Down Expand Up @@ -101,7 +99,7 @@ private static void logSelection(final AbstractSWTBot<? extends Control> bot) {
if (LOGGER.isDebugEnabled()) {
TableCollection selection = tryGetSelection(bot);
if (selection != null) {
LOGGER.debug("setSelection(" + selection + ")"); // NOPMD GuardLogStatement //$NON-NLS-1$//$NON-NLS-2$
LOGGER.debug("setSelection({})", selection); //$NON-NLS-1$
}
}
}
Expand Down Expand Up @@ -140,9 +138,7 @@ private static void tryUnselect(final AbstractSWTBot<? extends Control> bot) {
* @return {@code true} if on the given widget bot a context menu with the given text is available, else {@code false}
*/
public static boolean hasContextMenuItem(final AbstractSWTBot<? extends Control> widgetBot, final DynamicMenuPredicate predicate, final String... labels) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("hasContextMenuItem(" + widgetBot + " , " + Arrays.asList(labels) + ");"); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
}
LOGGER.debug("hasContextMenuItem({} , {});", () -> widgetBot, () -> Arrays.asList(labels)); //$NON-NLS-1$
try {
return new SwtBotDynamicContextMenu(widgetBot.contextMenu(), predicate).menu(labels) != null;
} catch (WidgetNotFoundException widgetNotFound) {
Expand All @@ -164,9 +160,7 @@ public static boolean hasContextMenuItem(final AbstractSWTBot<? extends Control>
* @throw {@link WidgetNotFoundException} if the context menu could not be found
*/
public static boolean isEnabled(final AbstractSWTBot<? extends Control> widgetBot, final DynamicMenuPredicate predicate, final String... labels) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("isEnabled(" + widgetBot + " , " + Arrays.asList(labels) + ");"); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
}
LOGGER.debug("isEnabled({} , {});", () -> widgetBot, () -> Arrays.asList(labels)); //$NON-NLS-1$
try {
return new SwtBotDynamicContextMenu(widgetBot.contextMenu(), predicate).menu(labels).isEnabled();
} catch (WidgetNotFoundException widgetNotFound) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
*/
public class WaitForDynamicContextMenuItem extends WaitForMenuItem {
private static final Logger LOGGER = LogManager.getLogger(WaitForDynamicContextMenuItem.class);
private static final String LOG_MENU_ITEM_FINDER = "MenuItem finder matching {}"; //$NON-NLS-1$

/**
* Custom wrapper around a given {@link Matcher} that collects data about waiting dynamic menu items as
Expand Down Expand Up @@ -78,18 +79,14 @@ public WaitForDynamicContextMenuItem(final SwtBotDynamicContextMenuItem menu, fi
super(menu, new DynamicContextMenuItemMatcher(matcher, menu.getPredicate()), recursive, index);
itemMatcher = (DynamicContextMenuItemMatcher) this.matcher;
this.widget = menu.widget;
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("MenuItem finder matching " + itemMatcher); //$NON-NLS-1$
}
LOGGER.debug(LOG_MENU_ITEM_FINDER, itemMatcher);
}

public WaitForDynamicContextMenuItem(final SwtBotDynamicContextMenu menu, final Matcher<MenuItem> matcher, final boolean recursive, final int index) {
super(menu, new DynamicContextMenuItemMatcher(matcher, menu.getPredicate()), recursive, index);
itemMatcher = (DynamicContextMenuItemMatcher) this.matcher;
this.widget = menu.widget;
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("MenuItem finder matching " + itemMatcher); //$NON-NLS-1$
}
LOGGER.debug(LOG_MENU_ITEM_FINDER, itemMatcher);
}

@Override
Expand Down
Loading
Loading