-
Notifications
You must be signed in to change notification settings - Fork 69
Fixing several spotbugs warnings #1030
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,6 +29,7 @@ | |
| import java.nio.file.Files; | ||
| import java.nio.file.Path; | ||
| import java.util.*; | ||
| import java.util.ArrayList; | ||
| import java.util.stream.Collectors; | ||
| import java.util.stream.Stream; | ||
|
|
||
|
|
@@ -196,7 +197,7 @@ public class DescriptorGeneratorMojo extends AbstractGeneratorMojo { | |
| * @since 3.5 | ||
| */ | ||
| @Parameter | ||
| private List<String> mojoDependencies = null; | ||
| private final List<String> mojoDependencies = new ArrayList<>(); | ||
|
|
||
| /** | ||
| * Creates links to existing external javadoc-generated documentation. | ||
|
|
@@ -372,7 +373,12 @@ public void generate() throws MojoExecutionException { | |
| mojoScanner.populatePluginDescriptor(request); | ||
| request.setPluginDescriptor(extendPluginDescriptor(request)); | ||
|
|
||
| outputDirectory.mkdirs(); | ||
| if (!outputDirectory.exists()) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would https://docs.oracle.com/javase/8/docs/api/java/nio/file/Files.html#createDirectories-java.nio.file.Path-java.nio.file.attribute.FileAttribute be more sensible to use here? It handles the case that the directory already exists, throwing appropriate exceptions for any other kinds of issue, so will likely be more descriptive than handling this manually. There is use of java.nio.file.Path further down this file as well, so the NIO API appears to already be in use. I believe the whole snippet here would just become: Files.createDirectories(outputDirectory.toPath());In Maven 4, I believe the |
||
| if (!outputDirectory.mkdirs()) { | ||
| throw new MojoExecutionException( | ||
| "Could not create output directory: " + outputDirectory.getAbsolutePath()); | ||
| } | ||
| } | ||
|
|
||
| PluginDescriptorFilesGenerator pluginDescriptorGenerator = new PluginDescriptorFilesGenerator(); | ||
| pluginDescriptorGenerator.execute(outputDirectory, request); | ||
|
|
@@ -459,7 +465,7 @@ public AnnotationVisitor visitAnnotation(String descriptor, boolean visible) { | |
| w.write(content); | ||
| } | ||
| } | ||
| } catch (Exception e) { | ||
| } catch (IOException e) { | ||
| throw new GeneratorException("Unable to generate index for v4 beans", e); | ||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can not be a final ... Maven need a possibility to set this filed during plugin configuration