Skip to content

Commit 3550d4c

Browse files
committed
update reflection exceptions to use ReflectiveOperationException
1 parent b7fa208 commit 3550d4c

File tree

1 file changed

+3
-3
lines changed
  • jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/skaffold

1 file changed

+3
-3
lines changed

jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/skaffold/FilesTaskV2.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ private void addGradleFiles(Project project) {
154154
} else if (Files.exists(projectPath.resolve(Settings.DEFAULT_SETTINGS_FILE))) {
155155
skaffoldFilesOutput.addBuild(projectPath.resolve(Settings.DEFAULT_SETTINGS_FILE));
156156
}
157-
} catch (Exception e) {
157+
} catch (ReflectiveOperationException e) {
158158
// Fall back to default settings file location if reflection fails
159159
if (Files.exists(projectPath.resolve(Settings.DEFAULT_SETTINGS_FILE))) {
160160
skaffoldFilesOutput.addBuild(projectPath.resolve(Settings.DEFAULT_SETTINGS_FILE));
@@ -249,7 +249,7 @@ private Project getDependentProject(ProjectDependency projectDependency) {
249249
java.lang.reflect.Method getDependencyProjectMethod =
250250
projectDependency.getClass().getMethod("getDependencyProject");
251251
return (Project) getDependencyProjectMethod.invoke(projectDependency);
252-
} catch (Exception e) {
252+
} catch (ReflectiveOperationException e) {
253253
// Fall through to getPath() approach (Gradle 9+)
254254
}
255255

@@ -258,7 +258,7 @@ private Project getDependentProject(ProjectDependency projectDependency) {
258258
java.lang.reflect.Method getPathMethod = projectDependency.getClass().getMethod("getPath");
259259
String path = (String) getPathMethod.invoke(projectDependency);
260260
return getProject().project(path);
261-
} catch (Exception ex) {
261+
} catch (ReflectiveOperationException ex) {
262262
throw new RuntimeException(
263263
"Failed to resolve dependent project from " + projectDependency, ex);
264264
}

0 commit comments

Comments
 (0)