Skip to content

Commit

Permalink
Fix checkstyle violations
Browse files Browse the repository at this point in the history
  • Loading branch information
timtebeek committed Nov 16, 2024
1 parent 9e7af87 commit 0f7cc50
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,7 @@ public ArchetypeCatalog getInternalCatalog() {

return source.getArchetypeCatalog(null, null);
} catch (ArchetypeDataSourceException e) {
LOGGER.warn(
"failed to read catalog: " + e.getMessage(),
LOGGER.isDebugEnabled() ? e : null);
LOGGER.warn("failed to read catalog: " + e.getMessage(), LOGGER.isDebugEnabled() ? e : null);
return new ArchetypeCatalog();
}
}
Expand All @@ -162,9 +160,7 @@ public ArchetypeCatalog getLocalCatalog(RepositorySystemSession repositorySessio

return source.getArchetypeCatalog(repositorySession, null);
} catch (ArchetypeDataSourceException e) {
LOGGER.warn(
"failed to read catalog: " + e.getMessage(),
LOGGER.isDebugEnabled() ? e : null);
LOGGER.warn("failed to read catalog: " + e.getMessage(), LOGGER.isDebugEnabled() ? e : null);
return new ArchetypeCatalog();
}
}
Expand All @@ -177,9 +173,7 @@ public ArchetypeCatalog getRemoteCatalog(

return source.getArchetypeCatalog(repositorySession, remoteRepositories);
} catch (ArchetypeDataSourceException e) {
LOGGER.warn(
"failed to download from remote" + e.getMessage(),
LOGGER.isDebugEnabled() ? e : null);
LOGGER.warn("failed to download from remote" + e.getMessage(), LOGGER.isDebugEnabled() ? e : null);
return new ArchetypeCatalog();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
@Singleton
public class DefaultArchetypeArtifactManager implements ArchetypeArtifactManager {
private static final Logger LOGGER = LoggerFactory.getLogger(DefaultArchetypeArtifactManager.class);

@Inject
private Downloader downloader;

Expand Down Expand Up @@ -184,9 +185,9 @@ public boolean exists(
return archetype.exists();
} catch (DownloadException e) {
LOGGER.debug(
"Archetype " + archetypeGroupId + ":" + archetypeArtifactId + ":" + archetypeVersion
+ " doesn't exist",
e);
"Archetype " + archetypeGroupId + ":" + archetypeArtifactId + ":" + archetypeVersion
+ " doesn't exist",
e);
return false;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ public void createArchetype(ArchetypeCreationRequest request, ArchetypeCreationR

if (archetypeIntegrationTestInputFolder.exists()) {
LOGGER.info("Copying: " + archetypeIntegrationTestInputFolder.getAbsolutePath() + " into "
+ archetypeIntegrationTestOutputFolder.getAbsolutePath());
+ archetypeIntegrationTestOutputFolder.getAbsolutePath());

FileUtils.copyDirectoryStructure(
archetypeIntegrationTestInputFolder, archetypeIntegrationTestOutputFolder);
Expand Down Expand Up @@ -322,7 +322,7 @@ private void createArchetypeBasicIt(ArchetypeDescriptor archetypeDescriptor, Fil
File archetypePropertiesFile = new File(basicItDirectory, "archetype.properties");
if (!archetypePropertiesFile.exists() && !archetypePropertiesFile.createNewFile()) {
LOGGER.warn("Could not create new file \"" + archetypePropertiesFile.getPath()
+ "\" or the file already exists.");
+ "\" or the file already exists.");
}

try (InputStream in = FilesetArchetypeCreator.class.getResourceAsStream("archetype.properties");
Expand Down Expand Up @@ -473,7 +473,7 @@ private void addRequiredProperties(ArchetypeDescriptor archetypeDescriptor, Prop
archetypeDescriptor.addRequiredProperty(requiredProperty);

LOGGER.debug("Adding requiredProperty " + propertyKey + "=" + requiredProperties.getProperty(propertyKey)
+ " to archetype's descriptor");
+ " to archetype's descriptor");
}
}

Expand Down Expand Up @@ -885,8 +885,8 @@ private void createArchetypePom(
String property = (String) properties.next();

if (initialcontent.indexOf("${" + property + "}") > 0) {
LOGGER.warn("Archetype uses ${" + property + "} for internal processing, but file "
+ initialPomFile + " contains this property already");
LOGGER.warn("Archetype uses ${" + property + "} for internal processing, but file " + initialPomFile
+ " contains this property already");
}
}
}
Expand Down Expand Up @@ -924,7 +924,7 @@ private List<FileSet> createFileSets(

if (!files.isEmpty()) {
LOGGER.debug("Creating filesets" + (packaged ? (" packaged (" + packageName + ")") : "")
+ (filtered ? " filtered" : "") + " at level " + level);
+ (filtered ? " filtered" : "") + " at level " + level);
if (level == 0) {
List<String> includes = new ArrayList<>(files);
List<String> excludes = new ArrayList<>();
Expand Down Expand Up @@ -1128,7 +1128,7 @@ private void createModulePom(

if (initialcontent.indexOf("${" + property + "}") > 0) {
LOGGER.warn("OldArchetype uses ${" + property + "} for internal processing, but file "
+ initialPomFile + " contains this property already");
+ initialPomFile + " contains this property already");
}
}
}
Expand Down Expand Up @@ -1266,7 +1266,7 @@ private void processFileSet(

if (initialcontent.indexOf("${" + property + "}") > 0) {
LOGGER.warn("Archetype uses ${" + property + "} for internal processing, but file " + inputFile
+ " contains this property already");
+ " contains this property already");
}
}

