Skip to content

Commit 2231244

Browse files
committed
Merge branch '3.1.x'
2 parents 085e12a + e957c30 commit 2231244

File tree

2 files changed

+3
-19
lines changed

2 files changed

+3
-19
lines changed

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootArchiveSupport.java

+2-18
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ private Integer getMode(CopySpec copySpec, String methodName, Supplier<Integer>
161161
try {
162162
Object filePermissions = ((Property<Object>) copySpec.getClass().getMethod(methodName).invoke(copySpec))
163163
.getOrNull();
164-
return getMode(filePermissions);
164+
return (filePermissions != null)
165+
? (int) filePermissions.getClass().getMethod("toUnixNumeric").invoke(filePermissions) : null;
165166
}
166167
catch (Exception ex) {
167168
throw new GradleException("Failed to get permissions", ex);
@@ -170,23 +171,6 @@ private Integer getMode(CopySpec copySpec, String methodName, Supplier<Integer>
170171
return fallback.get();
171172
}
172173

173-
private Integer getMode(Object permissions) throws Exception {
174-
if (permissions == null) {
175-
return null;
176-
}
177-
String user = asIntegerString(permissions.getClass().getMethod("getUser").invoke(permissions));
178-
String group = asIntegerString(permissions.getClass().getMethod("getGroup").invoke(permissions));
179-
String other = asIntegerString(permissions.getClass().getMethod("getOther").invoke(permissions));
180-
return Integer.parseInt("0" + user + group + other, 8);
181-
}
182-
183-
private String asIntegerString(Object permissions) throws Exception {
184-
boolean read = (boolean) permissions.getClass().getMethod("getRead").invoke(permissions);
185-
boolean write = (boolean) permissions.getClass().getMethod("getWrite").invoke(permissions);
186-
boolean execute = (boolean) permissions.getClass().getMethod("getExecute").invoke(permissions);
187-
return Integer.toString(((read) ? 4 : 0) + ((write) ? 2 : 0) + ((execute) ? 1 : 0));
188-
}
189-
190174
private boolean isUsingDefaultLoader(Jar jar) {
191175
return DEFAULT_LAUNCHER_CLASSES.contains(jar.getManifest().getAttributes().get("Main-Class"));
192176
}

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootZipCopyAction.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ private int getPermissions(FileCopyDetails details) {
471471
if (GradleVersion.current().compareTo(GradleVersion.version("8.3")) >= 0) {
472472
try {
473473
Object permissions = ((Provider<Object>) details.getClass()
474-
.getMethod("getImmutablePermissions")
474+
.getMethod("getPermissions")
475475
.invoke(details)).get();
476476
return ((Provider<Integer>) permissions.getClass().getMethod("toUnixNumeric").invoke(permissions))
477477
.get();

0 commit comments

Comments
 (0)