Skip to content

Commit e17a526

Browse files
cowwocclaude
andcommitted
Fix Spotless formatting violations
- Remove unused import in CacheUtils.java - Fix import order in CacheUtilsPermissionsTest.java - Fix line length and string concatenation formatting 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 5436ee2 commit e17a526

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

src/main/java/org/apache/maven/buildcache/CacheUtils.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import java.nio.file.attribute.BasicFileAttributes;
3131
import java.nio.file.attribute.FileTime;
3232
import java.nio.file.attribute.PosixFilePermission;
33-
import java.nio.file.attribute.PosixFilePermissions;
3433
import java.util.Arrays;
3534
import java.util.Collection;
3635
import java.util.HashSet;
@@ -42,7 +41,6 @@
4241
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
4342
import org.apache.commons.compress.archivers.zip.ZipArchiveInputStream;
4443
import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream;
45-
4644
import org.apache.commons.lang3.StringUtils;
4745
import org.apache.commons.lang3.Strings;
4846
import org.apache.commons.lang3.mutable.MutableBoolean;
@@ -168,7 +166,8 @@ public static boolean isArchive(File file) {
168166
* @return true if at least one file has been included in the zip.
169167
* @throws IOException
170168
*/
171-
public static boolean zip(final Path dir, final Path zip, final String glob, boolean preservePermissions) throws IOException {
169+
public static boolean zip(final Path dir, final Path zip, final String glob, boolean preservePermissions)
170+
throws IOException {
172171
final MutableBoolean hasFiles = new MutableBoolean();
173172
// Check once if filesystem supports POSIX permissions instead of catching exceptions for every file
174173
final boolean supportsPosix = preservePermissions

src/test/java/org/apache/maven/buildcache/CacheUtilsPermissionsTest.java

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@
1818
*/
1919
package org.apache.maven.buildcache;
2020

21-
import org.junit.jupiter.api.Test;
22-
import org.junit.jupiter.api.io.TempDir;
23-
2421
import java.io.IOException;
2522
import java.io.OutputStream;
2623
import java.nio.charset.StandardCharsets;
@@ -31,6 +28,9 @@
3128
import java.util.Arrays;
3229
import java.util.Set;
3330

31+
import org.junit.jupiter.api.Test;
32+
import org.junit.jupiter.api.io.TempDir;
33+
3434
import static org.junit.jupiter.api.Assertions.assertFalse;
3535
import static org.junit.jupiter.api.Assertions.assertTrue;
3636

@@ -70,7 +70,7 @@ void testPermissionsAffectFileHashWhenEnabled() throws IOException {
7070
Path sourceDir2 = tempDir.resolve("source2");
7171
Files.createDirectories(sourceDir2);
7272
Path file2 = sourceDir2.resolve("script.sh");
73-
writeString(file2, "#!/bin/bash\necho hello"); // Identical content
73+
writeString(file2, "#!/bin/bash\necho hello"); // Identical content
7474

7575
// Set non-executable permissions (644)
7676
Set<PosixFilePermission> normalPermissions = PosixFilePermissions.fromString("rw-r--r--");
@@ -87,10 +87,11 @@ void testPermissionsAffectFileHashWhenEnabled() throws IOException {
8787
byte[] hash2 = Files.readAllBytes(zip2);
8888

8989
boolean hashesAreDifferent = !Arrays.equals(hash1, hash2);
90-
assertTrue(hashesAreDifferent,
91-
"ZIP files with same content but different permissions should have different hashes " +
92-
"when preservePermissions=true. This ensures cache invalidation when permissions change " +
93-
"(executable vs non-executable files).");
90+
assertTrue(
91+
hashesAreDifferent,
92+
"ZIP files with same content but different permissions should have different hashes "
93+
+ "when preservePermissions=true. This ensures cache invalidation when permissions change "
94+
+ "(executable vs non-executable files).");
9495
}
9596

9697
/**
@@ -119,7 +120,7 @@ void testPermissionsDoNotAffectHashWhenDisabled() throws IOException {
119120
Path sourceDir2 = tempDir.resolve("source2");
120121
Files.createDirectories(sourceDir2);
121122
Path file2 = sourceDir2.resolve("script.sh");
122-
writeString(file2, "#!/bin/bash\necho hello"); // Identical content
123+
writeString(file2, "#!/bin/bash\necho hello"); // Identical content
123124

124125
// Set non-executable permissions (644)
125126
Set<PosixFilePermission> normalPermissions = PosixFilePermissions.fromString("rw-r--r--");
@@ -147,12 +148,12 @@ void testPermissionsDoNotAffectHashWhenDisabled() throws IOException {
147148

148149
// Files should NOT retain their original different permissions
149150
// Both should have default permissions determined by umask
150-
assertFalse(perms1.equals(execPermissions) && perms2.equals(normalPermissions),
151-
"When preservePermissions=false, original permissions should NOT be preserved. " +
152-
"Files should use system default permissions (umask).");
151+
assertFalse(
152+
perms1.equals(execPermissions) && perms2.equals(normalPermissions),
153+
"When preservePermissions=false, original permissions should NOT be preserved. "
154+
+ "Files should use system default permissions (umask).");
153155
}
154156

155-
156157
/**
157158
* Java 8 compatible version of Files.writeString().
158159
*/

0 commit comments

Comments
 (0)