Expand Down Expand Up @@ -1343,8 +1343,8 @@ private List<FileSet> resolveFileSets(
List<String> filtereds,
String defaultEncoding) {
List<FileSet> resolvedFileSets = new ArrayList<>();
LOGGER.debug("Resolving filesets with package=" + packageName + ", languages=" + languages
+ " and extentions=" + filtereds);
LOGGER.debug("Resolving filesets with package=" + packageName + ", languages=" + languages + " and extentions="
+ filtereds);

List<String> files = new ArrayList<>(fileNames);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
@Singleton
public class DefaultFilesetArchetypeGenerator implements FilesetArchetypeGenerator {
private static final Logger LOGGER = LoggerFactory.getLogger(DefaultFilesetArchetypeGenerator.class);

@Inject
private ArchetypeArtifactManager archetypeArtifactManager;

Expand Down Expand Up @@ -362,13 +363,13 @@ private String replaceFilenameTokens(final String filePath, final Context contex
if (contextPropertyValue != null && !contextPropertyValue.trim().isEmpty()) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Replacing property '" + propertyToken + "' in file path '" + filePath
+ "' with value '" + contextPropertyValue + "'.");
+ "' with value '" + contextPropertyValue + "'.");
}
matcher.appendReplacement(interpolatedResult, contextPropertyValue);
} else {
// Need to skip the undefined property
LOGGER.warn("Property '" + propertyToken + "' was not specified, so the token in '" + filePath
+ "' is not being replaced.");
+ "' is not being replaced.");
}
}

Expand Down Expand Up @@ -412,7 +413,7 @@ private Context prepareVelocityContext(ArchetypeGenerationRequest request) {
LOGGER.info("----------------------------------------------------------------------------");

LOGGER.info("Using following parameters for creating project from Archetype: "
+ request.getArchetypeArtifactId() + ":" + request.getArchetypeVersion());
+ request.getArchetypeArtifactId() + ":" + request.getArchetypeVersion());

