Skip to content
Draft
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ public EObject getModel(final String fileName) throws Exception { // NOPMD
try {
s.close();
} catch (IOException e) {
LOGGER.info("Failed to close test file " + fileName);
LOGGER.info("Failed to close test file {}", fileName);
}
}
}
Expand Down Expand Up @@ -338,7 +338,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 @@ -137,16 +137,16 @@ private void deployCheckBundle() throws DeployException {

Bundle managedBundle = Platform.getBundle(project.getName());
if (managedBundle != null) {
LOGGER.info(NLS.bind(Messages.DeployJob_BundleAlreadyDeployed, project.getName()));
LOGGER.info("Bundle {} already deployed. Stopping and uninstalling it.", project.getName()); //$NON-NLS-1$
try {
UndeployJob.undeployBundle(managedBundle);
} catch (BundleException e) {
LOGGER.error(NLS.bind(Messages.UndeployJob_FailedToStopAndUninstallBundleWithSymbolicName, managedBundle.getSymbolicName()), e);
LOGGER.error("Failed to stop and uninstall bundle with symbolic name {}.", managedBundle.getSymbolicName(), e); //$NON-NLS-1$
throw new DeployException(e);
}
}

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 @@ -58,16 +58,16 @@ public UndeployJob(final String name, final IProject project) {
protected IStatus run(final IProgressMonitor monitor) {
Bundle managedBundle = Platform.getBundle(project.getName());
if (managedBundle == null) {
LOGGER.info(NLS.bind(Messages.UndeployJob_NoBundleWithSymbolicNameInstalled, project.getName()));
LOGGER.info("No bundle with symbolic name {} installed.", project.getName()); //$NON-NLS-1$
return new Status(Status.INFO, Activator.getPluginId(), NLS.bind(Messages.UndeployJob_NoBundleWithSymbolicNameInstalled, project.getName()));
}
try {
undeployBundle(managedBundle);
} catch (BundleException e) {
LOGGER.error(NLS.bind(Messages.UndeployJob_FailedToStopAndUninstallBundleWithSymbolicName, managedBundle.getSymbolicName()), e);
LOGGER.error("Failed to stop and uninstall bundle with symbolic name {}.", managedBundle.getSymbolicName(), e); //$NON-NLS-1$
return new Status(Status.ERROR, Activator.getPluginId(), NLS.bind(Messages.UndeployJob_FailedToStopAndUninstallBundleWithSymbolicName, managedBundle.getSymbolicName()), e);
}
LOGGER.info(NLS.bind(Messages.UndeployJob_DundleUndeployed, managedBundle.getSymbolicName()));
LOGGER.info("Bundle {} undeployed.", managedBundle.getSymbolicName()); //$NON-NLS-1$

try {
undeployCheckConfiguration();
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
3 changes: 2 additions & 1 deletion com.avaloq.tools.ddk.test.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,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
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));
}
}
2 changes: 1 addition & 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,6 @@ 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,org.apache.log4j
Import-Package: org.slf4j, org.apache.logging.log4j,org.apache.logging.log4j.util,org.apache.log4j
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;
}
}
Loading