Skip to content

Commit 4bc0511

Browse files
Enable spotless - fix checkstyle issues
1 parent 835a015 commit 4bc0511

File tree

4 files changed

+21
-10
lines changed

4 files changed

+21
-10
lines changed

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@
185185
<artifactId>maven-checkstyle-plugin</artifactId>
186186
<configuration>
187187
<configLocation>${checkstyle.spotless.config}</configLocation>
188+
<violationIgnore>MagicNumber</violationIgnore>
188189
</configuration>
189190
</plugin>
190191
</plugins>

src/main/java/org/codehaus/mojo/buildhelper/AbstractUpToDatePropertyMojo.java

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,30 +72,38 @@ protected void execute(UpToDatePropertySetting config) throws MojoExecutionExcep
7272
if (getLog().isDebugEnabled()) {
7373
try {
7474
StringBuilder msg = new StringBuilder(targetFile.getCanonicalPath());
75-
if (!targetFile.exists()) msg.append(" (nonexistent)");
75+
if (!targetFile.exists()) {
76+
msg.append(" (nonexistent)");
77+
}
7678
msg.append("\n\tis ")
7779
.append(upToDate ? "up to date" : "out of date")
7880
.append(" with respect to \n\t")
7981
.append(srcFile.getCanonicalPath());
80-
if (!srcFile.exists()) msg.append(" (nonexistent)");
82+
if (!srcFile.exists()) {
83+
msg.append(" (nonexistent)");
84+
}
8185

8286
getLog().debug(msg);
8387
} catch (IOException e) {
8488
// Just a log entry so not fatal.
8589
}
8690
}
8791

88-
if (!upToDate) break;
92+
if (!upToDate) {
93+
break;
94+
}
8995
}
9096
} catch (MapperException e) {
9197
throw new MojoExecutionException("", e);
9298
}
9399
}
94100

95101
// Set the property to the appropriate value, depending on whether target files are up to date WRT source files.
96-
if (upToDate) defineProperty(config.getName(), config.getValue().trim());
97-
else if (!StringUtils.isBlank(config.getElse()))
102+
if (upToDate) {
103+
defineProperty(config.getName(), config.getValue().trim());
104+
} else if (!StringUtils.isBlank(config.getElse())) {
98105
defineProperty(config.getName(), config.getElse().trim());
106+
}
99107
}
100108

101109
private File getFile(FileSet fileSet, boolean useOutputDirectory, String path) {

src/main/java/org/codehaus/mojo/buildhelper/ReserveListenerPortMojo.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public class ReserveListenerPortMojo extends AbstractMojo {
6464

6565
private static final Integer MAX_PORT_NUMBER = 65535;
6666

67-
private static final Object lock = new Object();
67+
private static final Object LOCK = new Object();
6868

6969
/**
7070
* A List to property names to be placed in Maven project. At least one of {@code #urls} or {@code #portNames} has
@@ -207,7 +207,7 @@ private ServerSocket getServerSocket() throws IOException, MojoExecutionExceptio
207207
return new ServerSocket(0);
208208
}
209209
if (randomPort) {
210-
synchronized (lock) {
210+
synchronized (LOCK) {
211211
List<Integer> availablePorts = randomPortList();
212212
for (Iterator<Integer> iterator = availablePorts.iterator(); iterator.hasNext(); ) {
213213
int port = iterator.next();
@@ -223,7 +223,7 @@ private ServerSocket getServerSocket() throws IOException, MojoExecutionExceptio
223223
} else {
224224
// Might be synchronizing a bit too largely, but at least that defensive approach should prevent
225225
// threading issues (essentially possible while put/getting the plugin ctx to get the reserved ports).
226-
synchronized (lock) {
226+
synchronized (LOCK) {
227227
int min = getNextPortNumber();
228228

229229
for (int port = min; ; ++port) {
@@ -371,7 +371,7 @@ private class UrlResource {
371371

372372
private InputStream stream;
373373

374-
public UrlResource(String url) throws MojoExecutionException {
374+
UrlResource(String url) throws MojoExecutionException {
375375
if (url.startsWith(CLASSPATH_PREFIX)) {
376376
String resource = url.substring(CLASSPATH_PREFIX.length(), url.length());
377377
if (resource.startsWith(SLASH_PREFIX)) {

src/test/java/org/codehaus/mojo/buildhelper/FixtureUtils.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@ public static void createResources(File baseDir, Properties properties, long bas
101101
for (String propertyName : properties.stringPropertyNames()) {
102102
File file = new File(baseDir, propertyName);
103103
File parent = file.getParentFile();
104-
if (parent != null) parent.mkdirs();
104+
if (parent != null) {
105+
parent.mkdirs();
106+
}
105107
file.createNewFile();
106108

107109
// If required, set the last modification timestamp.

0 commit comments

Comments
 (0)