Skip to content

Commit c25e532

Browse files
committed
Merge branch '2.7.x' into 3.0.x
2 parents e314e11 + dbc06fa commit c25e532

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

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ private Integer getMode(CopySpec copySpec, String methodName, Supplier<Integer>
158158
try {
159159
Object filePermissions = ((Property<Object>) copySpec.getClass().getMethod(methodName).invoke(copySpec))
160160
.getOrNull();
161-
return getMode(filePermissions);
161+
return (filePermissions != null)
162+
? (int) filePermissions.getClass().getMethod("toUnixNumeric").invoke(filePermissions) : null;
162163
}
163164
catch (Exception ex) {
164165
throw new GradleException("Failed to get permissions", ex);
@@ -167,23 +168,6 @@ private Integer getMode(CopySpec copySpec, String methodName, Supplier<Integer>
167168
return fallback.get();
168169
}
169170

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

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ private int getPermissions(FileCopyDetails details) {
465465
if (GradleVersion.current().compareTo(GradleVersion.version("8.3")) >= 0) {
466466
try {
467467
Object permissions = ((Provider<Object>) details.getClass()
468-
.getMethod("getImmutablePermissions")
468+
.getMethod("getPermissions")
469469
.invoke(details)).get();
470470
return ((Provider<Integer>) permissions.getClass().getMethod("toUnixNumeric").invoke(permissions))
471471
.get();

0 commit comments

Comments
 (0)