LOGGER.info("----------------------------------------------------------------------------");
LOGGER.info("Parameter: " + Constants.GROUP_ID + ", Value: " + request.getGroupId());
Expand Down Expand Up @@ -788,7 +789,7 @@ private void processTemplates(

if (fileSet.isFiltered()) {
LOGGER.debug(" Processing fileset " + fileSet + " -> " + fileSetResources.size() + ":\n "
+ fileSetResources);
+ fileSetResources);

int processed = processFileSet(
fileSet.getDirectory(),
Expand All @@ -804,7 +805,7 @@ private void processTemplates(
LOGGER.debug(" Processed " + processed + " files.");
} else {
LOGGER.debug(" Copying fileset " + fileSet + " -> " + fileSetResources.size() + ":\n "
+ fileSetResources);
+ fileSetResources);

int copied = copyFiles(
fileSet.getDirectory(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public void createArchetype(ArchetypeGenerationRequest request, File archetypeFi
LOGGER.info("----------------------------------------------------------------------------");

LOGGER.info("Using following parameters for creating project from Old (1.x) Archetype: "
+ request.getArchetypeArtifactId() + ":" + request.getArchetypeVersion());
+ request.getArchetypeArtifactId() + ":" + request.getArchetypeVersion());

LOGGER.info("----------------------------------------------------------------------------");

Expand Down Expand Up @@ -414,7 +414,7 @@ private void processTemplates(

if (LOGGER.isDebugEnabled()) {
LOGGER.debug(
"********************* Debug info for resources created from generated Model ***********************");
"********************* Debug info for resources created from generated Model ***********************");
LOGGER.debug("Was build element found in generated POM?: " + foundBuildElement);
}

Expand Down Expand Up @@ -493,7 +493,7 @@ private void processTemplates(
}

LOGGER.debug(
"********************* End of debug info from resources from generated POM ***********************");
"********************* End of debug info from resources from generated POM ***********************");

// ----------------------------------------------------------------------
// Main
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
@Singleton
public class DefaultRepositoryCrawler implements RepositoryCrawler {
private static final Logger LOGGER = LoggerFactory.getLogger(DefaultRepositoryCrawler.class);

@Inject
private ArchetypeArtifactManager archetypeArtifactManager;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ public ArchetypeConfiguration createArchetypeConfiguration(
configuration.addRequiredProperty(requiredProperty);

configuration.setProperty(requiredProperty, properties.getProperty(requiredProperty));
LOGGER.debug("Setting property " + requiredProperty + "="
+ configuration.getProperty(requiredProperty));
LOGGER.debug(
"Setting property " + requiredProperty + "=" + configuration.getProperty(requiredProperty));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
@Singleton
public class DefaultArchetypeCreationConfigurator implements ArchetypeCreationConfigurator {
private static final Logger LOGGER = LoggerFactory.getLogger(DefaultArchetypeCreationConfigurator.class);

@Inject
private ArchetypeCreationQueryer archetypeCreationQueryer;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
@Singleton
public class DefaultArchetypeCreationQueryer implements ArchetypeCreationQueryer {
private static final Logger LOGGER = LoggerFactory.getLogger(DefaultArchetypeCreationQueryer.class);

@Inject
private Prompter prompter;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@
// TODO: this seems to have more responsibilities than just a configurator
@Named("default")
@Singleton
public class DefaultArchetypeGenerationConfigurator
implements ArchetypeGenerationConfigurator {
public class DefaultArchetypeGenerationConfigurator implements ArchetypeGenerationConfigurator {
private static final Logger LOGGER = LoggerFactory.getLogger(DefaultArchetypeGenerationConfigurator.class);

@Inject
Expand Down Expand Up @@ -162,7 +161,7 @@ public void configureArchetype(
if (archetypeConfiguration.isConfigured()) {
for (String requiredProperty : propertiesRequired) {
LOGGER.info("Using property: " + requiredProperty + " = "
+ archetypeConfiguration.getProperty(requiredProperty));
+ archetypeConfiguration.getProperty(requiredProperty));
}
} else {
for (String requiredProperty : propertiesRequired) {
Expand All @@ -171,7 +170,7 @@ public void configureArchetype(
if (archetypeConfiguration.isConfigured(requiredProperty)
&& !request.isAskForDefaultPropertyValues()) {
LOGGER.info("Using property: " + requiredProperty + " = "
+ archetypeConfiguration.getProperty(requiredProperty));
+ archetypeConfiguration.getProperty(requiredProperty));

value = archetypeConfiguration.getProperty(requiredProperty);
} else {
Expand Down Expand Up @@ -240,7 +239,7 @@ public void configureArchetype(
missingProperties.add(requiredProperty);
exceptionMessage.append(" is missing.");
LOGGER.warn("Property " + requiredProperty + " is missing. Add -D" + requiredProperty
+ "=someValue");
+ "=someValue");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
@Singleton
public class DefaultArchetypeGenerationQueryer implements ArchetypeGenerationQueryer {
private static final Logger LOGGER = LoggerFactory.getLogger(DefaultArchetypeGenerationQueryer.class);

@Inject
private Prompter prompter;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ public void selectArchetype(ArchetypeGenerationRequest request, Boolean interact
updateRepository(definition, archetype);

LOGGER.info("Archetype repository not defined. Using the one from " + archetype + " found in catalog "
+ catalogKey);
+ catalogKey);
} else {
LOGGER.warn("Archetype not found in any catalog. Falling back to central repository.");
LOGGER.warn(
"Add a repository with id 'archetype' in your settings.xml if archetype's repository is elsewhere.");
"Add a repository with id 'archetype' in your settings.xml if archetype's repository is elsewhere.");
}
} else if (definition.isPartiallyDefined()) {
Map.Entry<String, Archetype> found =
Expand Down Expand Up @@ -127,8 +127,8 @@ public void selectArchetype(ArchetypeGenerationRequest request, Boolean interact
// if artifact ID is set to its default, we still prompt to confirm
if (definition.getArtifactId() == null) {
LOGGER.info("No archetype defined. Using " + DEFAULT_ARCHETYPE_ARTIFACTID + " ("
+ definition.getGroupId() + ":" + DEFAULT_ARCHETYPE_ARTIFACTID + ":"
+ definition.getVersion() + ")");
+ definition.getGroupId() + ":" + DEFAULT_ARCHETYPE_ARTIFACTID + ":"
+ definition.getVersion() + ")");
definition.setArtifactId(DEFAULT_ARCHETYPE_ARTIFACTID);
}

Expand Down

0 comments on commit 0f7cc50

Please sign in to comment.