diff --git a/license-maven-plugin-git/src/main/java/com/mycila/maven/plugin/license/git/GitLookup.java b/license-maven-plugin-git/src/main/java/com/mycila/maven/plugin/license/git/GitLookup.java index 0e5c965ca..a65e68dcc 100644 --- a/license-maven-plugin-git/src/main/java/com/mycila/maven/plugin/license/git/GitLookup.java +++ b/license-maven-plugin-git/src/main/java/com/mycila/maven/plugin/license/git/GitLookup.java @@ -18,7 +18,6 @@ import org.eclipse.jgit.api.Git; import org.eclipse.jgit.api.Status; import org.eclipse.jgit.api.errors.GitAPIException; -import org.eclipse.jgit.api.errors.NoHeadException; import org.eclipse.jgit.diff.DiffConfig; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.PersonIdent; @@ -108,11 +107,10 @@ public GitLookup(File anyFile, DateSource dateSource, TimeZone timeZone, int che * * @param file for which the year should be retrieved * @return year of last modification of the file - * @throws NoHeadException if unable to retrieve the head of the git history * @throws IOException if unable to read the file * @throws GitAPIException if unable to process the git history */ - int getYearOfLastChange(File file) throws NoHeadException, GitAPIException, IOException { + int getYearOfLastChange(File file) throws GitAPIException, IOException { String repoRelativePath = pathResolver.relativize(file); if (isFileModifiedOrUnstaged(repoRelativePath)) { @@ -161,7 +159,7 @@ int getYearOfCreation(File file) throws IOException, GitAPIException { return commitYear; } - String getAuthorNameOfCreation(File file) throws IOException, GitAPIException { + String getAuthorNameOfCreation(File file) throws IOException { String repoRelativePath = pathResolver.relativize(file); String authorName = ""; RevWalk walk = getGitRevWalk(repoRelativePath, true); @@ -174,7 +172,7 @@ String getAuthorNameOfCreation(File file) throws IOException, GitAPIException { return authorName; } - String getAuthorEmailOfCreation(File file) throws IOException, GitAPIException { + String getAuthorEmailOfCreation(File file) throws IOException { String repoRelativePath = pathResolver.relativize(file); String authorEmail = ""; RevWalk walk = getGitRevWalk(repoRelativePath, true); diff --git a/license-maven-plugin/src/main/java/com/mycila/maven/plugin/license/AbstractLicenseMojo.java b/license-maven-plugin/src/main/java/com/mycila/maven/plugin/license/AbstractLicenseMojo.java index 562b77be9..020a92165 100755 --- a/license-maven-plugin/src/main/java/com/mycila/maven/plugin/license/AbstractLicenseMojo.java +++ b/license-maven-plugin/src/main/java/com/mycila/maven/plugin/license/AbstractLicenseMojo.java @@ -756,7 +756,7 @@ private String[] buildExcludes(final LicenseSet licenseSet) { List ex = new ArrayList<>(); ex.addAll(asList(licenseSet.excludes)); if (project != null && project.getModules() != null && !aggregate) { - for (String module : (List) project.getModules()) { + for (String module : project.getModules()) { ex.add(module + "/**"); } } diff --git a/license-maven-plugin/src/main/java/com/mycila/maven/plugin/license/Default.java b/license-maven-plugin/src/main/java/com/mycila/maven/plugin/license/Default.java index ff59c041c..bfd40ffb3 100755 --- a/license-maven-plugin/src/main/java/com/mycila/maven/plugin/license/Default.java +++ b/license-maven-plugin/src/main/java/com/mycila/maven/plugin/license/Default.java @@ -21,6 +21,10 @@ */ public final class Default { + private Default() { + // Prevent Instantiation + } + public static final String[] INCLUDE = new String[]{"**"}; public static final String[] EXCLUDES = { diff --git a/license-maven-plugin/src/main/java/com/mycila/maven/plugin/license/dependencies/AbstractLicensePolicyEnforcer.java b/license-maven-plugin/src/main/java/com/mycila/maven/plugin/license/dependencies/AbstractLicensePolicyEnforcer.java index d4d9f2c18..5a3585f40 100644 --- a/license-maven-plugin/src/main/java/com/mycila/maven/plugin/license/dependencies/AbstractLicensePolicyEnforcer.java +++ b/license-maven-plugin/src/main/java/com/mycila/maven/plugin/license/dependencies/AbstractLicensePolicyEnforcer.java @@ -24,7 +24,7 @@ public abstract class AbstractLicensePolicyEnforcer implements LicensePolicyEnforcer { private final LicensePolicy policy; - public AbstractLicensePolicyEnforcer(final LicensePolicy policy) { + protected AbstractLicensePolicyEnforcer(final LicensePolicy policy) { this.policy = policy; } diff --git a/license-maven-plugin/src/main/java/com/mycila/maven/plugin/license/dependencies/MavenProjectLicenses.java b/license-maven-plugin/src/main/java/com/mycila/maven/plugin/license/dependencies/MavenProjectLicenses.java index 628c807e4..c05ee9f85 100755 --- a/license-maven-plugin/src/main/java/com/mycila/maven/plugin/license/dependencies/MavenProjectLicenses.java +++ b/license-maven-plugin/src/main/java/com/mycila/maven/plugin/license/dependencies/MavenProjectLicenses.java @@ -50,7 +50,6 @@ public class MavenProjectLicenses implements LicenseMap, LicenseMessage { private Set projects; - private MavenSession session; private DependencyGraphBuilder graph; private ProjectBuilder projectBuilder; private ProjectBuildingRequest buildingRequest; @@ -177,14 +176,6 @@ private Set getDependencies() { // return project.getArtifacts(); } - private MavenSession getSession() { - return session; - } - - private void setSession(MavenSession session) { - this.session = session; - } - protected Set getProjects() { return projects; } diff --git a/license-maven-plugin/src/main/java/com/mycila/maven/plugin/license/header/HeaderParser.java b/license-maven-plugin/src/main/java/com/mycila/maven/plugin/license/header/HeaderParser.java index a7bd6efe5..b469e9a91 100755 --- a/license-maven-plugin/src/main/java/com/mycila/maven/plugin/license/header/HeaderParser.java +++ b/license-maven-plugin/src/main/java/com/mycila/maven/plugin/license/header/HeaderParser.java @@ -238,7 +238,8 @@ private int findEndPosition() { end = fileContent.getPosition(); line = fileContent.nextLine(); } - } if (headerDefinition.getEndLine().endsWith("EOL") && line != null && "".equals(line.trim())) { + } + if (headerDefinition.getEndLine().endsWith("EOL") && line != null && "".equals(line.trim())) { end = fileContent.getPosition(); } return end; diff --git a/license-maven-plugin/src/main/java/com/mycila/maven/plugin/license/header/HeaderSource.java b/license-maven-plugin/src/main/java/com/mycila/maven/plugin/license/header/HeaderSource.java index ec62dd7e2..ee4baff15 100644 --- a/license-maven-plugin/src/main/java/com/mycila/maven/plugin/license/header/HeaderSource.java +++ b/license-maven-plugin/src/main/java/com/mycila/maven/plugin/license/header/HeaderSource.java @@ -243,7 +243,7 @@ public static HeaderSource of(Multi multi, String inlineHeader, String headerPat protected final String content; private final boolean inline; - public HeaderSource(String content, boolean inline) { + protected HeaderSource(String content, boolean inline) { super(); this.content = content; this.inline = inline;