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
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
Loading